Layout of .SET and .LSET files

From Mach3Wiki
Jump to: navigation, search

Contents

Introduction

The screen layouts are stored in binary files and must not be opened with Microsoft Word, Notepad or the like. To view a layout in "clear text" export it using Mach2ScreenTweak. For reference, the file structure of .SET files is given here.


Overall file format

The file consists of (a) a count of controls across all screens of the layout, (b) a record defining each control and (c) a record giving the colours to be used for displaying controls.

This is illustrated below

Data Format Description
Int32 Count of controls in record = n
ControlRec Information for control 1
ControlRec Information for control 2
ControlRec Information for control 3
ControlRec Information for control 4
etc.
ControlRec Information for control n
ColorsRec = 10 x Int32 Colors for layout


Int32 is a four byte signed integer. As usual it is stored in the file with the least significant byte first.

The structure of ControlRec and ColorsRec is defined below. Notice that ControlRecs are variable in length (they contain several variable length strings) and ColorsRec consists of ten Int32s (i.e. 40 bytes)


ControlRec

Figure 7.4 shows the structure of each ControlRec. The values are integers or strings.

Integers are as defined already, some of which indicate True/False boolean values by being Zero = True, nonZero = False.

Strings follow the C Language structure of a one byte character count (unsigned so allowing 0 to 255 characters) followed by the characters, one per byte, using the Windows character set. This is illustrated in figure 7.5. Care should be taken if you try to put a " (double-quote) in a string as this character is used as the delimiter in CSV files.

Note: that although strings and hence ControlRecs are variable length they can be decoded by knowing the format and moving serially through the file interpreting the character counts of the strings. Direct access to records in the layout file are not possible.

Most of the fields of the ControlRec are dedicated to data for a particular type of control. The values for other controls will be "undefined". The following explains the purpose of each value. The detailed coding is to be found elsewhere in this wiki.


Screen

The number of the screen (1 to 15) on which control will appear. Value 0 will appear on all screens (i.e. persistent control)


Type

The coded type of each control as follows:

TypeCode Control
1 DRO
2 Scrollbar
3 Bitmap
4 Conventional Button
5 Jogball
6 LED
7 Label
8 Bitmap Button
9 Manual Data Entry (MDI)
10 G-code window
11 Toolpath display


Function

The function is a code starting from 0 for each type of control defining what it displays or does. The code numbers can be obtained by counting (from 0) the radio buttons in the Screen Designer dialog box that sets up the relevant type of control. The following functions are extended by OEMcodes (see below):


Control type Function code that is extended by OEMcode DRO 12 Conventional button 32 LED 56 Bitmap button 32

The full list of functions is listed in the tables of this wiki.


OEMCode

DROs, LEDs and conventional and bitmap buttons which have special purposes and are not included on the radio buttons in Screen Designer are accessed via the "OEM" radio button and an "OEM" code. This is really an extension to the Function. Public OEM codes are listed in this wiki.


Text

For conventional Buttons, this is the caption on the button.

GText

For Conventional and Bitmap buttons whose function is 33 this string is the G-code line to issue.

BitMapPath

For Bitmap buttons this is the filename of the .BMP file on the user's machine. (e.g. C:\Mach2\MyStart.bmp) 7.3.2.8 Horiz & Vert For Jogball controls the code gives the axes to be jogged for horizontal and vertical "movement" of the "ball". Axis coding is X = 0, Y = 1, Z = 2, A = 3, B = 4, C = 5 7.3.2.9 Label The string displayed in a Label control. Some values like File, Error are "intelligent" and are replaced by what they describe at runtime. Labels starting with the S mark (§) are used as screen captions. 7.3.2.10 Color Used for LED controls. Green = 0, Red = 1, Yellow = 2 7.3.2.11 HotKey For Conventional and Bitmap buttons this gives the scan code of the HotKey to activate the button (or 0 for no HotKey). 7.3.2.12 Flash Flag LED will flash if this flag is non-zero 7.3.2.13 RedGreen Flag LED will change colour from Red to Green when signal is active. Color value is ignored 7.3.2.14 Tabbing Group For DROs this defines a group of DROs The DROs in a group are selected cyclically by the up/down arrow cursor keys. The left/right arrow keys move between different DRO groups. 7.3.2.15 PosX1, Y1, X2, Y2 These values define the top left and bottom right coordinates of the control (in pixels) on the screen. The top left corner of the screen is X = 0, Y = 0. Controls may be drawn partially or wholly off the visible screen at the current resolution without raising an error. 7.3.3 ColorsRec The format of the ColorsRec is given in figure 7.6. A Color32 value has its most significan byte = 0 and the following three bytes the unsigned intensity (i.e. range 0 to 255) of the colors Red, Green and Blue in decreasing significance. Thus Yellow (i.e. Red and Green) would be coded using hexadecimal notation as 0x00FFFF00 i.e. decimal 16776960. The color chooser dialog in Screen Designer displays the individual RGB values for a control.