Available Variable Types
The variables block in GeoDict Python macros provides many options. A summary of all these options and some short explanations and examples can be found in the comment block after the variables block in a recorded macro.
The variables block defines the parameters displayed in the Parameters dialog in the Macro Execution Control.
In the following, the available types of variables are described, and examples are given. The type must be given as a string for the key ‘Type’.
int
For a variable of type ‘int’ only integer values are allowed, i.e. … -2, -1, 0, 1, 2, … If Vary is checked in the Macro Execution Control, also lists of values can be entered with the start:step:end syntax.
|
uint
For a variable of type ‘uint’ only nonnegative integer values are allowed for this variable, i.e. 0, 1, 2, … In the Parameters dialog it is also possible to change the value by clicking the arrows on the right or by turning the mouse wheel while the cursor is rested on the parameter box. If a check is added, the arrows will not allow values outside the given range. If Vary is selected in the Macro Execution Control, also lists of values can be entered with the start:step:end syntax.
|
double
For a variable of type 'double' any floating point number is allowed, e.g. -0.75, 10.3, 42.999. If Vary is checked in the Macro Execution Control, also lists of values can be entered with the start:step:end syntax.
|
bool
A ‘bool’ variable defines a checkbox in the Parameters dialog. Possible values for the optional key 'BuiltinDefault' are False (not checked) and True (checked).
|
string
Everything typed in the parameter box for a variable of type 'string' will be handled as a string in the macro.
|
folderstring
For a variable of type 'folderstring' in the Parameters dialog a Browse button will appear next to the parameter box to search for the desired folder on the computer.
|
filestring
For a variable of type 'filestring' in the parameter dialog a Browse button will appear next to the parameter box to search for the desired file on the computer. The 'Unit' is the file extension for this variable type and must be specified, e.g. 'gdr' or 'xlsx'. You can also enter different file types by semicolon, e.g. "gdr;gdt".
|
material
For a variable of type 'material' the desired material can be selected from the GeoDict material data base. The 'Unit' must be specified as 'solid', 'fluid' or 'porous'. Also, a 'BuiltinDefault' value is needed, e.g. 'Manual'.
|
combo
A variable of type 'combo' defines a value choice, that will be displayed in a pull-down menu (also named combo box) in the parameter dialog. For 'Unit' define a string with the components separated by semicolon.
|
table
A variable of type 'table' will transform the values entered in the Parameters dialog into a list. The number of columns is defined with the key 'Unit'. There, the types for the different columns must be given as a list. Available column types are 'int', 'float' and 'string'. The column headers are also given as a list of strings and are optional.
In the Parameters dialog a new row is added as soon as at least one value is entered in each existing row.
In the following example, three columns are given. Here, the values in the first column must be integers, the values in the second column float and the values in the third column string, as defined for the key 'Unit'. The 'BuiltinDefault' values define two rows in the table.
|
labelgroup
A variable of type 'labelgroup' defines a group within the Parameters dialog. The key 'Member' is mandatory and defines which of the following variables will belong to the group. The members have to be given in a list, containing the members name as a string. The 'BuiltinDefault' must be True. The members are defined separately as variables and can have any type.
In the following example, a group with two members is defined in 'Variable1'. The first member is defined as 'Variable2' as type 'double' and the second member is defined as 'Variable3' as type 'string'. Their names 'member1' and 'member2' are given in the list for the key 'Member'.
|
boolgroup
A variable of type 'boolgroup' defines two groups within the Parameters dialog. Checking or not checking the checkbox decides which group is shown. The members have to be defined as separate variables and can have any type. The names must be given for the key 'Member' for the boolgroup variable, as a dictionary, consisting of the keys 'true' and 'false' and the respective group members as a list.
In the following example, only one group is defined. This results in an empty group if the checkbox is not checked, corresponding to the not given value 'false'.
|
combogroup
A variable of type 'combogroup' defines multiple groups. The selection from the pull-down menu decides which group is displayed. The list defining the content of the pull-down menu must be defined for the key 'Unit'. The values must be given as a string, values separated by comma. The members of the groups must be defined as separate variables and can have any type. The names must be given for the key 'Member' for the combogroup variable, as a dictionary, consisting of the defined keys (values in the pull-down menu, defined in 'Unit') and the respective group members as a list.
In the following example two groups can be selected. Observe how the available parameters change according to the selected group in the Parameters dialog.
|