GiD - The personal pre and post processor
value
<value>
It is the main field to store data. This field allows to define an entry, or a combobox in the window.
It can contain the following fields: <function>, <dependencies>, <edit_command>
The parameters are as follows,
n - Name used to reference the field, especially when writing the .dat file.
pn - Label that will be visualized by the user. It can be translated.
v - The value or default value for a 'value' field
icon - An optional icon name
state - Specifies one of the four states for the entry: normal, disabled, hidden or readonly. If the entry is readonly, then the value may not be changed using widget commands and no insertion cursor will be displayed, even if the input focus is in the widget; the contents of the widget may still be selected. If the entry is disabled, the entry may not be changed, no insertion cursor will be displayed and the contents will not be selectable. Note that hidden entry can be used for storing hidden values. It also permits to define a Tcl function, by means of square brackets.
values - Comma-separated list of strings to fill a combobox. For instance, values="mech,therm". Can call a Tcl proc including arguments, with [ ] like values='[GetMyValues]'.
The Tcl procedure must be defined in a <proc> node of the spd or now directly as a normal Tcl procedure, in this case it is possible to add as argument %W that will be replaced with the dom node (this become simpler that a double step of define an extra <proc> node that finally call to a Tcl proc, e.g. values='[GetMyValues %W]')
values_tree - A drop-down tree to fill a combobox, defined by a comma-separated list of strings. It can call a Tcl proc, by means of square brackets [], that must returns a list of comma-separated strings, each one represented as the format: "level_in_the_tree name_in_dropdown_tree name_in_combobox enable_boolean". For instance, a drop-down tree defined as (see image below): values_tree="0 Air Air material 1,0 Steel Steel material 1,0 Aluminium Aluminium material 0,1 Aluminium Aluminium material 1"
dict - Comma-separated list of key,value. This operation places a mapping from the given key to the given value, which is shown in the GUI. Values can be translated.
For instance, dict="mech,Mechanical,therm,Thermal" shows Mechanical and Thermal.
string_is - Tests the validity of various interpretations of a string, as follows:
integer - To test if a string is an integer value.
integer_or_void - To test if a string is an integer value, or empty (not-filled).
double - To test if a string is a double value.
double_or_void - To test if a string is a double value, or empty (not-filled).
% - To test if a string is a percentage (%).
list_of_double - To test if a string is a list of doubles, representing a data structure of doubles in Tcl.
entier - To test if a string is an integer (of any size), written in one of the forms Tcl can parse, or an integer in scientific notation (for instance 1e30).
entier_or_void - To test if a string is an integer (of any size), written in one of the forms Tcl can parse, or an integer in scientific notation (for instance 1e30), or empty (not-filled).
double_coord - a string of doubles separated by commas (without extra spaces)
double_positive - a double >=0.0
double_positive_non_zero - a double > 0.0
Example:
<value n="SomeInteger" pn="An integer number" v="1" string_is="integer" help="example of a input value that check that the user enter a valid integer string"></value>
validate_expr - To validate with an arbitrary valid Tcl expression. The symbolic argument %P represent the user value to be validated. If the expr is true the value is accepted.
Be careful, this command is defined inside a XML file and special characters like > < & must be encoded. For example the string "%P>=0.0 && %P<=1.0" must be encoded with "%P>=0.0 && %P<=1.0"
Example: to force user values of type double but in the range from 0.0 to 1.0
<value n="SomeReal" pn="A real number" v="0.5" string_is="double" validate_expr="%P>=0.0 && %P<=1.0"></value>
format_command - with a Tcl proc name to format the value calling it. The Tcl proc has as arguments value and unit and must return the new value
Example: to format a real number entry with two decimals
<value n="Weight" pn="Weight" v="0.0" unit_magnitude="M" units="kg" string_is="double_positive_non_zero" format_command="my_format_two_decimals"/>
And the Tcl proc used
proc my_format_two_decimals { value units } { return [format "%.2f" $value] }
help - It displays a pop-up window of help information related to the task the user is performing.
actualize_tree - It updates the information in the whole data tree, and automatically refresh data shown in the user interface. It is a boolean value as a 1 or 0 that indicates if it is activated or deactivated. If the data source is changed, such as new fields have been added or data values and field have been modified, all the user interface will reflect those changes. Furthermore, all the TCL procedures defined in the data tree will be called and the whole data tree will be refreshed. Therefore, this instruction must be carried out only when necessary.
actualize - This only updates a specified field in data tree. Note that only this specified field will be refreshed in the user interface, and not the whole data tree. It is a boolean value as a 1 or 0 that indicates if it is activated or deactivated.
menu_update - It allows to update the menus.Values can be yes or no. It is necessary to define a <dependencies> field, as follows,
<dependencies node="/*/blockdata[@n='General_Data']/value[@n='analysis_type']" att1="menu_update" v1="[TCL_proc]" actualize="1"/>
fieldtype - To declare specialized values for common scenarios. It can be:
- long text - It creates a text box in the user interface in order to introduce a multi-line text.
- vector: to show 1, 2 or 3 entries for each component of a vector. The value v will be filled with a string separating by comma each component (like v="1.0,0.0,0.0" for dimensions 3)
other optional attributes for vector
- dimensions: could be usually 1, 2, 3 (but is possible to set more than 3 to have more columns)
- pick_point : 1 , with dimensions='1', to declare the field as special to store a point id, and show an extra button on the right to pick a point interactively
- pick_surf: 1 , with dimensions='1', to pick a surface
- pick_vector: 1 , with dimension='3', to select x y z coordinates
Example:
<container n="some_points" pn="some points"> <value n="some_point" pn="Some point" fieldtype="vector" dimensions="1" string_is="integer_or_void" pick_point="1" help="To enter a point"/> </container>
pick_coordinates - It is a boolean value as a 1 or 0 that indicates if the entry must show a button that allow click a coordinate interactively.
Example:
<container n="get_coord" pn="Get coordinates"> <value n="coord" pn="Get coordinates" fieldtype="vector" dimensions="3" format="%.6g" v="0.0,0.0,0.0" pick_coordinates="1" help="Please enter coordinates\n(x,y,z)"> <dependencies node="../value[@n='point']" att1="v" v1="{@v}"/> </value> </container>
editable - It is a boolean value as a 1 or 0 that indicates if the entry could be changed or not. If it is activated (1) the entry may not be changed, no insertion cursor will be displayed and the contents will not be selectable.
unit_magnitude - Physical quantity (i.e. L, for Length). For more information about this attribute, see the section Description of the units
units - Unit of the physical quantity (i.e. m). For more information about this attribute, see the section Description of the units
units_state - Optional attribute (used with units) that can be set to 'disabled', then that the units combo_box won't be unfolded and the user cannot change its unit.
function - Contains a Tcl command, which is executed when is called. It permits to create or edit a function for a determined entry.
function_func - Permits to define a TCL function.
values_check - Special field to shown a collection of checkboxes that can be set by the user at runtime. Must call a Tcl function, by means of square brackets, that return a comma separated list of items. The value v will be set to the selected names (comma separated)
Example:
.spd file (XML)
<container n="test" pn="my test"> <value n="what_to_write" pn="what to write" v="Velocity,Pressure" values_check="[check_what_to_write %W]"></value> </container>
.tcl file
proc check_what_to_write { domnode } { set items [list] lappend items "Velocity" lappend items "Pressure" lappend items "Temperature" return [join $items ","] }
When the user click the 'my_test' tree item the window is showed to allow select with a checkbox the user selection.
min_two_pnts - It is a boolean value as a 1 or 0 and indicates that two points or more are required in a linear interpolation.
unit_definition - The fields <value/> used to choose the default units in the GUI are special. They contain the attribute called unit_definition="magnitude" being magnitude the name 'n' to be used in that field. It is important to note that these kind of fields does not contain dependencies.
show_in_window - Can be 1 or 0 (1 by default). It indicates if the value must be shown in the conditions window. If set to 0, the value will be shown in the tree, but will be hidden in the window.
Example:
<value n='units_length' pn='Length' unit_definition='L'/> <value n='units_mass' pn='Mass' unit_definition='M'/> <value n='units_force' pn='Force' unit_definition='F'/>
unit_mesh_definition - The field <value/> used to choose the mesh unit is special. It has the attribute unit_mesh_definition="1", and it does not contain any "v" attribute or dependencies.
Example:
<value n="units_mesh" pn="Geometry units" unit_mesh_definition="1"/>
units_system_definition - The field <value/> used to choose the units system is special. It has the attribute units_system_definition="1", it does not contain any "v" attribute, and it contains a unique dependency related to the unit fields.
Example:
<value n='units_system' pn='Units system' units_system_definition='1' icon='units-16'> <dependencies node="//*[@unit_definition or @unit_mesh_definition='1']" att1='change_units_system' v1='{@v}'/> </value>
COPYRIGHT © 2022 · GID · CIMNE