GiD - The personal pre and post processor
condition
<condition>
It contains some inputs with values and can be applied to groups. For each applied group, a dependent set of values will be created that belong to that group, for this condition.
A group is a category that brings together selected entities (points, lines, surfaces and/or volumes) with identical properties. I should be noted that any entity can belong to more than one group (unlike the concept of layer, where any entity cannot belong to more than one layer).
It can contain the following fields: <value>, <dependencies>, <edit_command>
On the resulting window, in addition to the inputs there will be the following set of buttons:
Button 'Select' enables to create a group and choose entities into it.
ov, ovi, i=1,2 - Indicates to which entity types can a 'condition' be applied. Can be one or several of the following values: point, line, surface, volume.
Note: usually a condition is attached to a group, and ov is used, but some special conditions are attached to two groups, then ov1 and ov2 must be used (for example could be used to define master-slave parts)
ovp, ovpi, i=1,2 - Optional, to visually show an string alternative to the ov keyword values
ov_default - Indicates the default entity type selected (used in case of ov with multiple types). Can be one, and only one of the following values: point, line, surface, volume.
ovm, ovmi, i=1,2 - Indicates to which entity can a 'condition' be applied. It can be element, node, face_element or ""
ov_element_types - Optional, to restrict the element types that could be applied. Must be a list of comma separated of the following values: linear, triangle, quadrilateral, tetrahedra, hexahedra, prism, point, pyramid, sphere, circle (by default all element types are allowed)
Example: a condition attached to two groups, not to one as usual
<condition n="ContactMasterSlave" pn="Master-Slave contacts Surf-Surf" help="Use this condition to prescribe the contact between selected entities" ov1="surface" ovm1="element" ov1p="Assign Master" ov2="surface" ovm2="element" ov2p="Assign Slave"> <value n="friction_coeff" pn="Friction Coeff." v="0.0" help="Friction coefficient for Coulomb contacts."/> </condition>
state - Specifies one of two states for the field: normal, or hidden. Note that hidden <container> field can be used for storing hidden values, that you do not want to show in the user interface. It also permits to handle a Tcl function, by means of square brackets.
groups_icon -It allows to put a custom image when creating groups in the data tree, with .png format. The image should be stored inside the images folder of the problem type.
allow_group_creation - It is a boolean value as a 1 or 0 that allows to specify that only existing groups can be chosen in the condition window. It is activated by default. A groups_list attribute must be added when it is deactivated, as a procedure returning a list of groups (i.e. groups_list="[my_groups_proc]").
Example:
<condition n="Point_Weight" pn="Point Weight" icon="constraints" groups_icon="groups-16"> ... </condition>
before_update_proc - Set to a Tcl procedure name to be called when choosing this field in data tree.
update_proc - It calls a Tcl procedure, when clicking on the 'Ok' button in the window or when changing the value of the entry.
Must be a Tcl procedure name with possible extra special arguments %W, %TREE, %BC, see proc
This procedure can for example validate user values
Example:
<condition n="Point_Weight" pn="Point Weight" ov="point" ovm="node" icon="darkorange-weight-18" groups_icon="yelowish-group" help="Concentrated mass" update_proc="my_validate_point_weigth_child_values %W %TREE %BC"> <value n="Weight" pn="Weight" v="0.0" unit_magnitude="M" units="kg" help="Specify the weight that you want to apply"/> <symbol proc="gid_groups_conds::draw_symbol_image weight-18.png" orientation="global"/> </condition>
and define in a .tcl file this proc named my_validation that will receive as argument the tdom node of this condition. In this case is using the GiD proc W to show the tdom data in XML format
and modify the format of the value child nodes to force 2 decimals ("%.2f" format)
proc my_validate_point_weigth_child_values { domNode tree boundary_conds } { #W [$domNode asXML] set xpath {./group/value[@n='SomeReal']} foreach value_node [$domNode selectNodes $xpath] { set value [$value_node getAttribute v] set txt [format "%.2f" $value] $value_node setAttribute v $txt if { [winfo exists $boundary_conds] } { #update the GUI tree widget also set item_id [$boundary_conds get_item_from_domNode $value_node] $tree item element configure $item_id 0 e_text -text $txt } } return 0 }
COPYRIGHT © 2022 · GID · CIMNE