GiD 15 Customization Manual
GiD 15 Customization Manual
Customization Manual
1
1 FEATURES
GiD offers the following customization features:
Complete menu´s can be customised and created to suit the specific needs of the user´s simulation software.
Simple interfaces can be developed between the data definition and the simulation software.
Simple interfaces based on scalar, vector and matrix quantities can be developed for the results visualisation.
Menus for the results visualisation can be customised and created according to the needs of the application or analysis.
2 INTRODUCTION
When GiD is to be used for a particular type of analysis, it is necessary to predefine all the information required from the
user and to define the way the final information is given to the solver module. To do so, some files are used to describe
conditions, materials, general data, units systems, symbols and the format of the input file for the solver. We give the
name Problem Type to this collection of files used to configure GiD for a particular type of analysis.
Note: You can also learn how to configure GiD for a particular type of analysis by following the Problem Type Tutorial;
this tutorial is included with the GiD package you have bought. You can also download it from the GiD support web page
(http://www.gidhome.com/support).
GiD has been designed to be a general-purpose Pre- and Postprocessor; consequently, the configurations for different
analyses must be performed according to the particular specifications of each solver. It is therefore necessary to create
specific data input files for every solver. However, GiD lets you perform this configuration process inside the program itself,
without any change in the solver, and without having to program any independent utility.
To configure these files means defining the data that must be input by the user, as well as the materials to be implemented
and other geometrical and time-dependent conditions. It is also possible to add symbols or drawings to represent the
defined conditions. GiD offers the opportunity to work with units when defining the properties of the data mentioned above,
but there must be a configuration file where the definition of the units systems can be found. It is also necessary to define
the way in which this data is to be written inside the file that will be the input file read by the corresponding solver.
From the 13th version of GiD, a new system of problemtye has been implemented (based in the CustomLIB library).
Although the 'classic' problem type system is still supported by GiD, it is considered deprecated, as the new one offers clear
advanteges in terms of usability, performance and integration cappabilities. Documentation about the deprecated classic
problem type system can be found in the annex of this manual APPENDIX B (classic problemtype system) -pag. 175-.
This new problem type definition uses a single .spd file to describe general properties, materials, conditions and units (as a
tree with xml syntax). All this data is showed in a 'tree view', and materials and conditions are associated to groups of
enties.
About writting the input file, Tcl commands are used to write the data in files (optionally aided with the special funcion
GiD_WriteCalculationFile for efficiency).
The new problem type creation system lean on a collection of tools, which facilitates the development of advanced problem
types for customizing the personal pre and post processor system GiD for computer simulation codes. It is based on a XML
hierarchical structure and an automatic physical tree view.
5
3 XML file
The file problem_type.xml declare information related to the configuration of the problem type, such name, version, file
browser icon, password validation or message catalog location, history news, etc.
The data included inside the xml file should observe the following structure:
<Infoproblemtype version="1.0">
<Program>
<Name>XXX</Name>
<Version>XXX</Version>
...
</Program>
</Infoproblemtype>
By default GiD read this file when loading the problemtype and provide its key-value pairs parsed in a Tcl global array
named 'problemtype_current' (e.g. $::problemtype_current(version) returns the version of the problemtype)
The name and version of the problemtype is used to compare the version of the problemype used for a old model and do
an automatic transform if necessary to try to map the old and new data fields.
The 'Internet retrieve' tool also uses Name and Version to compare a local problemtype with the remote copy of the
Internet repository.
Optional nodes:
<MinimumGiDVersion>12.1.11d</MinimumGiDVersion> to state the minimun GiD version required.
If the problemype is loaded in a GiD version lower than the one required a warning message will be
raised.
<ImageFileBrowser>images/ImageFileBrowser.gif</ImageFileBrowser> icon image to be used in the file
browser to show a project corresponding to this problem type. The recommended dimensions for this
image are 17x12 pixels.
<MsgcatRoot>scripts/msgs</MsgcatRoot> a path, relative or absolute, indicating where the folder with
the name msgs is located. The folder msgs contains the messages catalog for translation.
<PasswordPath>..</PasswordPath> a path, relative or absolute, indicating where to write the password information
see ValidatePassword node -pag. 5-).
<ValidatePassword></ValidatePassword> provides a custom validation script in order to override the default GiD
validation (see ValidatePassword node -pag. 5-).
<CustomLibAutomatic>1</CustomLibAutomatic> This node must be defined only for 'customLib like' problemtypes,
with values 0 (default) or 1 .If true it allows to do automatic tasks to use the library (otherwise the problemtype
developer must write extra code to use the library, like load packages, initialize the library, etc.)
<CustomLibNativeGroups>1</CustomLibNativeGroups> This node must be defined only for 'customLib like'
problemtypes, with values 0 (default) or 1, to specify that the library uses 'native GiD groups' instead of
'pseudo-groups GiD conditions'.
The default action taken by GiD when validating a problem type password is verifying that it is not empty. When a
password is considered as valid, this information is written in the file 'password.txt' which is located in the problem type
directory. In order to override this behaviour, two nodes are provided in the .xml file
PasswordPath: The value of this node specifies a relative or absolute path describing where to locate/create the file
password.txt. If the value is a relative path it is taken with respect to the problem type path.
Example:
<PasswordPath>..</PasswordPath>
ValidatePassword: The value of this node is a Tcl script which will be executed when a password for this problem type
needs to be validated. The script receives the parameters for validation in the following variables:
key with the contents of the password typed,
dir with the path of the problem type, and
computer_name with the name of host machine.
Note: It's like this Tcl procedure prototype: proc PasswordPath { key dir computer_name } { ... body... }
4 PROBLEMTYPE SYSTEM
A problem type is a collection of utilities, which allows the user to interact easily with them by means of a Graphical User
Interface (GUI), and facilitates the definition and introduction of all the data necessary for carrying out a particular
calculation. In order for GiD to prepare data for a specific analysis program, it is necessary to customize it. The
customization is defined in GiD by means of a problem type.
The new system of problem types creation adds some additional capabilities compared with the classic one:
It takes advantage of the XML (Extensible Markup Language) format features and its hierarchical structure. It stores
data more efficiently. The elements in a XML document form a tree-structure that starts at �the root� and branches
to �the leaves� with different relationships between the nested elements.
It permits to process automatically XML documents on a physical data tree view on the GiD window for interfaces
creation.
It facilitates the automatic creation of standard windows in the data tree to enter input dates. It couples geometry or
mesh entities with identical properties into the called groups using these standard windows.
It permits to couple entities with identical properties into groups. In this way, it couples geometry or mesh entities with
identical properties into the called groups using these standard windows.
It allows to apply efficiently geometry properties and boundary conditions (i.e. constraints, loads, materials…) into
groups and to edit their properties easily..
In order to configure GiD for a specific type of analysis, it is possible to set the data tree hiding the required parts
automatically.
It allows to fix the data tree hiding concrete parts if this is convenient, for a specific type of analysis.
It couples all the common features of the different problem types.
The problem type is defined using a directory with the its name and a set of files. The directory with the problem type will
be located in the problemtypes directory in the GiD distribution, or in a subdirectory of it.
Note: now it is also possible to have a /problemtypes extra folder located at the <GiD user preferences folder>. This is
interesting in case that the user doesn't has privileges to copy a problemtype inside <GiD folder>/problemtypes
This set of files define the problemtype and contain the full functionality for customizing the pre-process. The main files
that configure the problem type are shown in the table below.
Conditions file
File with extension .cnd is used but should not be modified by the problemtype creator.
4.2 Definitions
CustomLib defines its own XML tags, which clearly describes its content. For more information about this attribute, see the
section Data tree fields -pag. 8-.
TDOM library
The tDOM library is used by the Toolkit due to it combines high performance XML data processing with easy and
powerful Tcl scripting functionality. tDOM is one of the fastest ways to manipulate XML and it uses very little memory
in the process of creating a DOM tree from a XML document. In TDOM terminology we call 'field' to the 'Element name'
and 'parameter' to the 'attribute'. All data is stored in fields and parameters, where the parameters can contain a
value, a xpath expression or a [TCL command].
XPATH
XPath is a language for addressing parts of an XML document using path notations.
It is used for navigating through the hierarchical structure of a XML document to extract information. It is based on a
tree of nodes representing the XML file.
It provides the ability to navigate around the tree, selecting nodes from it and computing string-values.
xpath expression -> A search is performed and the result is substituted in the parameter when necessary.
[TCL command] -> The command between brackets is executed when necessary and the return value is replaced
inside the parameter.
The fields and parameters of the main configuration file (.spd) of the data tree, are described below.
4.3.1 PT_data
<PT_data>
Main root field of the .spd file. It contains the version number and the name of the problem type.
PT must be replaced by the problem type name.
version - Internal version number.
<cmas2d_customlib_data version='1.0'>
...
</cmas2d_customlib_data>
4.3.1.1 container
<container>
This is the simplest form to group the data for improving its visualization.
On the resulting window, in addition to the inputs there will be the following set of buttons:
It can contain the following fields: <value>, <container>, <condition>, <function>, <dependencies>
The parameters are as follows,
n - Name used to reference the field, especially when writing the .dat file.
container 9
Example:
<container n='general_data' pn='General data' icon='general'>
<value n='max_iterations' pn='Maximum iterations' value='1e3' help='limit of iterations for iterative
solver'/>
<value n='stop_tolerance' pn='Stop tolerance' value='1e-8'/>
</container>
4.3.1.2 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
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_tree - Permits to define a TCL function, by means of square brackets, and returns a combobox with a list of
strings.
values - Comma-separated list of strings.
For instance, values="mech,therm"
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.
condition 11
4.3.1.3 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)
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.
Example:
<condition n="Point_Weight" pn="Point Weight" icon="constraints" groups_icon="groups-16">
...
</condition>
4.3.1.3.1 symbol
<symbol>
Every condition can have a symbol, that will be drawn when the user selects Draw symbols in the contextual menu that
appears on user interactions such as right-mouse click operation.
The symbol is defined by a field <symbol> inside the condition. The available XML parameters are:
proc: Includes the name of a TCL proc to be defined in the TCL files of the problemtypes. In that proc, OpenGL is used
to make the real drawing.
The procedure must return the id of a OpenGL drawing list (created by GiD_OpenGL draw -genlists 1), or a dict with
some required keys depending on the orientation attribute value.
The proc is invoked adding automatically an extra argument: valuesList with a list of key value of the condition values
stored in the tree.
symbol 12
orientation: can be global, local, localLA, free or have some special values section, shell_thickness, loads to
invoke internally predefined drawings.
global means that the symbol defined in the proc will be draw with its axes corresponding to that of the global
axes of the model.
local means that the symbol will be drawn related to a local axes system dependent on the entity.
For lines, this local axes system will have x' axe parallel to the line. For surfaces, the z' axe will be parallel to the
surface normal
(for lines some extra correction of the local axes could be applied)
localLA is similar to local, in this case is compulsory attach local axis to entities, implicit automatic local axis of
lines and surfaces are not used (and without the extra correction in case of lines)
section used for lines to draw bar section profiles in its local axes. (some extra correction of the local axes could
be applied)
In this case the proc must return a dict Tcl object with keys named:
obj the integer representing the opengl list to be drawn.
shell_thickness to draw the surface with a thickness.
In this case the proc must return a dict Tcl object with keys named:
thickness with the value of the thickness associated to the surface.
cdg_pos (optional) with the list of the 3 components of the center position
loads to represent loads.
In this case the proc must return a dict Tcl object with keys named:
load_type with possible values global, global projected, local
load_vector with a list of 3 components of the vector
e.g. return [dict create load_type $load_type load_vector $load_vector]
free is another special value, in this case the Tcl procedure will be called once by entity with the condition to be
draw, instead of only once by group.
The proc is invoked adding automatically some extra arguments: valuesList geom_mesh ov num pnts points ent_type
center scale
this allow to know the information of the entity.
geom_mesh: GEOMETRYUSE or MESHUSE
ov: point line surface volume node element
num: <entity id>
pnts: in case of lines integer?, in case of surfaces its boundary lines and orientations <{line_1 SAME1ST|DIFF1ST}
... line_n SAME1ST|DIFF1ST}>
points: in case of lines <{x1 y1 z1} {x2 y2 z2}> start and end coordinates, in case of lines the boundary point
coordinates
ent_type: STLINE, ...
center: <x y z>
scale: <scale_to_draw>
The local axes are defined by a special 'classical condition' (point_Local_axes, line_Local_axes, ...) assigned to the entities,
or if there is not assigned this 'local axis' then the implicit local axis for lines and surfaces is used (based in its tangent and
normal respectively)
Note: The package gid_draw_opengl also contains some predefined interesting procedures, and some .msh files with
common symbols to be used by gid_groups_conds::import_gid_mesh_as_openGL
Example:
<condition n="Point_Weight" pn="Point Weight" ov="point" ovm="node" icon="constraints"
help="Concentrated mass">
<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 darkorange-weight-18.png" orientation="global"/>
</condition>
Example:
<condition n="Point_Weight" pn="Point Weight" ov="point" ovm="node" icon="constraints"
help="Concentrated mass">
<value n="Weight" pn="Weight" v="0.0" unit_magnitude="M" units="kg" help="Specify the weight that you
want to apply"/>
<symbol proc="Cmas2d::DrawSymbolWeight" orientation="global"/>
</condition>
And its Tcl drawing procedure, assuming that the mesh file named weight_2d.msh is located in the symbols folder or the
problemtype:
4.3.1.4 blockdata
<blockdata>
Represents a set of properties with some kind of relationship. A 'blockdata' field can copy itself, to duplicate and create
several sets. It can contain the following fields: <value>, <container>, <condition>, <function>, <dependencies>, and
other <blockdata>
n - Name used to reference the field, especially when writing the .dat file.
name - Label that will be visualized by the user. It can be translated.
sequence - It allows a 'blockdata' field to by duplicated and copied by the user in order to create several sets. Like several
load cases with its 'value' and 'condition' included. If it has the 'sequence' parameter activated, it is possible for the user to
create consecutive repetitions of the full block data in order to represent, for example, loadcases with all its conditions
inside.
sequence_type - It can be:
any - The list can be void (this is the default)
non_void_disabled - At least there needs to be one element. It can be disabled.
non_void_deactivated - At least there needs to be one element. It can be deactivated.
editable_name - can be void '' or 'unique'. The 'unique' means that it is not possible to use the same name ('pn' field), for
two different 'sequence' 'blockdata'.
morebutton - It is a boolean value as a 1 or 0 to show a 'More...' button in fields of type 'blockdata'. It is activated by
default. For more information about this attribute, see the section Import export materials
function 16
4.3.1.10.1 functionVariable
<functionVariable>
It allows to define the default values of a function defined by xy points. 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.
variable - Name of the variable shown in the GUI.
units - Its value is the default unit shown in the GUI, which could be changed, if desired.
Example:
<value n="dens" pn="Density" min_two_pnts="1" help="Density of Steel" unit_magnitude="M/L^3"
units="kg/m^3" function="[density_function]" function_func="" v="1.0">
<function>
<functionVariable n="interpolator_func" pn="Interpolation function" variable="x" units="°C">
<value n="point" pn="Point" v="20.0,7830.0"/>
<value n="point" pn="Point" v="600.0,7644.0"/>
</functionVariable>
</function>
</value>
<procs>
<proc n='density_function' args='args'>
<![CDATA[
MyDensityFunction $domNode $args
]]>
</proc>
</procs>
In this example the proc density_function referenced by the 'function' attribute is implemented in the xml .spd file but it is
very simple and only invokes another procedure named MyDensityFunction adding some arguments. The body of the tcl
procedure could be implemented separatelly in a .tcl file (sourced in the problemtype), this facilitate its edition and debug.
The proc referenced by the 'function' must return as value something like this:
scalar,interpolator_func x x Temp
and pressing the rigth button will open a window to edit the xy graph:
functionVariable 17
The following section is of purely practical nature. It contains examples of the most common functions from the areas
CustomLib deals with.
An example of the <value/> node field in the .spd file is the following:
Notice that both <function/> and <functionVariable/> nodes are required to define an interpolation function.
Annex I: Using functions 18
Note: The nodes of type <value n="point"/> can be omitted to start with an empty table of input data points.
Function dialog box allows to enter pairs of input data points that approximate a function
Example no. 2: Using functions based on Interpolated Data, methods for entering data
It is possible to select automatically the method for entering data (Single value, Linear ramp or Equation). For functions of
one variable, you can select between the following interpolation methods by default:
Single value: The linear interpolation uses two or more pairs of input data points that approximate a function.
Linear ramp: Calculates two or more 'Linear ramp' pairs of input data points that approximate a function.
Equation: Calculates two or more pairs of input data points that satisfy a given equation.
Use the function dialog box, which can be opened from the data tree clicking on the button Σ as follows,
Annex I: Using functions 19
Function dialog box allows to calculate input data points that satisfy a given equation.
Function dialog box allows to calculate input data points that satisfy a sinusoidal load equation.
<value n="Factor" pn="Factor" v="1.0" help="This factor, that can be a number or a formula, multiplies the vector load"
function="[loads_function Punctual_Load]" function_func="CompassFEM::function_loads"/>
Annex I: Using functions 22
Example no. 4: Create your own custom editor window for entering mathematical expressions
The user can create any number of custom windows in the user interface. A child window is opened automatically to display
information to the user and/or get information from the user. This is a great way to add custom windows for your own
purposes.
The Function Editor window can be opened by locating in the data tree the field to modify, and choosing the edit button
(e.g. Σ).
This will open the Function Editor window and load the current expression into it, which can be empty.
CustomLib also allows to enter square matrices of order n automatically. The Matrix Editor window is opened by locating in
the data tree the field to modify, and choosing the edit button (e.g. [x]) as follows,
This will open the Matrix Editor window and load the current expression into it, which can be empty.
This document shows an example about the access to the data stored in the customlib tree. We are using the
cmas2d_customlib tree as example.
The customlib tree is stored in a xml document. To manage an xml object, we use the tdom functions, available in
https://docs.activestate.com/activetcl/8.6/tcl/tdom
Tree example
To get the value of the weight applied to the group Point Weight Auto1, we need to define the xpath to the value, and ask
it to the document.
In the table below we have listed some path expressions and the result of the expressions:
//book/title | //book/price Selects all the title AND price elements of all book
elements
//title | //price Selects all the title AND price elements in the document
/bookstore/book/title | //price Selects all the title elements of the book element of the
bookstore element AND all the price elements in the
document
XPath Operators
Below is a list of the operators that can be used in XPath expressions:
4.6 Units
A unit of measurement is a definite magnitude of a physical quantity, defined and adopted by convention or by law, that is
used as a standard for measurement of the same physical quantity. Any other value of the physical quantity can be
expressed as a simple multiple of the unit of measurement. For example, length is a physical quantity, and metre is a unit
of length that represents a definite predetermined length.
The node <units> in the *.spd file can be used to change some defaults or to add specialized units, which in principle are
not supported. The structure and contents of this subtree <units> requires to have the format as further detailed in this
document. The following attributes are available:
p - Priority of the unit, it is regarded as more important than others units. The possible values for 'p' are 1, 2 and 3, as
follows,
Units 30
1 - It gives maximum priority, and therefore a unit with p="1" is the default unit in the GUI.
2 - A unit with p="2" is always shown in the combobox of below to facilitate the selection of the most used units.
3 - It gives lowest priority, and therefore a unit with p="3" could only be chosen when clicking on 'More units...' option
in the combobox of below, which enables the user to choose the unit from a table.
factor - The conversion factor used to multiply a quantity when converting from one system of units to another. It is
the mathematical tool for converting between units of measurement [1 unit=factor*unit(SI)]. Example: 1mm=10e-3
m.
help - To make easier to the user to identify the unit.
Example of <units> field: Species concentration and reference variable are not supported and therefore, both magnitudes
are defined in the *.spd file, as follows,
<units>
<unit_magnitude n="Reference_variable_unit" pn="Reference variable unit" default="U" SI_base="U"
active="1">
<unit n="U" pn="ReferenceUnit" p="2" factor="1.0"/>
<unit n="ppm" pn="parts-per-million" p="2" factor="1.0e-6" help="parts-per-million"/>
<unit n="ppb" pn="parts-per-billion" p="2" factor="1.0e-9" help="parts-per-billion"/>
<unit n="%" pn="per-one-hundred" p="2" factor="0.01" help="per-one-hundred"/>
<unit n="%0" pn="per-one-thousand" p="2" factor="0.001" help="per-one-thousand"/>
<unit n="Np" pn="Nepper" p="2" factor="1.0" help="Nepper"/>
</unit_magnitude>
<unit_magnitude n="Species_concentration" pn="Species concentration" default="C" SI_base="C"
active="1">
<unit n="C" pn="ReferenceUnit" p="2" factor="1"/>
<unit n="ppm" pn="parts-per-million" p="2" factor="1.0e-6" help="parts-per-million"/>
<unit n="ppb" pn="parts-per-billion" p="2" factor="1.0e-9" help="parts-per-billion"/>
<unit n="%" pn="per-one-hundred" p="2" factor="0.01" help="per-one-hundred"/>
<unit n="%0" pn="per-one-thousand" p="2" factor="0.001" help="per-one-thousand"/>
<unit n="mol" pn="mole" p="2" factor="1.0"/>
</unit_magnitude>
</units>
The field used to choose the mesh unit is also special. It has the attribute unit_mesh_definition="1", and it does not
contain any "v" attribute or dependencies.
The fields used to choose the default units in the GUI are also 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.
Here's an example of node type "container" in the .spd file, which allows to choose the geometry units and the general
units, as follows,
Unit system n
Int. system (SI) SI
Imperial system imperial
The fields of type <unit> can contain the attribute called units_system, as follows,
units_system - There are two systems used to define units, the possible values are:
SI - International system
imperial - Imperial system
The attributes involved in any field of the .spd file are 'unit_magnitude' and 'units'.
unit_magnitude: Its value relates to the name 'n' used to reference the unit field. Please see the table below for a
complete list of all the names available.
units: Its value is the default unit shown in the GUI, which could be changed, if desired.
Some functions are useful for writing data with units defined into the calculation file. For more information about this issue,
see the section called Writing the input file for calculation -pag. 39-.
Example:
The table below gives a summary of the names used for all units available.
pn n Unit by defa
ult
Length L m
Mass M kg
Time T s
Temperature Temp K
Frequency Frequency Hz
Force F N
Pressure P Pa
Energy Energy J
Power Power W
Angle Angle rad
Solid_angle Solid_angle sr
Velocity Velocity m/s
Acceleration Acceleration m/s^2
Area Area m^2
Volume Volume m^3
Density Density kg/m^3
Electric current Electric_current A
Amount of substance Amount_of_substance mol
Luminous intensity Luminous_intensity cd
Electric charge Electric_charge C
Electric potential Electric_potential V
Capacitance Capacitance F
Electric resistance Electric_resistance ?
Electric conductance Electric_conductance S
Magnetic flux Magnetic_flux Wb
Magnetic flux density Magnetic_flux_density T
Inductance Inductance H
Delta phi DeltaPhi Δφ
Delta temperature DeltaTemp ΔK
Luminous flux Luminous_flux lm
Illuminance Illuminance lx
KinematicViscosity KinematicViscosity m^2/s
Viscosity Viscosity Pa*s
Permeability Permeability m^2
The magnitudes available to be used with the problem type in XML format are also listed below.
To change the priority 'p' for a given unit, it is necessary to add a field of type 'unit_magnitude' in the node <units/> of the
.spd file, together with the values of the priorities, for each 'unit ' considered. Here is shown an example of <units/> node
in the .spd file, where kN and MPa will be the units by default for the force and pressure respectively:
Units 33
<units>
<unit_magnitude n="F" pn="Force" default="N" SI_base="N" active="kN">
<unit n="kN" pn="kilonewton" p="1" units_system="SI"/>
</unit_magnitude>
<unit_magnitude n="P" pn="Pressure" default="Pa" SI_base="Pa" active="MPa">
<unit n="MPa" pn="megapascal" p="1" units_system="SI"/>
</unit_magnitude>
</units>
The default magnitudes and conversion factors could be seen at the file scripts\customLib\customLib\units.xml
gid_groups_conds::actualize_conditions_window
This procedure updates the information of the whole data tree, and automatically refresh data shown in the user
interface. 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. Note that this instruction must be carried out only when
necessary. It has no arguments.
gid_groups_conds::SetProgramName program_name
This procedure stores the program name in the preferences file and should be defined in the InitGIDProject procedure.
The argument is the following:
program_name - Name of the program.
gid_groups_conds::end_problemtype defaults_file
This procedure will be called when the project is about to be closed, in the EndGIDProject procedure. It receives as
argument:
defaults_file - The directory of the preferences file. If the directory of the preferences file does not already exist, it
is created.
gid_groups_conds::give_data_version
This function returns the version number of the problem type.
gid_groups_conds::save_spd_file spd_file
This procedure saves the .spd file and should be defined in the SaveGIDProject procedure. Therefore, it will be called
when the currently opened file is saved to disk. It receives as argument:
spd_file: path of the file being saved
Local coordinates systems of lines are defined such that the local x-axis will correspond to the axial direction of the line.
Both other axes will be defined perpendicular to this local x-axis.
Local coordinate systems of surfaces are defined such that the local z-axis is defined perpendicular to the surface and both
Description of the local axes 34
x- and y- axes are defined perpendicular to each other in the plane of the surface.
Local coordinates can be defined by selecting the option called Assign Automatic in the Local axes window. Selecting the
option Assign Automatic alt will define alternative local coordinate systems which are normally rotated 90 degrees around
the third axis compared to the first ones.
The procedure gid_groups_conds::local_axes_window creates the Local axes window automatically, which allows to define
the local axes to be used.
It should be emphasized that it is possible to list the local axes clicking on the 'List' button. This way a childwindow displays
both the Euler angles and the transformation matrix.
Generic local axes window allows to create new local axes in two ways:
Three points XZ: Enter three points that corresponds to the origin, the X-direction and the Z-direction. The origin and
the last introduced point defines the Z-axis, whereas the second point indicates the side of the x-z plane where the
point lies.
X and angle: Enter two points and one angle. The first point is the center, the second point indicates the x-axis and the
angle indicates the position of the Y and Z axes. In the graphical window it is possible to set this angle by moving the
mouse on the screen. It also indicates where the origin of the angle is. The angle can be entered either by clicking the
mouse or by entering the exact value in degrees.
User can create different named local axes systems and with the different methods that can be chosen there. The names of
the defined local axes will be added to the menu, where local axes are chosen.
The 'ipos' is the index where the new menu will be inserted.
For more details about managing menus reference is made to the 'Managing menus' chapter in the Gid manual.
It is important to note that all user-defined systems are automatically calculated in the problem type. After generation of
the mesh, the local coordinates of entities will be automatically defined at each entity element of the entities local
coordinates have been defined on.
-Default. The program assigns a different local axes system to every line with the following criteria:
X� axe has the direction of the line. If X� axe has the same direction than global Z axe, Y� axe has the same direction
than global X. If not, Y� axe is calculated so as to be horizontal (orthogonal to X� and Z). Z� axe is the cross product of
X� axe and Y� axe. It will try to point to the same sense than global Z (dot product of Z and Z� axes will be positive or
zero).The intuitive idea is that vertical lines have the Y� axe in the direction of global X. All the other lines have the Y�
axe horizontal and with the Z� axe pointing up.
-Automatic: Similar to the previous one but the local axes system is assigned automatically to the line by GiD. The final
orientation can be checked with the Draw Local Axes option in the GiD Conditions window.
-Automatic alt: Similar to the previous one but an alternative proposal of local axes is given. Typically, user should assign
Automatic local axes and check them, after assigning, with the Draw local axes option. If a different local axes system is
desired, normally rotated 90 degrees from the first one, then it is only necessary to assign again the same condition to the
entities with the Automatic alt option selected.
-Default: The program assigns a different local axes system to the surface with the following criteria:
Be N the unitary normal of the surface element, and U the vector (0,1,0) and V the vector (0,0,1). Then:
Z� axe has the direction and sense of N.
If Nx<1/64 and Ny<1/64, then X� axe will be in the direction of the cross product of U and N (UxN).
If not, X� axe will be in the direction of the cross product of V and N (VxN).
Y� axe will be the cross product of Z� axe and X� axe.
Intuitively, this local axes system is calculated so as if element is approximately contained in the plane XY, local X� axe
will point towards global X axe. If not, this X� axe is obtained as orthogonal to global Z axe and local Z� axe.
-Automatic: Similar to the previous one but the local axes system is assigned automatically to the surace. The final
orientation can be checked with the Draw Local Axes option in the GiD Conditions window.
-Automatic alt: Similar to the previous one but an alternative proposal of local axes is given. Typically, user should assign
Automatic local axes and check them, after assigning, with the Draw local axes option. If a different local axes system is
desired, normally rotated 90 degrees from the first one, then it is only necessary to assign again the same condition to the
entities with the Automatic alt option selected.
Example no. 1
This is an example of the <container/> node field in the .spd file to call the Local axes window from the data tree:
Example no. 2
Here is an example of application for opening the Local axes window from a conditions window, as follows:
The local_axes attribute specifies one of the three states for the button: normal, disabled or hidden.
Example no. 3
This is an example of Local axes check button definition inside a window of the data tree. If the check button is activated,
Description of the local axes 37
then the Local axes window can be opened pressing the button at the right:
Example no. 4
Here is an example of Local axes definition, inside for instance, a conditions window of the data tree.
The non-editable combobox In the combobox options The <condition/> node field in the .spd file could be the following:
Example no. 5
The following is an example for creating a specific window for assigning local axes on surfaces in the data tree. The user
selects a group of lines and axe X' will be tangent to the lines:
The item 'Local axes definition' in the data tree opens the following window:
Future developments
In the future it will be available a new Local axes window, totally integrated in the data tree, that will allow to define
groups composed by local axes.
Description of the local axes 38
Note: If swap axes check button is selected, axes X' and Y' are swapped.
Tangent lines: User selects a group of lines and axe X' will be tangent to these lines:
New Local axes window for creating local axes groups. It will be
integrated in the data tree.
User defined: User defines the three local axes X', Y' and Z':
The command called GiD_WriteCalculationFile facilitate the creation of the output calculation file.
Note: This command is provided to allow efficiency and relative flexibility writing the mesh and tree data related to groups,
traversing the data structures without the cost of create a serialized copy in memory.
It is not compulsory to use this command, it is possible, and sometimes necesary, to use other Tcl commands to get mesh,
groups and other data and reorder the information in order to be written.
GiD_WriteCalculationFile init|end|puts|coordinates|all_connectivities|connectivities|nodes|elements|has_ele
ments?-elemtype <etype>? ?-localaxes <formatLADict> ""? ?-elements_faces all|elements|faces?
?-number_ranges <NRDict>? ?-unique? ?-multiple? ?-all_entities? ?-do_subst? ?-sorted? ?-count? ?-return?
?-print_faces_conecs ? -connec_ordering? corner_face_corner_face <groupsDict>
It returns an file identifier that could be used with with 'GiD_File fprintf', but must not be used with Tcl standard print
commands like 'puts' or 'write'
Example:
set file_id [GiD_WriteCalculationFile init -mode append {c:/temp/my output.dat}]
lassign {1.5 2.3} x y
GiD_File fprintf $file_id "x=%15.5f y=%15.5f" $x $y
GiD_WriteCalculationFile end
To close the calculation file
Example:
GiD_WriteCalculationFile end
Example:
GiD_WriteCalculationFile puts "hello world"
Example:
set num_coordinates [GiD_WriteCalculationFile coordinates -count ""] ;#with -count the format
doesn't matter, "" could be used
GiD_WriteCalculationFile puts "num coordinates: $num_coordinates"
Example:
GiD_WriteCalculationFile all_connectivities -elemtype Triangle "id: %d connectivities: %d %d %d"
To get entities information related to groups: connectivities, nodes, elements of the group names specified in the
<groupsDict> dictionary
If -count is specified then only the number of entities is returned, without print.
If -return is specified then the complete string is returned, without print.
<groupsDict> is a dictionary (list of pairs key value), with key=group_name and value=format
if key is "" then is considered like a wildcard and match all entities that are not matched by other keys.
Example: to print the id and connectivities of the triangle elements of the groups named $group_a or $group_b
set format_by_group [dict create $group_a "A: %d - %d %d %d" $group_b "B: %d - %d %d %d"]
GiD_WriteCalculationFile connectivities -elemtype Triangle $format_by_group
Example: to print the node id of the nodes belonging to $group_name and a text with the group name
set format_by_group [dict create $group_name "%d of group $group_name"]
GiD_WriteCalculationFile nodes $format_by_group
or as a trick to avoid printing the z coordinate could use "%.0s" to jump this extra argument
set format_by_group [dict create $group_name "%d of group $group_name with coordinates %g %g %.0s"]
GiD_WriteCalculationFile nodes $format_by_group
Example: to print the faces of tetrahedra belonging to $group_name, printing its 3 face node ids (the %.0s is to not
pring the tetrahedra id)
GiD_WriteCalculationFile elements -elemtype Tetrahedra -elements_faces faces -print_faces_conecs
[dict create $group_name "%.0snode ids: %d %d %d "]
Example: to print the faces of tetrahedra belonging to $group_name, printing the tetrahedra id and the local face index
(0 to 4)
GiD_WriteCalculationFile elements -elemtype Tetrahedra -elements_faces faces [dict create
$group_name "element id:%d face index:%d "]
gid_groups_conds::give_mesh_unit
This function provides the mesh unit.
gid_groups_conds::set_mesh_unit unit
This function imposes a mesh unit, where the argument is as follows:
unit - A text string, denoting the unit that you want to apply as mesh unit.
gid_groups_conds::convert_value_to_active nodeObject
This function converts the value of a nodeObject from the current unit type to the general active unit selected in the
GUI. The argument is as follows:
nodeObject - DOM node object chosen.
to_unit - A text string, denoting the unit that you want to convert the original number to.
gid_groups_conds::convert_value_to_printable_unit nodeObject
This function returns a text string, denoting the current unit of the node. It receives as argument:
nodeObject - DOM node object chosen.
gid_groups_conds::give_active_units_system
This function returns a string list, where the first item is the units system.
gid_groups_conds::give_active_unit magnitude
This function returns the active unit for a given magnitude. It receives as argument:
magnitude - Unit definition, it is the name 'n' of the physical quantity (eg. "L" for Length)
This functions are based on the implementation of a problemtype for the Frame3DD solver, but can be useful to anyone.
Basic and advanced tcl commands for writing the input file - example
How to write a string.
See how we print the units, we are asking gid for the current active units for the different magnitudes: F for Force, L
for Lenght, M for Mass
customlib::WriteString ""
customlib::WriteString "[GiD_Info Mesh NumNodes] # number of nodes"
customlib::WriteString "#.node x y z r"
customlib::WriteString "# [gid_groups_conds::give_active_unit L] [gid_groups_conds::give_active_uni
tL] [gid_groups_conds::give_active_unit L] [gid_groups_conds::give_active_unit L]"
customlib::WriteString ""
customlib::WriteCoordinates "%5d %14.5e %14.5e %14.5e 0.0 "
Contraints
This is the way we get the number of nodes assigned to a condition called 'constraints' in the spd.
Basic data
Cheatsheet of writing functions 43
This is the way we access to the data in the tree. Notice that we are building what we call xpath, that is a kind of path
in the spd, from the root to the item we want.
Then we get the xml node from the document using selectNodes, and finaly we get the current value with
get_domnode_attribute.
User preferences of the problemtype will be automatically saved/read to/from disk in a xml file named
.$problem_type$version.ini, located in the same user folder as the GiD preferences.
Example: get or set a user variable named 'verbosity_level', with default value=0
Parameter called allow_import in fields of type <blockdata>allows to add the 'Import/export materials' item in the
contextual menu for a specific 'blockdata' field.
A material is composed by a set of material properties, which can be applied to geometry entities. Import/export tool
allows to handle material properties easily. This tool is located inside the right mouse menu when a particular material or a
materials collection is selected in the data tree and allow_import parameter is activated.
In order to activate the Import/export materials tool, it is necessary to call n="materials" to the global container in the
spd-file. Moreover, although the intermediate containers could be defined using any attribute n, each final material
blockdata has to be called n="material".
The "Import/export materials" window contains two different material data trees. At the left side there is the local
materials list associated to the current model. At the right side there is a material data tree list, which could be
imported or exported depending on the user interests.
It is possible to import/export materials in four different ways:
Global database active
Global database inactive
Import from a file
Export to a file.
The global database active is the database shown in the data tree located at the left side of the GiD window when a
new model is created.
The global database inactive is an internal database which does not affect the default data tree for new models. It
could be used to store odd materials in order to import them for a particular model.
The global database active also allows to import the original default materials clicking on the button located just at the
right side of the "Import/export to" combo-box, which facilitates to recover easily the original input data for materials.
It is also possible to import or export selected materials from particular XML-files without modifying the global
database.
It should be noted that the creation of new materials can be done directly using the right mouse menu in the
import/export materials window.
Cimne's copyrighted CustomLib is developed between CIMNE and Compass Ingenieria y Sistemas, and it is the library
included in GiD for creating advanced customized problemtypes, i.e. adaptations to third-party simulation codes or external
programs. CustomLib terms of use are the same as the GiD ones.
Compass offers the possibility of implementing advanced customizations of GiD, based on customLib, adapted to the
specific need of every specific client. For more information about this service, please visit www.compassis.com.
About CustomLib 45
Compass Ingenieria y
Sistemas
http://www.compassis.com
info@compassis.com
For using this extra functionality, just activate the CustomLibAutomatic field in the XML file -pag. 5- or load it manually by
requiring the package customlib_extras
4.13.1 SPD_fields
4.13.1.1 include
All attributes will be transfered to the included node, except "n" "active" and "path"
Example:
<include path="xml/materials.xml"/>
The main procedures available to be used in the TCL files, are listed below. All the usages and examples can be found on
the 'cmas2d_customlib' problemtype.
customlib::ProcessIncludes directory
This procedure parses the active include nodes of the spd file, and replaces them for the node found in the path files.
customlib::InitWriteFile filename
Open the file for writting
customlib::EndWriteFile
customlib::InitMaterials list_of_condition_names
The list_of_condition_names is the list of these conditions were we can find a material, so we can consider it as
'used', asigning it a MID (Material Identifier) for further queries.
customlib::WriteString str
Writes the content of str in the opened file
Example:
set list_of_condition_names [list "Shells"]
set parameters [list {"%10d" "element" "id"} {"%10d" "element" "connectivities"} {"%10d" "material"
"MID"} ]
customlib::WriteConnectivities $list_of_condition_names $parameters
Example:
set list_of_condition_names [list "Point_Weight"]
set parameters [list {"%1d" "element" "id"} {"%13.5e" "property" "Weight"}]
customlib::WriteNodes $list_of_condition_names $parameters
# Output
1 7.80000e+000
83 9.60000e+000
108 7.80000e+000
customlib::WriteCoordinates formats
Writes the coordinates of the nodes of the model.
2D example:
customlib::WriteCoordinates "%5d %14.5e %14.5e%.0s "
# Output:
1 6.89301E-002 8.61382E-003
2 7.49755E-002 1.26044E-002
3 7.44487E-002 3.68638E-003
3D example:
customlib::WriteCoordinates "%5d %14.5e %14.5e %14.5e "
# Output:
1 6.89301E-002 8.61382E-003 8.61382E-003
2 7.49755E-002 1.26044E-002 1.26044E-002
3 7.44487E-002 3.68638E-003 3.68638E-003
customlib::GetMaterials ?state?
This procedure returns a nested dict, where the first key is the name of a material, the second key is the name of the
property.
state can be 'used', to return only the used materials, or 'all' to return all the materials.
Example:
set mat_dict [customlib::GetMaterials used]
set aluminium [dict get $mat_dict "Aluminium"]
set density [dict get $aluminium "Density"]
customlib::GetMaterials ?state?
This procedure returns a nested dict, where the first key is the name of a material, the second key is the name of the
property.
state can be 'used', to return only the used materials, or 'all' to return all the materials.
Extra functions 47
Example:
set mat_dict [customlib::GetMaterials used]
set aluminium [dict get $mat_dict "Aluminium"]
set density [dict get $aluminium "Density"]
customlib::GetNumberOfMaterials ?state?
state can be 'all' or 'used'.
Returns the number of materials in the database. If state is used, it returns the number of materials used in the model.
# Output:
1 7.85000e+003
2 2.65000e+003
4.14 Wizards
GiD includes a modified version of the tcl package snitwiz by Steve Casssidy. The package is called gid_wizard, and can
be found inside the scripts folder.
It is useful to create a step guieded GUI for your problemtype or plugin. It provides a window, with a header, a body, and a
footer with back, next, cancel and finish buttons, that you can configure.
You can find a basic usage example in the package folder -> GiD > scripts > gid_wizard > test.tcl
We also provide another package to make the implementation easier, called gid_smart_wizard, which allows you to
define your wizard steps in a xml file.
To do so, it is necessary to create the file problem_type_name.bat in the Problem Type directory. This must be a shell
script that can contain any type of information and that will be different for every operating system. When you select the
Calculate option in GiD Preprocess this shell script is executed (see CALCULATE from Reference Manual).
Because the .bat file will be different depending on the operating system, it is possible to create two files: one for Windows
and another for Unix/Linux. The Windows file has to be called: problem_type_name.win.bat; the Unix/Linux file has to be
called: problem_type_name.unix.bat.
If GiD finds a .win.bat or .unix.bat file, the file problem_type_name.bat will be ignored.
If a .bat file exists in the problem type directory when choosing Start in the calculations window, GiD will automatically
write the analysis file inside the example directory assigning the name project_name.dat to this file (if there are more
files, the names project_name-1.dat ... are used). Next, this shell script will be executed. GiD will assign three arguments
to this script:
Among other utilities, this script can move or rename files and execute the process until it finishes.
Note 1: This file must have the executable flag set (see the UNIX command chmod +x) in UNIX systems.
Note 2: GiD sets as the current directory the model directory (example: c:\examples\test1.gid) just before executing
the .bat file. Therefore, the lines (cd $directory) are not necessary in the scripts.
Note 3: In UNIX platforms check you have installed the shell you are using in the .unix.bat script, there are more than one
possibilities: bash, csh, tcsh, ...
The first line of the script specify the shell to be used, for example
#!/bin/sh
or
#!/bin/bash
In Windows platforms, the command.exe provided by GiD is used instead the standard cmd.exe or command.com
The information about what is displayed when Output view: is pressed is also given here. To determine what will be shown,
the script must include a comment line in the following form:
For Windows :
rem OutputFile: %1.log
For Linux/Unix:
# OutputFile: "$1.log"
where "$1.log" means to display in that window a file whose name is: project_name.log. The name can also be an absolute
name like output.dat. If this line is omitted, when you press Output view:, nothing will be displayed.
Set
Echo (@echo)
If
Call
Goto
:
Type
Not all the possible parameters and modifiers available in the operating system are implemented in the GiD executable
command.exe.
Note: At the moment, command.exe is only used in Windows operating systems as an alternative to command.com or
cmd.exe. With the GiD command.exe some of the disadvantages of Windows can be avoided (the limited length of
parameters, temporary use of letters of virtual units that sometimes cannot be eliminated, fleeting appearance of the
console window, etc).
If GiD finds the file command.exe located next to gid.exe , it will be used to interpret the *.bat file of the problem type;
if the file command.exe cannot be found, the *.bat file will be interpreted by the windows command.com.
If conflicts appear by the use of some instruction still not implemented in the GiD command.exe , it is possible to rename
the command.exe file, so that GiD does not find it, and the operating system command.com is used.
%
Returns the value of a variable.
%number
%name%
Parameters
number
The number is the position (from 0 to 9) of one of the parameters which the *.bat file receives.
name
The name of an environment variable. That variable has to be declared with the instruction "set".
Note: GiD sends three parameters to the *.bat file: %1, %2, %3
%1 is the name of the current project (project_name)
%2 is the path of the current project (c:\a\b\c\project_name.gid)
%3 is path of the problem type (c:\a\b\c\problem_type_name.gid)
For example, if GiD is installed in c:\gidwin, the "problemtype" name is cmas2d.gid and the project is test.gid, located
in c:\temp (the project is a directory called c:\temp\test.gid with some files inside), parameters will have the following
values:
%1 test
%2 c:\temp\test.gid
%3 c:\gidwin\problemtypes\cmas2d.gid
Note: It is possible that the file and directory names of these parameters are in the short mode Windows format. So,
parameter %3 would be: c:\GIDWIN\PROBLE~\CMAS2D.GID.
Examples
echo %1 > %2\%1.txt
echo %TEMP% >> %1.txt
Shift
The shift command changes the values of parameters %0 to %9 copying each parameter in the previous one. That is to
say, value %1 is copied to %0, value %2 is copied to %1, etc.
Shift
Parameter
None.
Note: The shift command can be used to create a batch program that accepts more than 10 parameters. If it specifies
Commands accepted by the GiD
command.exe 53
Parameters
message Specifies the text that will be displayed in the screen.
Note: The message will not be visible because the console is not visible, since GiD hides it.Therefore, this command is
only useful if the output is redirected to a file (using > or >>). The symbol > sends the text to a new file, and the symbol
>> sends the text to a file if it already exists. The if and echo commands can be used in the same command line.
Examples
Echo %1 > out.txt
Echo %path% >> out.txt
If Not Exist %2\%1.post.res Echo "Program failed" >> %2\%1.err
If
Executes a conditional sentence. If the specified condition is true, the command which follows the condition will be
executed; if the condition is false, the next line is ignored.
Parameters
not Specifies that the command has to be executed only if the condition is false.
exist file Returns true if file exists.
command Is the command that has to be executed if the condition returns true.
string1==string2 Returns true if string1 and string2 are equal. It is possible to compare two strings, or variables (for
example, %1).
errorlevel number Returns true if the last program executed returned a code equal to or bigger than the number specified.
Examples
If exist sphere.igs echo File exists >> out.txt
if not exist test.gid echo Dir does not exist >> out.txt
if %1 == test echo Equal %1 >> out.txt
Call
Executes a new program.
Parameter
[drive:][path] file Specifies the location and the name of the program that has to be executed.
parameters Parameters required by the program executed.
Note: The program can be *.bat file, a *.exe file or a *.com file. If the program does a recursive call, some condition has
to be imposed to avoid an endless curl.
Examples
call test.bat %1
call gid.exe -n -PostResultsToBinary %1.post.res %1.post.bin
Goto
The execution jumps to a line identified by a label.
goto label
Parameter
label It specifies a line of the *.bat file where the execution will continue. That label must exist when the Goto command is
executed. A label is a line of the *.bat file and starts with (:). Goto is often used with the command if, in order to execute
conditional operations. The Goto command can be used with the label :EOF to make the execution jump to the end of the
*.bat file and finish.
Note: The label can have more than eight characters and there cannot be spaces between them. The label name is not
case-sensitive.
Examples 55
5.4 Examples
Here are two examples of easy scripts to do. One of them is for Unix/Linux machines and the other one is for MS-Dos or
Windows.
UNIX/Linux example:
#!/bin/sh
basename = $1
directory = $2
ProblemDirectory = $3
# OutputFile: "$1.log" IT IS USED BY GiD
# ErrorFile: "$1.err" IT IS USED BY GiD
rm -f "$basename.post.res"
"$ProblemDirectory/myprogram" "$basename"
mv "$basename.results" "$basename.post.res"
MS-DOS/Windows example:
rem basename=%1 JUST INFORMATIVE
rem directory=%2 JUST INFORMATIVE
rem ProblemDirectory=%3 JUST INFORMATIVE
rem OutputFile: %1.log IT IS USED BY GiD
rem ErrorFile: %1.err IT IS USED BY GiD
del %1.post.res
%3\myprogram %1
move %1.post %1.post.res
57
There are two versions of the <modelname>.geo GiD format: Binary (used by GiD by default) and ASCII. This chapter
describes the format of the geometry ASCII file.
During the development of the program, the backward compatibility has been tried to be guaranteed as much as possible,
so that, in general, any GiD version is be able to read it (some very old version of GiD can ignore some new entities).
The file "*.geo”, is written using Export->SaveAsciiProject, but by default the geometry will be saved in binary format.
In order to GiD to read the file, it should be placed inside a directory named "*.gid”
Document notation:
By default all the variables are of type integer, the variables of type float will be written underlined, and those of type
double with double underlined. (data types of the "C” language)
A carriage return is denoted for <CR>
The commas written to separate the variables should not be written in the file, they only appear in this document to
facilitate their reading, and the same applies for the white lines.
The file should contain the following fields, and in the described order:
Header
Problem type
Must Repair
An entry for each layer
Null entity (denotes end of layers)
An entry for each meshing data (avoid if not exits)
Null entity (denotes end of mesh data)
An entry for each point
An entry for each curve
An entry for each surface
An entry for each volume
Null entity (denotes end of geometric entities)
Header
RAMSAN-ASCII-gid-v7.6 <CR> (it is used to identify the file type and its version, in this case 7.6)
Problem Type
Problem type (variable of type string) IsQuadratic (0 for lineal elements)
(problem type name, UNKNOWN type for not loading none)
Must Repair
0 (0 if it is not necessary to apply the "Repair” function after the reading, "Repair” corrects the value of some fields like the
counter of the number of higher entities to those an entity is subordinated to)
Layer
Number of layer, Name (variable of type string), isfrozen (0 or 1),ison (0 or 1), RGB_R, RGB_G, RGB_B (RGB color, values
from 0 to 255) <CR>
Null entity
Code of null entity=0<CR> (used as "flag” for end of entities)
NoStructuredMeshData
Entity code= -1, number ID, NumOfEntities (number of entities than point to it), elementtype, MustBeMeshed (0 or 1,
default=0), size (edge element size), <CR>
StructuredMeshData
Entity Code= -2, number ID, NumOfEntities, elementtype, MustBeMeshed, Size, <CR>
StructuredWeightedMeshData
Geometry format: Modelname.geo 59
Coon Surfaces (defined by 4 sides, their interior is interpolated from the contour)
Entity Code=6, number of ID, label, selection, number of higher entities, conditions=0, material=0, number of layer, mesh
data=0,<CR>
Number of boundary lines=4, <CR>
Number of curve[1], ... , number of curve[4], <CR>
(Note: if the curve is part of a polyline it should be substituted "number of curve[i]” for "- number of curve[i], relative
location inside the polyline”, note the negative sign in the polyline number, and the position in the polyline will be 0,1,...)
sense[1], ..., sense[4] <CR> (set the segment orientation, must be 0 or 1)
x center, y center, z center, <CR>
x normal, y normal, z normal, <CR> (vector normal to the plane)
NURBS Surface
Entity Code=14, number of ID, label, selection, number of higher entities, conditions=0, material=0, number of layer,
mesh data=0,<CR >
Number of boundary lines=4, <CR>
Number of curve[1], ... , number of curve[4], <CR>
sense[1], ..., sense[4] <CR> (set the segment orientation, must be 0 or 1)
x center, y center, z center, <CR>
x normal, y normal, z normal, <CR> (vector normal to the plane)
IsTrimmed, NU (number of control points in the U direction), NV, degreeU (polynomial degree), degreeV <CR>
x point[1], y point[1], z point[1], <CR>
...
x point[NU*NV], y point[NU*NV ], z point[NU*NV ], <CR>
knotsU[1], ... , knotsU [NU+degreeU+1], <CR>
knotsV[1], ... , knotsV [NV+degreeV+1], <CR>
IsRational (0 or 1)
Weight[1] ,..., Weight [NU*NV] (only if rational)
Volume
Entity Code=9, number of ID, label, selection, number of higher entities, conditions=0, material=0, number of layer, mesh
data=0 <CR>
Number of boundary surfaces <CR>
Number of surface[1], ... , number of surface[number of surfaces], <CR>
sense[1], ..., sense [number of surfaces],<CR> (segment orientation, 0 or 1)
x center, y center, z center, <CR>
Rules to follow:
There are four level types of geometrical entities: Point, Curves (straight segment, arc, polyline, Nurbs), Surface (planar,
Coon, Nurbs) and Volume.
Geometrical entities of the same type cannot have the same ID number associated (is not valid to have two curves
with same ID)
The numeration begins with 1 (not by 0 like in the "C” style), and it could be jumps in the numeration (e.g. when a
entity is deleted).
The entities of a level are listed with increasing ID.
The center of the entities doesn't refer to the geometric center, it is simply an approximate center where its label will
be drawn.
The higherentities number can be initialized to zero, and it will be corrected automatically if "Must Be repaired” flag
was set to 1. In any case is recommended to set the righ value and avoid the reparation.
The lenght of NURBS curves could be set to zero, current versions ignore this value and recalculate it.
Parametric curves are normalized to parameter space [0.0,1.0]
Parametric curve must have its initial point at parameter 0.0 and end point at parameter 1.0. A closed curve must
share the same start and end point.
Parametric surfaces are normalized to parameter space [0.0,1.0]x[0.0,1.0]
The boundary curves of a surface define a outer loop and some possible inner loops. The outer loop is before outer
loops.
The curves of a loop are ordered consecutivelly. A loop finish when the starting point of the first curve (taking into
account its sense for the surface) is equal to the last point of other curve.
Geometry format: Modelname.geo 60
The ordering and orientation of the boundary curves must agree with the surface normal (Xu^Xv) (right-hand rule).
The outer loop must point to the same sense as the surface normal, and inner loops is any in the opposite sense.
Volumes are defined by a closed shell of surfaces: first surfaces must define the outer shell, and then the inner shells.
The order of surfaces on a 'volume shell' is not relevant, but the orientation must be 0 (SAME1ST) is the surface
The solver program can also send the postprocess mesh to GiD (though this is not mandatory), in the same .post.res,
.post.bin or .post.h5 file or in a separate .post.msh acii file. If this mesh is not provided by the solver program, GiD uses
the preprocess mesh in Postprocess.
Other files with the extensions .msh,.res,.bin,.lst,.h5 can be readed into postprocess but only those with the .post sufix are
automatically read into GiD when entering the post-process model
From now on the explanation will be focused in the ASCII format. The details about the binary and hdf5 format are
explained afterwards in a separated section.
Note:ProjectName.post.msh handles meshes of different element types: points, lines, triangles, quadrilaterals, tetrahedra
and hexahedra.
If a project is loaded into GiD, when changing to GiD Postprocess it will look for ProjectName.post.res. If a mesh
information file with the name ProjectName.post.msh is present, it will also be read, regardless of the information available
from GiD Preprocess.
ProjectName.post.msh: This file should contain nodal coordinates of the mesh and its nodal connectivities as well as
the material of each element. At the moment, only one set of nodal coordinates can be entered. Different kinds of
elements can be used but separated into different sets. If no material is supplied, GiD takes the material number to be
equal to zero.
ProjectName.post.res: This second file must contain the nodal or gaussian variables. GiD lets you define as many
nodal variables as desired, as well as several steps and analysis cases (limited only by the memory of the machine).
The definitions of the Gauss points and the results defined on these points should also be written in this file.
POSTPROCESS DATA FILES 66
The files are created and read in the order that corresponds to the natural way of solving a finite element problem: mesh,
surface definition and conditions and finally, evaluation of the results. The format of the read statements is normally free,
i.e. it is necessary only to separate them by spaces.
Thus, files can be modified with any format, leaving spaces between each field, and the results can also be written with as
many decimal places as desired. Should there be an error, the program warns the user about the type of mistake found.
GiD reads all the information directly from the preprocessing files whenever possible in order to gain efficiency.
Note: Code developers can download the GiDpost tool from the GiD web page (https://www.gidhome.com/gid-plus/tools/4
76/gidpost/); this is a C/C++/Fortran library for creating postprocess files for GiD in both ASCII and compressed binary
format.
The first line of the files with results written in this new postprocess format should be:
Comment lines are allowed and should begin with a '#'. Blank lines are also allowed.
Results files can also be included with the keyword include, for instance:
This is useful, for instance, for sharing several GaussPoints definitions and ResultRangeTable among different analyses.
There are several types of Blocks of information, all of them identified by a keyword:
GaussPoints: Information about gauss points: name, number of gauss points, natural coordinates, etc.;
ResultRangesTable: Information for the result visualization type Contour Ranges: name, range limits and range
names;
Result: Information about a result: name, analysis, analysis/time step, type of result, location, values;
ResultGroup: several results grouped in one block. These results share the same analysis, time step, and location
(nodes or gauss points).
If Gauss points are to be included, they must be defined before the Result which uses them. Each Gauss points block is
defined between the lines GaussPoints and End GaussPoints.
where
Number of Gauss Points: number_gauss_points_per_element: is not case-sensitive and is followed by the number
of gauss points per element that defines this set. If Natural Coordinates: is set to Internal,
number_gauss_points_per_element should be one of:
1, 3, 6 for Triangles;
1, 4, 9 for Quadrilaterals;
1, 4, 10 for Tetrahedra;
1, 8, 27 for Hexahedra;
1, 6 for Prisms;
1, 5 for Pyramids; and
1, ... n points equally spaced over lines.
For triangles and quadrilaterals the order of the gauss points with Internal natural coordinates will be this:
( a, a, a) ( c, a, a) ( a, c, a) ( a, a, c)
( b, b, b) ( a, b, b) ( b, a, b) ( b, b, a) ( b, a, a) ( b, b, a) ( a, b, a)
( a, a, b) ( b, a, b) ( a, b, b)
Internal coordinates:
a=1/6=0.166666666666666
b=4/6=0.666666666666666
c=1/2-1/(2sqrt(3)) =0.211324865405187
d=1/2+1/(2sqrt(3))=0.788675134594812
( a, a, c) ( b, a, c) ( a, b, c)
( a, a, d) ( b, a, d) ( a, b, d)
For pyramids the order of the Internal Gauss Points will be this:
Internal coordinates:
a=8.0*sqrt(2.0/15.0)/ 5.0 =0.584237394672177
b=-2/3 =-0.666666666666666
c=2/5 = 0.4
( -a, -a, b)
( a, -a, b)
( a, a, b)
( -a, a, b)
( 0.0, 0.0, c)
Note: If the natural coordinates used are the internal ones, almost all the Results visualization possibilities will have
some limitations for tetrahedra and hexahedra with more than one gauss points. If the natural coordinates are given,
these limitations are extended to those elements with number_gauss_points_per_element not included in the list
written above.
Nodes Included / Nodes not Included: are not case-sensitive, and are only necessary for gauss points on Line
elements which indicate whether or not the end nodes of the Line element are included in the
number_gauss_points_per_element count.
Gauss Points 70
Natural Coordinates: Internal / Natural Coordinates: Given: are not case-sensitive, and indicate whether the
natural coordinates are calculated internally by GiD, or are given in the following lines. The natural coordinates
should be written for each line and gauss point.
GP_POINT_1
GP_LINE_1
GP_TRIANGLE_1 GP_TRIANGLE_3 GP_TRIANGLE_6
GP_QUADRILATERAL_1 GP_QUADRILATERAL_4 GP_QUADRILATERAL_9
GP_TETRAHEDRA_1 GP_TETRAHEDRA_4 GP_TETRAHEDRA_10
GP_HEXAHEDRA_1 GP_HEXAHEDRA_8 GP_HEXAHEDRA_27
GP_PRISM_1 GP_PRISM_6
GP_PIRAMID_1 GP_PIRAMID_5
GP_SPHERE_1
GP_CIRCLE_1
Is is possible to use also the generic name GP_ELEMENT_1 to mean all kind of elements with 1 gauss point (instead of the
specific element GP_LINE_1, GP_TRIANGLE_1, etc.
A Result Range Table is a customized legends for the Contour Ranges visualization and referenced by the Results. Each
ResultRangesTable consist of a list that associate a string or keyword to a range of result values.
If a Result Range Table is to be included, it must be defined before the Result which uses it.
Each Result Range Table is defined between the lines ResultRangesTable and End ResultRangesTable.
7.1.3 Result
Each Result block is identified by a Result header, followed by several optional properties: component names, ranges table,
and the result values, defined by the lines Values and End Values.
Note: Results can be visually grouped into 'folders' like in the following picture
where
Values: is not case-sensitive, and indicates the beginning of the results values section;
The lines
node_or_elem_number component_1_value component_2_value
...
node_or_elem_number component_1_value component_2_value
are the values of the result at the related 'node_or_elem_number'.
The number of results values are limited thus:
If the Result is located OnNodes, they are limited to the number of nodes defined in ProjectName.post.msh.
If the Result is located OnGaussPoints "My GP", and if the Gauss Points "My GP" are defined for the mesh "My
mesh", the limit is the number of gauss points in "My GP" multiplied by the number of elements of the mesh
"My mesh".
For results in gauss points, each element must have 'ngauss' lines of results.
For example, if the number of gauss points is 3, then for an element, 3 lines of gauss point scalar result must appear.
Values
1 1.155
2.9
3.955
End Values
Holes are allowed in any result. The element nodes with no result defined will not be drawn, i.e. they will appear
transparent.
Result location:
OnNodes: results are defined on the nodes of the mesh. If nodes are shared between elements, as usual, then the result
field is continous.
OnGaussPoints: results are defined in some locations of the mesh elements. Usually solvers calculate values in some
special locations named 'gauss points' for its numerical integration, then is natural to write the results on these
locations. The results field is discontinuous between elements, then some options like calculate streamlines are not
allowed for this kind of result. Sometimes results are extrapolated and averaged on nodes providing a continuous and
smoothed result.
OnNurbsSurface: results are defined on the 'control points' of the NURBS surfaces.
These surfaces by default are the ones of preprocess, but could be overriden by an optional file
<modelname.post.geo> with the same format as the .geo preprocess file.Geometry format: Modelname.geo -pag. 57-.
In this case the .post.geo file must contain only surfaces of NURBS type, and any volume.
Note: in case of have some result OnNurbsSurface the file header must be declared with version greater of equal to
1.2
GiD Post Results File 1.2
The values block of a result OnNurbsSurface must have for each surface with results something like this:
surface_number
value(1)_component_1 ...value(1)_component_n
...
value(num_control_points_u)_component_1 ... value(num_control_points_u)_component_n
...
value(num_control_points_u_x_num_control_points_v)_component_1... value(num_control_points_u_x_num_contr
ol_points_v)_component_n
where:
surface_number is the id of the surface (the same integer number that identify the surface in preprocess)
value is the real number of the result. It is compulsory to write the values for all control pointsof the surface, if some
control point doesn't has result it must have a NR value to represent 'no result'. This is tipical of trimmed NURBS
surfaces, some control points far of trimmed part are not relevant and doest'n have any value.
Result 74
It the whole surface doesn't has OnNurbsSurface result, it is not necesary to be written.
End Values: is not case-sensitive, and indicates the end of the results values section.
Note: For Matrix and PlainDeformationMatrix results, the Si, Sii and Siii components are calculated by GiD, which
represents the eigen values & vectors of the matrix results, and which are ordered according to the eigen value.
Here is an example of results for the table in the previous example (see Mesh example -pag. 81-):
Result "Legs gauss displacements" "Load Analysis" 1 Vector OnGaussPoints "Legs gauss points"
Values
1 -0.1 -0.1 0.5
-0.2 -0.2 0.375
-0.05 -0.05 0.25
0.2 0.2 0.125
0.0 0.0 0.0
2 0.1 -0.1 0.5
0.2 -0.2 0.375
0.05 -0.05 0.25
-0.2 0.2 0.125
0.0 0.0 0.0
3 0.1 0.1 0.5
0.2 0.2 0.375
0.05 0.05 0.25
-0.2 -0.2 0.125
0.0 0.0 0.0
4 -0.1 0.1 0.5
-0.2 0.2 0.375
-0.05 0.05 0.25
0.2 -0.2 0.125
0.0 0.0 0.0
End Values
Results can be grouped into one block. These results belong to the same time step of the same analysis and are located in
the same place. So all the results in the group are nodal results or are defined over the same gauss points set.
Each Result group is identified by a ResultGroup header, followed by the results descriptions and its optional properties -
such as components names and ranges tables, and the results values - all between the lines Values and End values.
"location name": is the name of the Gauss Points on which the ResultGroup is defined.
where
Values: is not case-sensitive, and indicates the beginning of the results values section;
The lines
location_1 result_1_component_1_value result_1_component_2_value result_1_component_3_value
result_2_component_2_value result_2_component_2_value result_2_component_3_value
...
location_n result_1_component_1_value result_1_component_2_value result_1_component_3_value
result_2_component_2_value result_2_component_2_value result_2_component_3_value
are the values of the various results described with ResultDescription for each location. All the results values for the
location 'i' should be written in the same line 'i'.
The number of results values are limited thus:
If the Result is located OnNodes, they are limited to the number of nodes defined in ProjectName.post.msh.
If the Result is located OnGaussPoints "My GP", and if the Gauss Points "My GP" are defined for the mesh "My
mesh", the limit is the number of gauss points in "My GP" multiplied by the number of elements of the mesh
"My mesh".
Holes are allowed. The element nodes with no result defined will not be drawn, i.e. they will appear transparent.
End Values: is not case-sensitive, and indicates the end of the results group values section.
Note: All the results of one node or gauss point should be written on the same line.
Note: For Matrix and PlainDeformationMatrix results, the Si, Sii and Siii components are calculated by GiD, which
represents the eigen values & vectors of the matrix results, and which are ordered according to the eigen value.
2 6.4e-01 0.208E-04 0.208E-04 -0.191E-04 0.0 0.506E+00 0.338E-01 -0.105E+00 0.0 0.0 0.0
3 0.0 0.355E-04 0.355E-04 -0.376E-04 0.0 0.377E+00 0.441E-02 -0.547E-01 0.0 0.0 0.0
...
115 7.8e-01 0.427E-04 0.427E-04 -0.175E-03 0.0 0.156E-01 -0.158E-01 -0.300E-01 0.0 0.0 0.0
116 7.4e-01 0.243E-04 0.243E-04 -0.189E-03 0.0 0.216E-02 -0.968E-02 -0.231E-01 0.0 0.0 0.0
End Values
Note: This postprocess mesh format requires GiD version 6.0 or higher.
Comments are allowed and should begin with a '#'. Blank lines are also allowed.
To enter the mesh names and result names in another encoding, just write # encoding your_encoding
for example:
# encoding utf-8
Inside this file one or more MESHes can be defined, each of them should:
Point: 1 node,
Point connectivity:
Line: 2 or 3 nodes,
Mesh format: ModelName.post.msh 80
Line connectivities:
Triangle: 3 or 6 nodes,
Triangle connectivities:
Quadrilateral: 4, 8 or 9 nodes,
Quadrilateral connectivities:
Tetrahedra, 4 or 10 nodes,
Tetrahedra, connectivities:
Hexahedra, 8, 20 or 27 nodes.
Hexahedra, connectivities:
Prism: 6, 15 or 18 nodes,
Prism connectivities:
Pyramid: 5 or 13 nodes,
Pyramid connectivities:
Mesh format: ModelName.post.msh 81
Note: For elements of order greater than linear, the connectivities must written in hierarchical order, i.e. the vertex
nodes first, then the middle ones.
An optional line describing its colour with # color R G B A, where R, G, B and A are the Red, Green, Blue and Alpha
components of the color written in integer format between 0 and 255, or in floating (real) format between 0.0 and 1.0.
(Note that if 1 is found in the line it will be understood as integer, and so 1 above 255, rather than floating, and so 1
above 1.0). Alpha values represent the transparency of the mesh when this visualization options is active, being 0.0
totally opaque and 1.0 totally transparent.
In this way different colours can be specified for several meshes, taking into account that the # color line must be
between the MESH line and the Coordinates line.
Note: If each MESH specifies its own coordinates, the node number should be unique, for instance, if MESH "mesh
one" uses nodes 1..100, and MESH "other mesh" uses 50 nodes, they should be numbered from 101 up.
where
the pair of keywords elements and end elements are not case-sensitive;
between these keywords there should be the nodal connectivities for the my_type elements.
Note: On elements of order greater than linear, the connectivities must written in hierarchical order, i.e. the vertex
nodes first, then the middle ones;
There is optionally a material number.
For Sphere elements : Element_number Node_number Radius [optional_material_number]
For Circle elements : Element_number Node_number Radius [optional_normal_x optional_normal_y
optional_normal_z] [optional_material_number]
If the normal is not written for circles, normal ( 0.0, 0.0, 1.0) will be used.
#mesh of a table
MESH "board" dimension 3 ElemType Triangle Nnode 3
# color 127 127 0
Coordinates
# node number coordinate_x coordinate_y coordinate_z
Group of meshes 83
Meshes that belong to a group should be defined between the following highlighted commands
Results which refer to one of the groups should be written between these highlighted commands
Note: GiD versions 7.7.3b and later only allow one group at a time, i.e. only one group can be defined across several steps
of the analysis. Care should be taken so that groups do not overlap inside the same step/analysis.
MESH "environment"
... Coordinates
...
10000 ...
end elements
MESH "body" ...
...
20000 ...
end elements
For steps 5, 6, 7 and 8: with some refinement, the 'environment' mesh now being used has 15000 elements and the
'body' mesh needs 20000 elements
MESH "environment"
...
Coordinates
...
15000 ...
end elements
MESH "body" ...
Group of meshes 84
...
35000 ...
end elements
For steps 9 and 10: the last meshes to be used are of 20000 and 40000 elements, respectively
store the information in three pairs (or three binary files), thus:
steps_1_2_3_4.post.msh and steps_1_2_3_4.post.msh (or steps_1_2_3_4.post.bin)
steps_5_6_7_8.post.msh and steps_5_6_7_8.post.msh (or steps_5_6_7_8.post.bin)
steps_9_10.post.msh and steps_9_10.post.msh (or steps_9_10.post.bin)
and use the 'Open multiple' option (see POSTPROCESS > Files menu from Reference Manual) to selected the six (or
three) files; or
write them in only two files (one in binary) by using the Group concept:
all_analysis.post.msh (note the group - end group pairs)
Group "steps 1, 2, 3 and 4"
MESH "environment" ...
...
MESH "body" ...
...
end group
and
all_analysis.post.res (note the ongroup - end ongroup pairs)
New file *.post.lst can be read into GiD, postprocess. This file is automatically read when the user works in a GiD project
and changes from pre to postprocess.
This file can also be read with File-->Open
following the postprocess mesh and result files, a list of graphs filenames can be provided so that GiD reads them too;
fraphs files have the extension .grf;
comment lines begin with the # character and blank lines are also admited;
file names may have absolute path names or relative to the list file location;
Multiple
# postprocess files
cilinder-3D-3-sim2_001.10.post.bin
cilinder-3D-3-sim2_001.100.post.bin
cilinder-3D-3-sim2_001.101.post.bin
cilinder-3D-3-sim2_001.102.post.bin
cilinder-3D-3-sim2_001.11.post.bin
cilinder-3D-3-sim2_001.12.post.bin
cilinder-3D-3-sim2_001.13.post.bin
cilinder-3D-3-sim2_001.14.post.bin
cilinder-3D-3-sim2_001.15.post.bin
cilinder-3D-3-sim2_001.16.post.bin
cilinder-3D-3-sim2_001.17.post.bin
...
cilinder-3D-3-sim2_001.99.post.bin
# graph files
cilinder-3D-3-sim2_001.c2.1.grf
cilinder-3D-3-sim2_001.c2.2.grf
cilinder-3D-3-sim2_001.dem-branch.grf
cilinder-3D-3-sim2_001.dem-contacts.grf
cilinder-3D-3-sim2_001.dem-energy.grf
cilinder-3D-3-sim2_001.dem-stress.grf
File names may have absolute path names or relative to the list file location.
The title of the graph and the labels for the X and Y axes can also be configured with some 'special' comments:
Title: If a comment line contains the Keyword 'Graph:' the string between quotes that follows this keyword will be used
as the title of the graph.
Axes labels: The string between quotes that follows the keywords 'X:' and 'Y:' will be used as labels for the X- and
Y-axes respectively. The same is true for the Y axis, but with the Keyword 'Y:'.
Axes units:
Example:
# Graph: "Stresses"
#
# X: "Szz-Nodal_Streess" Y: "Sxz-Nodal_Stress"
# Units: Pa Pa
-3055.444 1672.365
-2837.013 5892.115
-2371.195 666.9543
-2030.643 3390.457
-1588.883 -4042.649
-1011.5 1236.958
# End
The file *.grf (which contains graphs) is read when changing from pre to post process and
projectName.gid/projectName.post.grf exists, or the postprocess files are read through File-->Open, then
example.msh/res/bin and example.grf are read.
The post list file ( *.post.lst) can also contain a list of graphs (*.grf ).
Binary format 87
Use the freely available GiDPost library to write post-process data files in ascii, binary or hdf5 format. Switching between
these formats only requires a couple of modifications. The source code and some pre-built binaries can be downloaded
from https://www.gidhome.com --> GiDPlus --> GidPost.
Use the freely available GiDPost library to write post-process data files in ascii, binary or hdf5 format. Switching between
these formats only requires a couple of modifications. The source code and some pre-built binaries can be downloaded
from https://www.gidhome.com --> GiDPlus --> GidPost.
HDF5 format for static meshes are supported since version 2.5 and for dynamic meshes since version 2.7.
For a static mesh model, i.e. a model whose mesh does not change along all time-steps of all analyses:
Meshes: for each mesh of the model a numerated subfolder should be present. The properties of the mesh, like
element type, name, etc. (i.e. mesh header in ascii or binary format), are stored as attributes of this numerated folder.
Inside each numerated folder, the coordinates and elements conectivities. Numeration of the coordinates are global
and it's recomended that the numeration of the elements should be too.
Results: for each result of the model a numerated subfolder should be present. The properties of the results, like
analysis name, step value, result type, etc. (i.e. result header in ascii or binary format), are stored as attributes of this
numerated folder. Inside each numerated folder, the result id's and result values are stored.
GaussPoints: for each gauss point referenced by the Results a numerated subfolder should be present with its
definition. The properties of the gauss point definition, like name, numer of integartion points inside the element, etc.
(i.e. gauss point header in ascii or binary format), are stored as attributes of this numerated folder. Eventually, the
numerated folder also contains the natural coordinates of the gauss points if GiD's internal aren't used, i.e. they are
defined by the simulation program.
ResultRangesTable: list of customized legends for the Contour Ranges visualization and referenced by the Results.
Each ResultRangesTable is stored in separated numerated folders and consist of a list that associate a string or
keyword to a range of result values.
This figure shows an example of a static mesh model generated by the testc.exe program of the GiDPost library:
HDF5 format 88
For a dynamic mesh model, i.e. a model whose mesh changes at each time-step, group of time-steps or at each analysis
step, a new group should be used:
MeshGroup: for each mesh change a new enumerated MeshGroup group should be used. This group contains the
Meshes and the Results that belong together in each time-step, group of time-steps or at each analysis step. Note that
the Results on each MeshGroup should be defined in different time-steps/analyses so that GiD can show them to the
user. Inside each MeshGroup the coordinates i
Following figure shows an example of a dynamic mesh model with two time-steps, each one of them with its own
mesh+results definition:
HDF5 format 89
91
For more information about the Tcl/Tk programming language itself, look at www.scriptics.com http://www.scriptics.com.
If you are going to use a Tcl file, it must be located in the Problem Type directory and be called problem_type_name.tcl.
A 'Event procedure' is a Tcl procedure that is invoked from GiD when doing some actions. I allows developers to interleave
its code with the GiD flow.
The structure of problem_type_name.tcl can optionally implement some of these Tcl prototype procedures (and other
user-defined procedures). The procedures listed below are automatically called by GiD. Their syntax corresponds to
standard Tcl/Tk language:
Note: is is possible to get the ordered list of Tcl events with the procedure GiD_Info events
GiD defined events are of category=GENERAL and propietary=gid, these are the default values in case of missing
parameters
The category and propietary allow automatically unregister events when unloading a problemtype or plugin.
GiD_GetRegisteredEventProcsAll <event_name>
To get all procedures registered for an event, without take into accoult the category and propietary.
GiD_GetIsRegisteredEvent <event_name>
Return 1 if there is some procedure registered for the event, 0 else
8.1.1 preprocess
New
GiD_Event_AfterNewGIDProject
Read
GiD_Event_BeforeReadGIDProject
GiD_Event_AfterReadGIDProject
GiD_Event_AfterInsertGIDProject
GiD_Event_AfterSetProjectName
GiD_Event_BeforeOpenFile
GiD_Event_AfterOpenFile
Write
GiD_Event_BeforeSaveGIDProject
GiD_Event_AfterSaveGIDProject
GiD_Event_AfterSaveAsGIDProject
GiD_Event_AfterSaveFile
GiD_Event_AfterSaveImage
Geometry
GiD_Event_AfterCreatePoint
GiD_Event_AfterCreateLine
GiD_Event_AfterCreateSurface
GiD_Event_AfterCreateVolume
GiD_Event_BeforeDeletePoint
GiD_Event_BeforeDeleteLine
GiD_Event_BeforeDeleteSurface
GiD_Event_BeforeDeleteVolume
GiD_Event_AfterRenumber
Copy / Move
GiD_Event_BeforeCopy
GiD_Event_AfterCopy
GiD_Event_BeforeMove
GiD_Event_AfterMove
Mesh
GiD_Event_BeforeMeshGeneration
GiD_Event_AfterMeshGeneration
GiD_Event_BeforeMeshErrors
preprocess 93
GiD_Event_BeforeMeshProgress
GiD_Event_MeshProgress
GiD_Event_AfterMeshProgress
GiD_Event_AfterChangeMesh
GiD_Event_AfterRenumber
Dimensions
GiD_Event_BeforeDeleteDimension
GiD_Event_AfterCreateDimension
Layers
GiD_Event_AfterCreateLayer
GiD_Event_AfterRenameLayer
GiD_Event_BeforeDeleteLayer
GiD_Event_AfterDeleteLayer
GiD_Event_AfterChangeLayer
GiD_Event_AfterChangeParentLayer
GiD_Event_AfterSetLayerToUse
GiD_Event_AfterSendToLayer
GiD_Event_AfterChangeLayersOrSets
Groups
GiD_Event_AfterCreateGroup
GiD_Event_AfterRenameGroup
GiD_Event_BeforeDeleteGroup
GiD_Event_AfterDeleteGroup
GiD_Event_AfterChangeGroup
GiD_Event_AfterChangeParentGroup
8.1.1.1 New
proc GiD_Event_AfterNewGIDProject {} {
}
8.1.1.2 Read
GiD_Event_BeforeReadGIDProject: will be called just before read a GiD project. It receives the argument filename,
which is the path of the model folder, without the .gid extension.
If it returns -cancel- then the reading is cancelled.
GiD_Event_AfterReadGIDProject: will be called just after read a GiD project. It receives the argument filename, which
is the path of the model folder, without the .gid extension.
GiD_Event_AfterInsertGIDProject: will be called just after insert a GiD project into the current one. It receives the
argument filename, which is the path of the model folder, without the .gid extension.
GiD_Event_AfterSetProjectName:
GiD_Event_BeforeOpenFile:
GiD_Event_AfterOpenFile: will be called after a geometry or mesh file is read inside GiD. It receives as arguments:
filename: the full name of the file that has been read;
format: ACIS_FORMAT, CGNS_FORMAT, DXF_FORMAT, GID_BATCH_FORMAT, GID_GEOMETRY_FORMAT,
GID_MESH_FORMAT, IGES_FORMAT, NASTRAN_FORMAT, PARASOLID_FORMAT, RHINO_FORMAT,
SHAPEFILE_FORMAT, STL_FORMAT, VDA_FORMAT, VRML_FORMAT or 3DSTUDIO_FORMAT.
error: boolean 0 or 1 to indicate an error when reading.
8.1.1.3 Write
GiD_Event_AfterSaveAsGIDProject: will be called after GiD save its information in the new_filename location, when this
folder and the model files exists, and provide the old_filename argument for example to allow to copy extra data, like
result files handled by the problemtype.
GiD_Event_AfterSaveFile: will be called after a geometry or mesh file is exported to a file. It receives as arguments:
filename: the full name of the file that has been written;
format: ACIS_FORMAT, DXF_FORMAT, GID_GEOMETRY_FORMAT, GID_MESH_FORMAT, IGES_FORMAT,
RHINO_FORMAT, AMELET_FORMAT, KML_FORMAT.
error: boolean 0 or 1 to indicate an error when writting.
GiD_Event_AfterSaveImage: will be called after a picture or model is saved to disk. It receives as arguments:
filename: the full name of the file that has been saved;
format: eps, ps, tif, bmp, ppm, gif, png, jpg, tga, wrl
8.1.1.4 Geometry
GiD_Event_AfterCreatePoint/Line/Surface/Volume: will be called just after create the entity, providing its number
GiD_Event_BeforeDeletePoint/Line/Surface/Volume: will be called just before delete the entity, providing its
number
GiD_Event_AfterRenumber: will be called after renumber the geometry or the mesh (to update for example fields
storing entity identifiers)
useof : could be GEOMETRYUSE or MESHUSE
leveltype: the kind of entity that was renumbered.
Geometry: must be ALL_LT.
Mesh: could be NODE_LT or ELEM_LT.
renumeration:
Geometry: four sublists with the old and new idenfiers for points, lines, surfaces and volumes.
Mesh: a sublist with the old and new identifiers for nodes or elements.
GiD_Event_AfterRepair: will be called after repair (the geometry and mesh), to do extra tasks at scripting level
It must return a list of the items: num_repaired and message
num_repaired: integer, the number of repaired things
message: a translated message to be shown to the used after the repair
proc GiD_Event_AfterRepair { } {
return [list $num_repaired $message]
}
GiD_Event_BeforeCopy/Move GiD_Event_AfterCopy/Move: will be called just before or after use copy or move tools.
useof : could be GEOMETRYUSE or MESHUSE
transformation : could be ROTATION, TRANSLATION, MIRROR, SCALE, OFFSET, SWEEP or ALIGN
8.1.1.6 Mesh
GiD_Event_BeforeMeshGeneration: will be called before the mesh generation. It receives the mesh size desired by the
user as the element_size argument. This event can typically be used to assign some condition automatically.
If it returns -cancel- the mesh generation is cancelled.
Mesh 96
GiD_Event_AfterMeshGeneration: will be called after the mesh generation. It receives as its fail argument a true value
if the mesh is not created.
GiD_Event_BeforeMeshErrors: filename is the full path to the file that has information about the meshing errors.
Retuning -cancel- the standard 'Mesh error window' won't be opened
proc GiD_Event_AfterMeshProgress { } {
}
GiD_Event_AfterChangeMesh:
GiD_Event_AfterRenumber: will be called after renumber the geometry or the mesh (to update for example fields
storing entity identifiers)
useof : could be GEOMETRYUSE or MESHUSE
leveltype: the kind of entity that was renumbered.
Geometry: must be ALL_LT.
Mesh: could be NODE_LT or ELEM_LT.
renumeration:
Geometry: four sublists with the old and new idenfiers for points, lines, surfaces and volumes.
Mesh: a sublist with the old and new identifiers for nodes or elements.
8.1.1.7 Dimensions
GiD_Event_BeforeDeleteDimension: will be called just before delete the entity, providing its number
GiD_Event_AfterCreateDimension: will be called just after create the entity, providing its number
8.1.1.8 Layers
GiD_Event_AfterRenameLayer: will be called just after the layer 'oldname' has been renamed to 'newname'
GiD_Event_BeforeDeleteLayer / GiD_Event_AfterDeleteLayer: will be called just before /after delete the layer
'name'
If GiD_Event_BeforeDeleteLayer returns -cancel- the layer deletion is cancelled.
GiD_Event_AfterChangeLayer: will be called just after change some property of the layer 'name'
property' could be ON, OFF, FROZEN, UNFROZEN, ALPHA <AAA>, COLOR <RRRGGGBBB?AAA?>
with RRR, GGG, BBB, AAA from 0 to 255
GiD_Event_AfterChangeParentLayer: will be called when moving a layer to another parent of the tree.
GiD_Event_AfterChangeLayersOrSets:
8.1.1.9 Groups
GiD_Event_AfterRenameGroup:
GiD_Event_AfterDeleteGroup:
GiD_Event_AfterGroupParentGroup: will be called when moving a group to another parent of the tree.
8.1.2 problemtype
Start / End
GiD_Event_InitProblemtype
GiD_Event_BeforeInitProblemtype
GiD_Event_EndProblemtype
GiD_Event_AfterChangeProblemtype
GiD_Event_AfterSetProblemtypeName
Read / Write
GiD_Event_LoadModelSPD
GiD_Event_LoadProblemtypeSPD
GiD_Event_SaveModelSPD
Transform
GiD_Event_BeforeTransformProblemType
GiD_Event_AfterTransformProblemType
Materials
GiD_Event_AfterCreateMaterial
GiD_Event_AfterRenameMaterial
GiD_Event_BeforeDeleteMaterial
GiD_Event_AfterChangeMaterial
GiD_Event_AfterAssignMaterial
Conditions
GiD_Event_AfterCreateCondition
GiD_Event_BeforeDeleteCondition
GiD_Event_AfterChangeCondition
Intervals
GiD_Event_AfterCreateInterval
GiD_Event_BeforeDeleteInterval
GiD_Event_AfterDeleteInterval:
GiD_Event_AfterSetIntervalToUse
Units
GiD_Event_AfterChangeModelUnitSystem
Calculation file
GiD_Event_BeforeWriteCalculationFile
GiD_Event_AfterWriteCalculationFile
GiD_Event_SelectOutputFilenames
Run
GiD_Event_SelectGIDBatFile
GiD_Event_BeforeRunCalculation
GiD_Event_AfterRunCalculation
GiD_Event_EndProblemtype: will be called when this project is about to be closed. It has no arguments.
proc GiD_Event_EndProblemtype {} {
}
GiD_Event_AfterChangeProblemtype
GiD_Event_AfterSetProblemtypeName
GiD_Event_LoadModelSPD: will be called when a GiD project is loaded. It receives the argument filespd, which is the
path of the file which is being opened, but with the extension .spd (specific problemtype data). This path is tipically the file
of the model where the problemtype store its own data.
Note: GiD_Event_AfterLoadGIDProject Will be called when a GiD project is loaded, but not when a problem type is loaded,
then could be used instead of GiD_Event_LoadModelSPD as an oportunity to load the problemtype data of the model.
GiD_Event_LoadProblemtypeSPD: will be called when a problem type is loaded. It receives the argument filespd, which
is the path of the file which is being opened, but with the extension .spd (specific problemtype data).
This path is tipically the file of the problemtype where the problemtype define its own data.
Note:LoadGIDProject is a deprecated confusing event, that is called in both cases: GiD_Event_LoadModelSPD and
GiD_Event_LoadProblemtypeSPD
GiD_Event_SaveModelSPD: will be called when the currently open file is saved to disk. It receives the argument filespd,
which is the path of the file being saved, but with the extension .spd (specific problemtype data). This path can be useful if
you want to write specific information about the problem type in a new file.
8.1.2.3 Transform
GiD_Event_BeforeTransformProblemType: will be called just before transforming a model from a problem type to a
new problem type version. If it returns -cancel- as a value then the transformation will not be invoked.
file: the name of the model to be transformed;
oldproblemtype: the name of the previous problem type;
newproblemtype: the name of the problem type to be transformed.
return $value
}
GiD_Event_AfterTransformProblemType: will be called just after transforming a model from a problem type to a new
problem type version.
8.1.2.4 Materials
GiD_Event_AfterRenameMaterial: will be called just after the mateial 'oldname' has been renamed to 'newname'
GiD_Event_AfterChangeMaterial: will be called just after change some field value of the material 'name'.
changedfields is a list with the index of the changed fields (index starting from 1)
GiD_Event_AfterAssignMaterial: will be called just after assign or unassign the material of some entities.
name is the name of the new material. If it is "" then the material has been unassigned.
leveltype: is the kind of entity, if could be:
For geometry: POINT_LT, LINE_LT, SURFACE_LT,VOLUME_LT
For mesh: ELEM_LT.
8.1.2.5 Conditions
GiD_Event_AfterChangeCondition: will be called just after change some field value of the condition 'name'.
changedfields is a list with the index of the changed fields (index starting from 1)
8.1.2.6 Intervals
GiD_Event_AfterCreateInterval: will be called just after a new interval is created, providing its integer id
GiD_Event_BeforeDeleteInterval: will be called just before a interval is deleted, providing its integer id
If it returns -cancel- the interval deletion is cancelled.
GiD_Event_AfterDeleteInterval: will be called just after a interval is deleted, providing its integer id
GiD_Event_AfterSetIntervalToUse: will be called just after a the current interval is changed, providing its integer id
8.1.2.7 Units
GiD_Event_AfterChangeModelUnitSystem: will be raised when user change the current unit system or the declared
model length units.
old_system and new_system are the names of the units systems before and after the change respectivelly. They could be
empty "" or the same (e.g. changing the model length units)
GiD_Event_BeforeWriteCalculationFile: will be called just before writing the calculation file. It is useful for validating
some parameters.
If it returns -cancel- as a value then nothing will be written.
file: the name of the output calculation file.
GiD_Event_AfterWriteCalculationFile: will be called just after writing the calculation file and before the calculation
process. It is useful for renaming files, or cancelling the analysis.
If it returns -cancel- as a value then the calculation is not invoked.
file: the name of the output calculation file error: an error code if there is some problem writing the output calculation
file.
"Calculate->View process info" (in case that we want to not use the list of 'OutFiles' declared in the
bat file).
8.1.2.9 Run
GiD_Event_SelectGIDBatFile: must be used to switch the default batch file for special cases.
This procedure must return as a value the alternative pathname of the batch file. For example it is used as a trick to select
a different analysis from a list of batch calculation files.
GiD_Event_BeforeRunCalculation: will be called before running the analysis. It receives several arguments:
batfilename: the name of the batch file to be run
basename: the short name model;
dir: the full path to the model directory;
problemtypedir: the full path to the Problem Types directory;
gidexe: the full path to gid;
args: an optional list with other arguments.
If it returns -cancel- then the calculation is not started.
8.1.3 postprocess
Start/End
GiD_Event_BeforeInitGIDPostProcess
GiD_Event_InitGIDPostProcess
GiD_Event_AfterSetPostModelName
GiD_Event_EndGIDPostProcess
GraphsSet
GiD_Event_AfterCreateGraphSet
GiD_Event_BeforeDeleteGraphSet
GiD_Event_AfterDeleteGraphSet
GiD_Event_AfterChangeGraphSet
GiD_Event_AfterRenameGraphSet
GiD_Event_AfterSetGraphSetToUse
postprocess 103
Graphs
GiD_Event_AfterCreateGraph
GiD_Event_BeforeDeleteGraph
GiD_Event_AfterDeleteGraph
GiD_Event_AfterChangeGraph
GiD_Event_AfterRenameGraph
Sets
GiD_Event_AfterCreateSurfaceSet
GiD_Event_AfterCreateVolumeSet
GiD_Event_AfterRenameSurfaceSet
GiD_Event_AfterRenameVolumeSet
GiD_Event_BeforeDeleteSurfaceSet
GiD_Event_BeforeDeleteVolumeSet
GiD_Event_AfterChangeLayersOrSets
Cuts
GiD_Event_AfterCreateCutSet
GiD_Event_AfterRenameCutSet
GiD_Event_BeforeDeleteCutSet
Results
GiD_Event_AfterLoadResults
GiD_Event_BeforeResultReadErrors
GiD_Event_AfterSetAnalysis
GiD_Event_AfterSetTimeStep
GiD_Event_AfterSetResult
GiD_Event_AfterSetResultComponent
GiD_Event_BeforeInitGIDPostProcess: will be called just before changing from pre to postprocess, and before read any
postprocess file (this event can be used for example to check the results file existence and/or rename files). It has no
arguments.
If it returns -cancel- as a value then the swapping to postprocess mode will be cancelled.
proc GiD_Event_BeforeInitGIDPostProcess {} {
}
proc GiD_Event_InitGIDPostProcess {} {
...body...
set value ...
return $value
}
GiD_Event_AfterSetPostModelName
GiD_Event_EndGIDPostProcess: will be called when you leave Postprocess and open Preprocess. It has no arguments.
proc GiD_Event_EndGIDPostProcess {} {
}
8.1.3.2 GraphsSet
Note: This command 'Modeless' open a non-modal window (non-locking) and the selected option will be sent to
GiD_Process when the user click its button.
8.1.4.2 View
GiD_Event_GetBoundingBox: will be called when recalculating the bounding box, for example when user select "zoom
frame"
useof: can be "GEOMETRYUSE", "MESHUSE", "POSTUSE" or "GRAPHUSE".
This procedure must return xmin ymin zmin xmax ymax zmaz of the bounding box of the entities directly managed by the
problemtype (these entities must be directly drawn with the drawopengl command).
If "" is returned instead "xmin ymin zmin xmax ymax zmaz" then any additional bounding box is considered.
Note: Must not use GiD commands asking for the model size, like GiD_Info Layers -bbox , because these commands will
invoke again GiD_Event_GetBoundingBox entering in a cyclic loop. (these kind of commands are unneded here, because
GiD_Event_GetBoundingBox must inform only about its own managed objects)
proc GiD_Event_AfterDrawModel {} {
}
GiD_Event_AfterRedraw:
proc GiD_Event_AfterRedraw {} {
}
8.1.4.3 Licence
GiD_Event_AfterChangeLicenceStatus: will be called when the licence status of GiD changes. Possible status could be
"academic", "professional" or "temporallyprofessional"
8.1.4.4 Other
GiD_Event_AfterProcess: will be called just after GiD has finished the process of 'words' (the parameter is_rotation==1
if the command is a view movement). This event could be interesting for some tricks, like save processed commands in a
batch file, or send the commands to be processed by other GiD slave, etc.
Other 109
GiD_Event_BeforeSetVariable / GiD_Event_AfterSetVariable:will be called just before or after set the value of a GiD
variable
GiD_Event_AfterSaveKernelDefaults:will be called just after save the C++ variables in the user preferences file
You have to enter exactly the same sequence as you would do interactively, including the escape sequences (using the
word escape) and selecting the menus and operations used.
You can obtain the exact commands that GiD needs by checking the Right buttons menu (Utilities -> Tools -> Toolbars).
It is also possible to save a batch file (Utilities -> Preferences) where the commands used during the GiD session can be
checked.
Here is a simple example to create one line:
Note: Mescape is a multiple 'escape' command, to go to the top of the commands tree.
GiD_Info <option>
Tcl command used to obtain information about the current GiD project.
This function provides any information about GiD, the current data or the state of any task inside the application.
Depending on the arguments introduced after the GiD_Info sentence, GiD will output different information:
8.3.1 automatictolerance
GiD_Info AutomaticTolerance
This command returns the value of the Import Tolerance used in the project. This value is defined in the
Preferences window under Import.
8.3.2 conditions
Instead of ovpnt, ovline, ovsurf, ovvol, ovlayer, ovgroup the following options are also available:
if a condition name is given, the command returns the properties of that condition.
It is also possible to add the options geometry|mesh|groups, and all geometry or mesh entities that have this condition
conditions 110
assigned will be returned in a list if its integer identifiers. The word 'groups' must be used only if the condition was
declared as 'over groups' and then the list contain its names.
If -interval "intv" is set, then the conditions on this interval ("intv"=1,...n) are returned instead of those on the current
interval.
If -localaxes is set, then the three numbers that are the three Euler angles that define a local axes system are also
returned (only for conditions with local axes, see DATA>Local Axes from Reference Manual).
Selecting -localaxesmat, the nine numbers that define the transformation matrix of a vector from the local axes system
to the global one are returned.
If -localaxescenter is set, then the three Euler angles and the local axis center are also returned.
Selecting -localaxesmatcenter returns the nine matrix numbers and the center.
-array must be used only in combination with -localaxes_xx to get data more efficiently, as a list of two arrays, the first
are the integer ids of the entities, and the second array the double values representing the localaxes data.
In case of 'face-element' entities the first item is a list of two items, the integer ids of the elements and the integer ids of
the faces (local ids from 1 to 6)
Note: if -array is not used then -localaxes_xx return not only the local axis data of the #LA# question, but also the string
values of the other questions non #LA# questions.
Adding the number id of an entity ( <entity_id> ) after the options mesh or geometry, the command returns the value of
the condition assigned to that entity. It is possible to specify a range of ids with the syntax <first_id:last_id>
if -count is specified then the amount of entities with the condition is returned instead of the list of entities and its values.
books: If this option is given, a list of the condition books of the project is returned.
Examples:
in: GiD_Info conditions ovpnt
out: "Point-Weight Point-Load"
8.3.3 coordinates
8.3.4 check
GiD_Info check
For surfaces:
GiD_Info check surface <entity_id> isclosed | isdegeneratedboundary | selfintersection
And for volumes:
GiD_Info check volume <entity_id> orientation | boundaryclose
Example:
in: GiD_Info check volume 5 orientation
out: 2 {4 38}
8.3.5 events
GiD_Info events
This command returns a sorted list with the names of the GiD Tcl event procedures, that could be implemented by a
problemtype.
These events are automatically undefined when the problemtype is unloaded
8.3.6 gendata
GiD_Info gendata
This command returns the information entered in the Problem Data window (see Problem and intervals data file
(.prb)).
The following options are available:
[otherfields]: It is possible to add this option to get the additional fields from the Problem Data window.
[books]: If this option is given, a list of the Problem Data books in the project is returned.
Example:
in: GiD_Info gendata
out: "2 Unit_System#CB#(SI,CGS,User) SI Title M_title"
8.3.7 geometry
GiD_Info Geometry
geometry 112
This command gives the user information about the geometry in the project. For each entity, there are two
possibilities:
[NumPoints]: Returns the total number of points in the model.
[NumLines]: Returns the total number of lines.
[NumSurfaces]: Returns the total number of surfaces.
[NumVolumes]: Returns the total number of volumes.
[NumDimensions]: Returns the total number of dimensions.
[MaxNumPoints]: Returns the maximum point number used (can be higher than NumPoints).
[MaxNumLines]: Returns the maximum line number used.
[MaxNumSurfaces]: Returns the maximum surface number used.
[MaxNumVolumes]: Returns the maximum volume number used.
[MaxNumDimensions]: Returns the maximum dimension number used.
8.3.8 gidbits
GiD_Info GiDbits
8.3.9 gidversion
GiD_Info GiDVersion
This command returns the GiD version number. For example 10.0.8
8.3.10 graphcenter
GiD_Info graphcenter
8.3.11 intvdata
GiD_Info intvdata
This command returns a list of the interval data in the project (see Problem and intervals data file (.prb)).
The following options are available:
-interval <number>: To get data from an interval different from the number 0 (default).
[otherfields]: It is possible to add this option to get the additional fields from the Interval Data window.
[books]: If this option is given, a list of the Interval Data books in the project is returned.
[num]: If this option is given, a list of two natural numbers is returned. The first element of the list is the current
interval and the second element is the total number of intervals.
8.3.12 ispointinside
GiD_Info IsPointInside
GiD_Info IsPointInside ?-no_model? ?-tolerance <tol>? Line|Surface|Volume <num> {<x> <y> <z>}
This commands returns 1 if the point {x y z} is inside the specified volume/surface/curve, or 0 if lies outside.
If -no_model flag is specified then entities are stored in a special container, it doesn't belong to the model
8.3.13 layers
GiD_Info layers
This command returns a list of the layers in the project.These options are also available:
<layer_name>: If a layer name is given, the command returns the properties of that layer.
-on: Returns a list of the visible layers.
-off: Returns a list of the hidden layers.
-hasbacklayers: Returns 1 if the project has entities inside back layers.
Note: GiD_Info back_layers returns a list with the back layers
Example:
in: GiD_Info back_layers
out: Layer2_*back*
layers 113
For elements it is possible to specify -elementtype <elementtype>to get only this kind of elements.
-higherentity <num>Allow to get only entities with this amount of higherentities.
-canbedeleted <layer_name> returns a list with two items: a boolean 0|1 to know if layer or its child layers
have some entity or parts in back layer or conditions over the layer. the second item is a message explaining the
cause to not delete it directly.
Examples:
in: GiD_Info layers
out: "layer1 layer2 layer_aux"
8.3.14 library
GiD_Info library
To access to information of some linked libraries (e.g. gid mesh libraries)
8.3.15 listmassproperties
If -no_model flag is specified then entities are stored in a special container, it doesn't belong to the model
Example:
in: GiD_Info ListMassProperties Lines 13 15
out:
listmassproperties 114
LINES
n. Length
13 9.876855
15 9.913899
Selected 2 figures
________________________
Total Length=19.790754
8.3.16 list_entities
GiD_Info list_entities
If -no_model flag is specified then entities are stored in a special container, it doesn't belong to the model
This command returns a list with general information about the current GiD project.
PreStatus ask for the information of preprocess
PostStatus ask for the information of postprocess
Status return the infomation of pre or postprocess depending of where are now, in pre or post mode.
Example:
Interval 1 of 1 intervals
Degree of elements is: Normal
Using now mode(geometry/mesh): geometry
number of points: 6
number of points with 2 higher entities: 6
number of nodes: 8
number of nodes with 0 conditions: 8
number of Triangle elements: 6
number of elements with 0 conditions: 6
GiD_Info list_entities
This command returns information about entities.
It has the following arguments:
Points / Lines / Surfaces / Volumes / Dimensions / Nodes / Elements / Results: Type of entity or
Results. Note: If the user is postprocessing in GiD, the information returned by Nodes/Elements concerns the
nodes and elements in postprocess, including its results information. To access preprocess information about the
preprocess mesh, the following entity keywords should be used: PreNodes/PreElements.
entity_id: The number of an entity. It is also possible to enter a list of entities (e.g.: 2 3 6 45), a range of entities
(e.g.: entities from 3 to 45, would be 3:45) or a layer (e.g.: layer:layer_name).
magnitudes 116
e.g.
in: GiD_Info magnitudes 0 LENGTH units
out: {1.0 m {} m {} m} {100 cm {} cm {} cm} {1.0e+3 mm {} mm {} mm}
with the multiplication factor to convert the length magnitude from the reference unit to another unit.
(e.g to convert a value from cm to m must multiply by 100)
8.3.19 materials
GiD_Info materials
Examples:
in: GiD_Info materials
out: "Air Steel Aluminium Concrete Water Sand"
in: GiD_Info materials Steel
out: "1 Density 7850"
GiD_Info materials Steel otherfields
GiD_Info materials books
GiD_Info materials(profiles)
8.3.20 mesh
GiD_Info Mesh
This command gives the user information about the selected mesh in the project.
Without arguments it returns 1 if there is mesh, followed by a list with all types of element used in the mesh.
?-pre | -post -step <step>?: To specify to use the preproces or postprocess mesh, and the time step if it changes
along the time. (default -pre)
-array : Instead of a plane list it returs the resuls as a list of vectors (more efficient).
In fact with -array it is returned an 'objarray': a Tcl_Obj object specialized for arrays, implemented as a Tcl
package named 'objarray'. (for more information see scripts\objarray\objarray.pdf)
-avoid_frozen_layers : to ignore nodes or elements of frozen layers
-layer <layername> : to get only nodes of element of this layer
-group <groupname> : to get only nodes of element of this group
EmbeddedDistances: Returns a list with 2 items, the objarray of ids of the nodes (integers) and the objarray of
distances to the boundary (doubles). This information is only available meshing with embedded mesh type
Examples:
in: GiD_Info Mesh
out: "1 Tetrahedra Triangle"
8.3.21 meshquality
GiD_Info MeshQuality
This command returns a list of numbers. These numbers are the Y relative values of the graph shown in the option
Meshing -> Mesh quality (see MESH>Mesh Quality from Reference Manual) and two additional real numbers with the
minimum and maximum limits.
Example:
in: GiD_Info MeshQuality MinAngle Triangle 20 60 4
out: "13 34 23 0 20.0 60.0"
8.3.22 opengl
GiD_Info OpenGl
8.3.23 ortholimits
GiD_Info ortholimits
This command returns a list (Left, Right, Bottom, Top, Near, Far, Ext) of the limits of the geometry in the project.
In perspective mode near and far have the perspective distance substracted.
8.3.24 bounding_box
This command returns a list {x_min x_max y_min y_max z_min z_max} of the bounding box that contains the visualized
model with the current settings (on layers).
bounding_box 118
It also could return the bounding box of a geometric entity, specified by its category and <entity_id>.
8.3.25 parametric
GiD_Info parametric
This command returns geometric information (coordinates, derivates, etc.) about parametric lines or surfaces.
For lines it has the following syntax:
GiD_Info parametric ?-no_model? line <entity_id> coord|deriv_t|deriv_tt|t_fromcoord|t_fromrelativeleng
th|length_to_t<t>|<x> <y> <z> ?<t_seed>?
And for surfaces:
GiD_Info parametric ?-no_model? surface <entity_id> coord|deriv_u|deriv_v|deriv_uu|deriv_vv|deriv_uv
|normal|uv_fromcoord|maincurvatures|uv_projection_z_fromcoord<u> <v> | <x> <y> <z> ?<u_seed>
<v_seed>?
If -no_model flag is specified then entities are stored in a special container, it doesn't belong to the model
8.3.26 perspectivefactor
GiD_Info perspectivefactor
This command returns which perspective factor is currently being used in the project.
8.3.27 postprocess
GiD_Info postproces
"result_name".
components_list "result_view_type" "result_name" "analysis_name" "step_value": Returns a list of all
the components of the result "result_view_type" "result_name" "analysis_name" "step_value".
cur_component: Returns the current component of the current result.
cur_vector_factor "results_view_type" "result_name" ["component_name"] "analysis_name"
"step_value": Returns the current vector factor of the result "results_view_type" "result_name"
["component_name"] "analysis_name" "step_value".
cur_result_surface_factor "results_view_type" "result_name" "component_name" "analysis_name"
"step_value": Returns the current surface factor of the result "results_view_type" "result_name"
"component_name" "analysis_name" "step_value".
main_geom_state: Returns whether the main geometry is Deformed or Original.
main_geom_factor "analysis_name" "step_value" "result_name": Returns the deformation factor of the
main geometry of "analysis_name" "step_value" "result_name".
main_geom_all_deform: Returns a list of all the deformation variables (vectors) of the main geometry.
main_geom_cur_deform: Returns the current deformation variable (vectors) of the main geometry.
main_geom_cur_step: Returns the main geometry current step.
main_geom_cur_anal: Returns the main geometry current analysis.
main_geom_cur_factor: Returns the main geometry current deformation factor.
show_geom_state: Returns whether the reference geometry is Deformed or Original.
show_geom_color: Returns the reference geometry current color.
show_geom_factor "analysis_name" "step_value" "result_name": Returns the deformation factor of the
reference geometry of "analysis_name" "step_value" "result_name".
show_geom_cur_deform: Returns the current deformation variable (vectors) of the reference geometry.
show_geom_cur_analysis: Returns the reference geometry current analysis.
show_geom_cur_step: Returns the reference geometry current step.
show_geom_deformation_type: Returns whether the reference geometry deformation is relative or absolute.
border_criteria: Returns the value of border angle option. Select the angle criteria between faces to consider the
shared edge a boundary edge, i.e. sharp edge, or not. Angles between normals of adjacent faces smaller than the
criteria set will be considered a sharp edge and visualized when the mesh style 'boundaries' is selected.
iso_all_display_styles: Returns a list of all available display styles for isosurfaces.
iso_cur_display_style: Returns the current display style for isosurfaces.
iso_all_display_renders: Returns a list of all types of rendering available for isosurfaces.
iso_cur_display_render: Returns the current rendering method for isosurfaces.
iso_cur_display_transparence: Returns Opaque or Transparent depending on the current transparency of
isosurfaces.
iso_cur_result_values: Returns the current result values of isosurfaces.
changed_analysis_step: Returns 1 if the analysis step has changed from the last query, 0 if has not changed.
changed_results_view: Returns 1 if the results view has changed from the last query, 0 if has not changed.
changed_geom_list: Returns 1 if the geometry has changed from the last query, 0 if has not changed.
changed_graph_list: Returns 1 if the graph list has changed from the last query, 0 if has not changed.
contour_limits: Returns the minimum and maximum value of the contour limits. Before each value, the word STD
appears if the contour limit value is the default value, and USER if it is defined by the user.
comments: Returns the comments that appear in different results views.
pagedimensions: Returns the settings that are applied when an image is sent to the printer or a snapshot is
taken. Returns (in inches) pagewidth, leftmargin, topmargin, imgwidth, imgheight, landscape/portrait.
hardcopyoptions: Returns 1 or 0 for the options "show GiD logo in images", "white background for images",
"white background for videos", "transparent background for images", "transparent background for animations",
"draw background images for images", "draw background images for videos", "show GiD logo in videos".
animationformat: Returns the default animation format.
cur_show_conditions: Returns the option selected in the Conditions combo box of the Select & Display
Style window. (Possible values: Geometry Mesh None)
all_show_conditions: Returns all the options available in the Conditions combo box of the Select & Display
Style window. (Geometry Mesh None)
cur_pre_model_properties: Returns all the options selected in the Draw Model and Model Render combo box
of the Select & Display Style window.
all_pre_model_properties: Returns all the options available in the Draw Model and Model Render combo box
of the Select & Display Style window.
postprocess 121
8.3.28 problemtypepath
GiD_Info problemtypepath
This command returns the absolute path to the current problem type.
project 122
8.3.29 project
This command returns information about the project. More precisely, it returns a list with:
Problem type name.
Current model name.
'There are changes' flag.
Current layer to use.
Active part (GEOMETRYUSE, MESHUSE, POSTUSE or GRAPHUSE).
Quadratic problem flag.
Drawing type (normal, polygons, render, postprocess).
NOPOST or YESPOST.
Debug or nodebug.
GiD temporary directory.
Must regenerate the mesh flag (0 or 1).
Last element size used for meshing (NONE if there is no mesh).
BackgroundFilename is the name of a background mesh file to assign mesh sizes.
RequireMeshSize. (1 if all sizes are specified by the number of divisions, then user is not required to specify the
mesh size)
RecommendedMeshSize. (The value of the mesh size that the program will recommend, based on the model size)
HelpAboutMoreInfo (extra information)
GeoVersion (the current version of the .geo file)
It is possible to ask for a single item only rather than the whole list, with <item> equal to:
ProblemType | ModelName | AreChanges | LayerToUse | ViewMode | Quadratic | RenderMode | ExistPost |
Debug | TmpDirectory | MustReMesh | LastElementSize | BackgroundFilename | RequireMeshSize |
RecommendedMeshSize | HelpAboutMoreInfo | GeoVersion
Example:
in: GiD_Info Project
out: "cmas2d e:\models\car_model 1 layer3 MESHUSE 0 normal YESPOST nodebug C:\TEMP\gid2 0 1.4"
8.3.30 unitssystems
GiD_Info unitssystems
return 1 if the problemtype is using units, 0 else
gid
It return a list with the names of the units systems defined in the file gid.uni
prj
It return a list with the names of the units systems of the project defined in the file <problemtype>.uni
usersys
It return a list with the names of the units systems defined at runtime by the user (in case that it is not disabled by
<problemtype>.uni)
modunit
It return information about the current length units of the model.
Return a list with three items like "LENGTH 1 0" or "LENGTH 2 1"
the first item is LENGTH, the magnitude name of length
the second item is the index in magnitudes of the current length unit
unitssystems 123
the third item is 0 if length is defined in the 'gid units set' or 1 if it is defined in the 'problemtype units set'
e.g.
in:
lassign [GiD_Info unitssystems modunit] magnitude_name unit_index set_index
set model_length_unit [lindex [GiD_Info magnitudes $set_index $magnitude_name $unit_index] 1]
out: m
prbsys
Is the name of the current unit system to use for the model
udstate
return the 'user defined systems' state: 0 or 1 (0 disabled, 1 enabled)
magused
List of names of magnitudes used by the model (some magnitudes defined in gid.uni could be neglected to not show
them)
8.3.31 variables
Note: this command is deprecated to get a variable value. The more modern GiD_Set command can be used to get or
set the value of a GiD variable, look into Special Tcl commands>Other for more information.
If the argument is -pre or -post then it returns a sorted list of the GiD variables of preprocess or postprocess
respectivelly.
8.3.32 view
GiD_Info view
See VIEW>View entry>Save/Read View of Reference Manual for a brief explanation of this parameters
GiD add to the standard Tcl/Tk keywords some extra commands, to do specific thinks.
8.4.1 Project
GiD_Project batchfile|set|view
Command including a collection of subcommands, most of them replacing deprecated commands attached to the 'togl'
object (Tk OpenGL widget)
GiD_Project batchfile
To handle the batch file where processed commands are recorded
8.4.1.1 batchfile
GiD_Project batchfile
To handle the batch file where processed commands are recorded
8.4.1.2 set
Note: Usually these command are used jointly, to temporary disable redraws to accelerate the process.
It is recommended for a Tcl developer to use the more 'user-friendly' procedures defined inside the file 'dev_kit.tcl' (located
in the \scripts directory). For example, to disable and enable redraws, you can use:
::GidUtils::DisableGraphics
::GidUtils::EnableGraphics
8.4.1.3 view
if <value> is provided then the value is set, else the current values are get
GiD_Project view clip_planes_x ?{left right}?
Lleft and right clip planes, real values
GiD_Project view clip_planes_y ?{top bottom}?
Top and bottom clip planes, real values
GiD_Project view clip_planes_z ?{near far}?
Near and far clip planes
GiD_Project view clip_planes_margin ?value?
Margin between view and model box
GiD_Project view rotation_vector ?{x y z}?
Rotation vector
GiD_Project view rotation_factor ?value?
Rotation factor
GiD_Project view rotation_matrix ?{v11 ... v44}?
Rotation matrix (4x4)
GiD_Project view rotation_center ?{x y z}?
Rotation center
GiD_Project view perspective_distance ?value?
Perspective distance
GiD_Project view perspective_ortho_near ?value?
Perspective near plane
GiD_Project view perspective_ortho_far ?value?
Perspective far plane
GiD_Project view perspective_factor ?value?
Perspective factor
GiD_Project view perspective_view ?0|1?
1 if perspective conical visualization mode is active, 0 if false
GiD_Project view mode ?GEOMETRYUSE|MESHUSE|POSTUSE|GRAPHUSE?
Current view mode
GiD_Project view render_mode ?value?
Current render mode (integer)
view 126
8.4.2 Geometry
-v2mean version 2 of this command (deprecated version 1 documentation must be seen in help of old versions of the
program), the flag really is optional and if missing version 1 is assumed.
If -no_model flag is specified then entities are stored in a special container, it doesn't belong to the model
index_boundaries extra argument to get an objarray of integers with the index of the list of curves where each
boundary start.
If the surface doesn't has any hole, it return 0 (the start index of the outer loop)
It the surface has holes it return an index by hole (the start index or the hole inner loop)
-v2 mean version 2 of this command and then return this data (deprecated version 1 documentation must be seen
in help of old versions of the program)
will return:
<type> <layer> <p1> <p2> <geometrical data>
<type> can be: stline, nurbsline, arcline, polyline
<layer> is the layer name
<p1> identifier of start point
<p2> identifier of end point
<geometrical data> item depends of each entity type
stline: nothing
nurbsline: <d> <n> {x y z ... x y z} {w ... w} {k ... k}
<d>degree of the polynomials
<n> number of control points
<xi yi zi> control points coordinates (objarray of 3*n double values)
<wi> are the weights associated to each control point (objarray of double values. Empty array if is
non-rational)
<ki> knots (the amount of knots = amount of control points+degree+1
arcline: <xc> <yc> <r> <sa> <ea> {m11 ... m44}
<xc> <yc> 2D center
<r> radius
<sa> <ea> start and end angle (rad)
{m11 ... m44} transformation 4x4 matrix (the identity for a 2D case)
m11 ...m33 is a rotation 3x3 matrix
m14 ...m34 is a translation 3x1 vector
m44 is an scale factor
m41 ... m43 must be 0
polyline: <line .... line> <orientation ... orientation>
<line ...> is a list with the data of each sub-line of the polyline
<orientation ... orientation> is an objarray of values 0 or 1 (0==natural orientation, along tangent, 1==
opposite direction)
<wi> are the weights associated to each control point (objarray of double values. Empty array if is non-rational)
<kui> <kvi> knots in each direction
meshsurface: <nnode> {x1 y1 z1 ... xnn ynn znn} {a1 b1 c1 ?d1? ... ane bne cne ?dne?}
nnode: number of nodes by element: 3 or 4 (triangles or quadrilaterals)
xi yi zi: coordinates
ai bi ci di: connectivities (di only for quadrilaterals)
radius_and_normals: only for sphere and circle elements. objarray with num_elements items of double with
the radius of each element or num_elements*4 items for circles, with the radius and the normal 3D vector
(normal to the plane of the circle).
<args>: <num>|<num_min>:<num_max>
Examples:
Creation of a new NURBS surface:
GiD_Geometry create surface 1 nurbssurface Layer0 0 {1 4 3 2} {1 1 1 1} \
{1 1 2 2 {0.17799 6.860841 0.0 -8.43042200 6.86084199 0.0 0.17799400 0.938510 0.0 -8.43042
0.938510 0.0} \
{} {0.0 0.0 1.0 1.0} {0.0 0.0 1.0 1.0}}
GiD_MeshData size|size_by_cordal_error|size_background_mesh|size_correct|unstructured|mesher|structur
ed|semi_structured|boundary_layer|element_type|mesh_criteria|reset
To assign mesh data to geometrical entities
change of sizes)
GiD_MeshData reset
To reset all meshing information data assigned to the model
8.4.4 Mesh
GiD_Mesh create|delete|edit|get|list
To create, delete, modify, list or know information about mesh nodes or elements of the preprocess:
GiD_Mesh create element <num>|append <elemtype> <nnode> <N1 ... Nnnode> <radius> <nx> <ny>
<nz> ?<matname>?
<num>|append: <num> is the identifier (integer > 0) for the node. You can use the word 'append' to set a new
number automatically. The number of the created entity is returned as the result.
<elemtype>: must be one of "Point | Line | Triangle | Quadrilateral | Tetrahedra | Hexahedra | Prism | Pyramid |
Sphere | Circle"
<nnode> is the number of nodes an element has
<N1 ... Nnnode> is a Tcl list with the element connectivities
<radius> is the element radius, only for sphere and circle elements
<nx> <ny> <nz> is the normal of the plane that contain the circle, must be specified for circle elements only
<matname> is the optional element material name
get element return the list: <element_layer> <elemtype> <nnode> <N1> ... <Nnnode>
get element face|face_linear: <N1_face> ... <Nnnode_face>
get element edge_linear: <N1_edge> <N2_edge>
Note: get element from_face or from_edge could be an expensive operation because the whole mesh is traversed to find
them.
list: to get a list of entity identifiers of a range, filtered with some conditionals
GiD_Mesh list ?<filter_flags>? node|element ?<num>|<num_min:num_max>?
<filter_flags> could be: ?-higherentity <num_higher>? ?-material <id_material>? ?-layer <layer_name>?
?-plane {a b c d r}? ?-element_type <types_allowed>?
-higherentity <num_higher> to filter the selection and list only the entities with the amount of parents equal to
<num_higher> (integer >=0)
-material <id_material>to filter the selection and list only the entities with material id equal to <id_material>
(integer >=0)
-layer <layer_name>to filter the selection and list only the entities with layer equal to <layer_name>
-plane <a b c d r> to list only the entities wigth center that match the plane equation a*x+b*y+c*z+d<=r
(r>=0.0)
-element_type <types_allowed> to list only the elements of a type contained in <types_allowed>, that must
be a list of allowed types ("Point | Line | Triangle | Quadrilateral | Tetrahedra | Hexahedra | Prism | Pyramid |
Sphere | Circle")
if <num> or <num_min:num_max> are not provided it is considered as 1:end, and then all ids are returned
Examples:
GiD_Mesh create node append {1.5 3.4e2 6.0}
GiD_Mesh create element 58 triangle 3 {7 15 2} steel
GiD_Mesh delete element {58 60}
set triangles_and_quads [GiD_Mesh list -element_type {triangle quadrilateral} element]
8.4.5 Tools
GiD_Tools geometry|mesh
This GiD_Tools command pretends to have subcommands of tools specialized in some geometry or mesh tasks
8.4.5.1 Geometry
classify_connected_parts
To split the input items of <entity_ids> in one or several parts where the entities of the part are connected
Two entities are assumed as connected only if they share a lowerentity boundary figure.
e.g lines sharing points, or surfaces sharing lines
but are considered not connected two surfaces that share only one point
if two figures only share a figure contained in <forced_separator_ids> they will be considered in diferent parts
it returns a list where each item is an objarray of integers with the ids of the entities of each connected part
{<part1_1 ... part1_n1> ... <partn_1 ... partn_nn>}
mass_properties
It returns a list with 3 items: mass {center_x center_y center_z} {Ixx Iyy Izz Ixy Iyz Ixz}
the 6 inertia values describe the symmetric 3x3 inertia tensor
Note: this command is similar to GiD_Info listmassproperties, but this command is not computing inertias
8.4.5.2 Mesh
mass_properties
To calculate the mass properties of volume, gravity center and inertia tensor of a volume, defined by a selection of
tetrahedra or the selection of the triangles bounding the volume.
<tetrahedra_ids> A list of integer ids of the tetrahedra of the volume to be computed
<triangle_ids> A list of integer ids of the triangles that enclose a volume, with normals pointing inside.
It returns a list with 3 items: mass {center_x center_y center_z} {Ixx Iyy Izz Ixy Iyz Ixz}
the 6 inertia values describe the symmetric 3x3 inertia tensor
Note: this command is similar to GiD_Info listmassproperties, but this command is not computing inertias
intersectvolumeslines
8.4.6 Layers
8.4.6.1 Definition
GiD_Layers create|delete|edit|get|list|window|exists|is_forbidden_name
8.4.6.2 Entities
GiD_EntitiesLayers assign|get|entity_layer
To handle the entities that belong to layers
In case of all_geometry is expected a list with 4 items with the list of ids of points, lines, surfaces and
volumes.
In case of all_mesh is expected a list with 2 itemos with the list of ids of nodes and elements respectivelly
In fact it is returned an 'objarray': a Tcl_Obj object specialized for arrays, implemented as a Tcl package
named 'objarray'. (for more information see scripts\objarray\objarray.pdf)
8.4.7 Groups
8.4.7.1 Definition
GiD_Groups create|clone|delete|edit|get|list|window|exists|is_forbidden_name|draw|end_draw
windows.
GiD_Groups get color|opaque|visible|allowed_types|allowed_element_types|parent|state|num_entiti
es|num_conditions|id<group>
To obtain the current value of some property:
num_entities: the total number of geometric or mesh entities that belong to the group
num_conditions: the total number of conditions applied to the group
id: the numeric identifier of the group
GiD_Groups list ?<parent>?
To get the list of fullnames of the current groups.
If a parent is specified, then only relative names of child groups will be listed. Root parent could be specified with
an empty string ""
GiD_Groups window open|close|update
Show or hide the groups window or update its content
GiD_Groups exists <group>
Return 1 if group exists, 0 else
GiD_Groups is_forbidden_name <group>
Return 1 if group name has forbidden syntax
GiD_Groups draw {<group_1> ... <group_n>}
Starts drawing the specified groups
GiD_Groups end_draw
Finish drawing groups.
8.4.7.2 Entities
GiD_EntitiesGroups assign|unassign|get|entity_groups
To handle the entities that belong to groups
Note: GiD_WriteCalculationFile could be interesting to tranverse an print data based on groups without the extra cost of
GiD_EntitiesGroups serializing potentially big lists of entities.
If <over> is all_mesh then is obtained a list with 3 sublists: node id's, element id's, face id's (and face id's is a
list with 2 items: element id's and face id's)
if -count is speficified, then only the number of objects is returned instead of its list.
if -element_type <types_allowed> is specified then only the types of elements listed in <types_allowed> will
be taken into account. <types_allowed> must be a list of triangle quadrilateral, etc.
if -visible is specified, then only the entities visible must be taken into account
In fact it is returned an 'objarray': a Tcl_Obj object specialized for arrays, implemented as a Tcl package
named 'objarray'. (for more information see scripts\objarray\objarray.pdf)
GiD-Tcl special commands to manage books, materials, conditions, intervals, general data or local axes:
8.4.8.1 Books
Books are like a container to visually separe materials or conditions in submenus and different windows
8.4.8.2 CreateData
Example:
set id_material [GiD_CreateData create material Steel Aluminium {3.5 4 0.2}]
GiD_CreateData delete material Aluminium
set id_condition [GiD_CreateData create condition surface_pressure ovsurf ovfaceelem {{pressure} {0.0}}]
GiD_CreateData delete condition surface_pressure
8.4.8.3 AssignData
Example:
GiD_AssignData material Steel Surfaces {2:end}
GiD_AssignData condition Point-Load Nodes {3.5 2.1 8.0} all
GiD_AssignData condition Face-Load face_elements {3.5 2.1 8.0} {15 1 18 1 20 2}
8.4.8.4 UnAssignData
Example:
GiD_UnAssignData material * surfaces {end-5:end}
GiD_UnAssignData condition Point-Load nodes layer:Layer0
GiD_UnAssignData condition Face-Load face_elements {15 1 18 1 20 2}
8.4.8.5 ModifyData
Example:
GiD_ModifyData material Steel {2.1e6 0.3 7800}
GiD_ModifyData intvdata 1 ...
GiD_ModifyData gendata ...
GiD_ModifyData -book material Steel my_new_book
<condition_name> is the name of the condition (local axis are associated to a condition with an special #LA# field)
<entity_ids...> is a list (objarray) of integers with the ids of the entities (of the type as the condition was defined
over geometry or mesh)
<entiy_euler_angles...> is a list (objarray) of reals with the consecutive 3 values to set to each entity of the list.
The amount of angles must 3*amount of ids
8.4.8.6 AccessValue
Example:
GiD_AccessValue set gendata Solver Direct
set mass [GiD_AccessValue -index get material $material_id mass]
set default_value [GiD_AccessValue get -default gendata $question]
8.4.8.7 IntervalData
8.4.8.8 LocalAxes
GiD_LocalAxes <mode> <name> ?<type>? <Cx Cy Cz> <PAxex PAxey PAxez> <PPlanex PPlaney PPlanez>?
To create, delete or modify local axes:
<mode>: must be one of "create|delete|edit|exists", which correspond to the operations: create, delete, edit or
exists;
<name>: is the name of local axes to be created or deleted;
<type>: must be one of "rectangular|cylindrical|spherical C_XZ_Z|C_XY_X". Currently, GiD only supports rectangular
axes. C_XZ_Z is an optional word to specify one point over the XZ plane and another over the Z axis (default).
C_XY_X is an optional word to specify one point over the XY plane and another over the X axis;
<Cx Cy Cz> is a Tcl list with the real coordinates of the local axes origin;
<PAxex PAxey PAxez> is a Tcl list with the coordinates of a point located over the Z' local axis (where Z' is positive).
The coordinates must be separated by a space. If the z coordinate is missing, it is set to z=0.0;
<PPlanex PPlaney PPlanez> is a Tcl list with the coordinates of a point located over the Z'X'half-plane (where X' is
positive).
For the 'exists' operation, if only the <name> field is specified, 1 is returned if this name exists, and 0 if it does not. If
the other values are also apecified, <name> is ignored.
The value returned is:
-1 if the global axes match;
-2 if the automatic local axes match;
-3 if the automatic alternative local axes match;
LocalAxes 141
Example:
GiD_LocalAxes create "axes_1" rectangular C_XY_X {0 0 0} {0 1 0} {1 0 0}
GiD_LocalAxes delete axes_1
GiD_LocalAxes exists axes_1
GiD_LocalAxes exists "" rectangular C_XY_X {0 0 0} {0 1 0} {1 0 0}
this last sample returns -1 (equivalent to global axis)
8.4.8.9 Units
e.g.
GiD_Units get system
-> SI
e.g.
GiD_Units edit system imperial
e.g.
GiD_Units get model_unit_length
-> m
e.g.
GiD_Units edit model_unit_length mm
8.4.9 Results
if the -array flag is used (recommended for efficiency), then the syntax of the data changes. Instead to multiple
items {id1 vx1 vy1 ...} ... {idn vxn vyn} a single item with sublists is required, {{id1 ... idn} {{vx1...vxn}
{vy1...vyn}}}, where idi are the integers of the node or element where the result are defined, and vi are the real
values. The amount of values depends on the type of result: 1 for Scalar, 2 for ComplexScalar, 3 for Vector (4 if
signed modulus is provided), 6 for Matrix.
In fact with -array it is returned an 'objarray': a Tcl_Obj object specialized for arrays, implemented as a Tcl
package named 'objarray'. (for more information see scripts\objarray\objarray.pdf)
Examples:
GiD_Result create -array {Result "MyVecNodal" "Load analysis" 10 Vector OnNodes} {ComponentNames
"Vx" "Vy" "Vz" "|velocity|"} {{1 3} {{2.0e-1 -3.5e-1} {2.0e-1 4.5e-1} {0.4 -2.1}}}
GiD_Result create {Result "Res Nodal 1" "Load analysis" 1.0 Scalar OnNodes} {1 2} {2 2} {113 2}
{3 5} {112 4}
GiD_Result create {Result "Res Nodal 2" "Load analysis" 4 Vector OnNodes} {ComponentNames "x
comp" "y comp" "z comp" "modulus"} {1 0.3 0.5 0.1 0.591} {2 2.5 0.8 -0.3 2.641}
GiD_Result create -array {Result "Res Nodal 2" "Load analysis" 4 Vector OnNodes} {ComponentNames
"x comp" "y comp" "z comp" "modulus"} {{1 2} {{0.3 2.5} {0.5 0.8} {0.1 -0.3} {0.591 2.641}}}
Examples:
GiD_Result delete {"Res Nodal 1" "Load analysis" 4}
GiD_Result get -selection {169 170} -array [list "Test Gauss" "LOAD ANALYSIS" 10]
-> {Result "Test Gauss" "LOAD ANALYSIS" 10 Scalar OnGaussPoints "Triangles"} {ComponentNames
"Test Gauss"} {{169 170} {{26.25 27.299999237060547 28.350000381469727 26.399999618530273
27.450000762939453 28.5}}}
GiD_Result get -selection {169 170} [list "Test Gauss" "LOAD ANALYSIS" 10]
-> {Result "Test Gauss" "LOAD ANALYSIS" 10 Scalar OnGaussPoints "Triangles"} {ComponentNames
"Test Gauss"} {169 26.25 27.299999237060547 28.350000381469727} {170 26.399999618530273
27.450000762939453 28.5}
<elemtype> must be one of "point | line | triangle | quadrilateral | tetrahedra | hexahedra | prism | pyramid |
sphere | circle". (see Mesh format: ModelName.post.msh -pag. 79-)
<npoint> number of gauss points of the element
-nodes_included :optional word, only for line elements, to specify that start and end points are considered (by
default are not included)
<coordinates> : vector with the local coordinates to place the gauss points: 2 coordinates by node for surface
elements, 3 coordinates for volume elements. For line elements now is not possible to specify its coordinates,
the n points will be equispaced.
If coordinates are "" then internal coordinates are assumed.
<mesh_name>: optional mesh name where this definition is applied, by default it is applied to all meshes
get <name>
Return the information of this gauss point
names
Return a list with the names of all gauss points defined
delete <name>
Examples:
GiD_Result gauss_point create GPT1 Quadrilateral 1 {0.5 0.5}
GiD_Result create {Result "Res Gauss 1" "Load analysis" 1.0 Scalar OnGaussPoints GPT1} {165 2} {2}
{3} {164 5} {4} {3}
-array flag can be specified, for create and get subcommands, to use list of vectors to handle the information in a
more efficient way
8.4.10 Sets
8.4.10.1 Definition
GiD_Sets get
To handle the definition of postprocess sets (similar to preprocess layers)
8.4.10.2 Entities
GiD_EntitiesSets get|entity_sets
To handle the entities that belong to postprocess sets (similar to preprocess layers)
GiD_EntitiesSets get|entity_sets
To know the entities of a set or to know the sets of an entity
GiD_EntitiesSets get <set_name> nodes|elements|all_mesh ?-count?
To get the list of entities of kind <over> that belong to <set_name>
If <over> is all_mesh then is obtained a list with 2 sublists: node id's, element id's
if -count is speficified, then only the number of objects is returned instead of its list.
In fact it is returned an 'objarray': a Tcl_Obj object specialized for arrays, implemented as a Tcl package
Entities 144
Example:
set count_elements_set [GiD_EntitiesSets get Layer0 elements -count]
set nodes_ids_one_set [GiD_EntitiesSets get Layer0 nodes]
Example:
set element_21_set [GiD_EntitiesSets entity_sets elements 21]
set node_8_sets [GiD_EntitiesSets entity_sets nodes 8]
8.4.11 Graphs
GiD_Graph clear|create|delete|edit|exists|get|hide|list|show
GiD_Graph create "My graph" "x values" "y values" {0 1 2 3} {0.5 2.1 -4.5 8.8} "" ""
delete <graph_name>?<graphset_name>?: deletes the graph "graph_name" causing an error if does not exists;
edit <graph_name> <label_x> <label_y> <x_values> <y_values> <x_unit> <y_unit>
?<graphset_name>?: modify a the graph with the new values, but without lost other settings like line color, etc.
exists <graph_name>?<graphset_name>?: return 1 the graph "graph_name" exists.
get <graph_name> ?<graphset_name>?: gets a list with the values of the graph with name "graph_name", the
values are the same used to create a graph: <label_x> <label_y> <x_values> <y_values>
get_name <num> ?<graphset_name>? : get the name of the graph with global identifier <num>. If
<graphset_name> is specified then the graph is only find in this graphset instead of all graphsets.
hide?<graphset_name>?: hides the graphs and switches back to mesh view.
list ?<graphset_name>?: gets a list of the existent graphs, an empty list if there is no graph.
selection get|swap| set <value> <graph_name>: set or get the flag of selection of the graph. <value> is must
be 0 or 1 and is only needed in case of set. swap change the current selection state to the opposite one. Selected
graphs are showed in red color.
show?<graphset_name>?: switches the graphic view and shows the graphs.
GraphSets 145
8.4.12 GraphSets
GiD_GraphSet create|current|delete|edit|exists|list
create ?<graphset_name>?: creates a new graph set. If the name is not provided an automatic unused name is
assigned. The name of the graph set is returned.
current ?<graphset_name>?: get or set the current graph set. There is always a current graph set.
delete <graphset_name>: deletes the graphset "graphset_name".
edit <graphset_name> name|legend_location|title_visible <new_value> : modify the property of the graph
set.
name: is the graphset identifier name
legend_location: 0 - to not show the graph legend
1 - to show the legend on the top-right (default)
2 - to show the legend on the top in a single line, like a title
title_visible: 0 or 1, to print or not in the legend also the graphset name
exists <graphset_name>: return 1 the graph set "graphset_name" exists;
list : gets a list of the existent graph sets;
8.4.13 OpenGL
GiD_OpenGL register|unregister|registercondition|unregistercondition|draw|drawtext|project|unproject|get|
doscrzoffset|drawentity|font|pgfont
This command is a Tcl wrapper of some OpenGL functions. It allows to use OpenGL commands directly from GiD-Tcl.
For example, for C/C++ is used:
glBegin(GL_LINES);
glVertex(x1,y1,z1);
glVertex(x2,y2,z2);
glEnd();
The standard syntax must be changed according to these rules: - OpenGL constants: "GL" prefix and underscore character
'_' must be removed; the command must be written in lowercase.
Example:
GL_COLOR_MATERIAL -> colormaterial
- OpenGL functions: "GL" prefix must be removed and the command written in lowercase. Pass parameters as list, without
using parentheses ()
Example:
glBegin(GL_LINES) -> glbegin lines
The subcommand "GiD_OpenGL draw" provides access to standard OpenGL commands, but other "GiD_OpenGL" special
GiD subcommands also exists:
register <tclfunc> Register a Tcl procedure to be invoked automatically when redrawing the scene. It returns a
handle to unregister.
Example:
proc MyRedrawProcedure { } { ...body... }
set id [GiD_OpenGL register MyRedrawProcedure]
Example:
GiD_OpenGL unregister $id
registercondition <tclfunc> <condition> Register a Tcl procedure to be invoked automatically when redrawing
OpenGL 146
draw <-cmd args -cmd args> This is the most important subcommand, it calls standard OpenGL commands.
See the list of supported OpenGL functions.
drawtext <text> ?–check_non_latin? Draw a text more easily than using standard OpenGL commands (draw
in the current 2D location, see rasterpos OpenGL command).
If -check_non_latin flag is provided, then the text is checked to detect non-latin characters, like a Japanese string,
to be drawn properly (otherwise it is considered as a latin string). The flag must be provided only if <text> could
potentially be non-latin, like translated strings. In case of numbers for example it is unneeded (more efficient
without the extra check)
Example:
GiD_OpenGL draw -rasterpos [list $x $y $z]
GiD_OpenGL drawtext "hello world"
Example:
GiD_OpenGL drawentity -mode filled surface {1 5 6}
For elements it is possible to draw only a face, specifying items of element_id and face_id, whith face_id a number
from 1 to the number of faces of the element.
Example:
GiD_OpenGL drawentity -mode filled element {{1 1} {5 1} {6 3}}
project <x y z> Given three world coordinates, this returns the corresponding three window coordinates.
unproject <x y z> Given three window coordinates, this returns the corresponding three world coordinates.
get modelviewmatrix|projectionmatrix|viewport
return a list of values:
modelviewmatrix: 16 doubles
projectionmatrix: 16 doubles
viewport: 4 integers
doscrzoffset <boolean> Special trick to avoid the lines on surfaces hidden by the surfaces.
measure <text> returns the amount of space in pixels to display this <text>
current returns a list with the current font name and size
metrics returns a list with current font metrics information: -ascent -descent and -linespace in pixels, -fixed is 1 if
all characters have equal size
Example:
GiD_OpenGL font push {"Times New Roman" 18}
set with [GiD_OpenGL measure "hello world"]
GiD_OpenGL drawtext "hello world"
GiD_OpenGL pop
You can find more information about standard OpenGL functions in a guide to OpenGL.
8.4.14 Raster
GiD_Raster create|interpolate
To create from the mesh a raster (2D grid) with a value that represents the z, and use a raster to efficiently interpolate
values to other points or all points of other raster.
8.4.15 Other
Example:
GiD_Set CreateAlwaysNewPoint
GiD_Set CreateAlwaysNewPoint 1
GiD_Set -default CreateAlwaysNewPoint
GiD_Set -meshing_parameters_model SurfaceMesher
GiD_SetModelName <name>
To change the current model name.
If name is not specificied then the current model name is returned.
GiD_SetProblemtypeName <name>
To change the current problemtype name.
If name is not specificied then the current problemtype name is returned.
Example:
GiD_ModifiedFileFlag set 1
GiD_ModifiedFileFlag get
Example:
GiD_MustRemeshFlag set 1
GiD_MustRemeshFlag get
GiD_Redraw
To force a redraw
Note: 'GiD_BackgroundImage set location' must be called after 'GiD_BackgroundImage set filename'
GiD_RegisterPluginAddedMenuProc <procedure>
To register a Tcl procedure to be automatically called when re-creating all menus (e.g. when doing files new)
this procedure is responsible to add its own options to default menu.
Example:
GiD_RegisterPluginAddedMenuProc Amelet::AddToMenu
GiD_WriteCalculationFile
It is a command to efficiently print to file the mesh data classified by groups
To see its syntax see Writing the input file for calculation -pag. 39-
GiD_File fopen|fclose|fprintf|fflush|list
To allow print data from a Tcl procedure with standard fprintf command, specially to write the calculation file from Tcl or a
mix of .bas template and Tcl procedures
GiD_File fopen <filename> ?<access>?
Open a file named <filename> for writting access. By default access is "w", but is possible to use "a" to append to a
previous file (and "wb" or "ab" to open the file in binary mode). It returns a long integer <file_id> representing the
channel
GiD_File fclose <file_id>
Close a channel
GiD_File fprintf -nonewline <file_id> <format> ?<arg>? ... ?<arg>?
Print data from a Tcl procedure in a file opened with GiD_File fopen and returns the number of printed characters.
(a .bas template implictly open/close a file with this command, and the file_id could be send to a tcl procedure as a
parameter with the *FileId template keyword)
<file_id> must be a valid file descriptor, that could be obtained in a .bas template with the *FileId command (or with
GiD_File fopen)
<format> must be a valid C/C++ format, according with the arguments
return
GiD_File fflush <file_id>
Force unwritten buffered data to be written to the file
GiD_File list
It returns a list of currently open file_ids
Other 151
Example:
.bas file:
Number of points and lines: *tcl(MyMethod *FileId)
.tcl file:
proc MyMethod { channel } {
GiD_File fprintf -nonewline $channel {%d %d} [GiD_Info Geometry NumPoints] [GiD_Info Geometry
NumLines]
}
Example:
label .l -image [image create photo -data [GiD_Thumbnail get]]
quality: integer value from 0 1o 100, valid only for jpeg format (that compress losing image quality)
Example:
lassign [GiD_Thumbnail get_pixels png] w h pixels
set my_image [image create photo -width $w -height $h -data [encrypter BASE64 encode $pixels]]
label .l -image $my_image
get_vectorial STL|VRML|OBJ
It returns the current view in binary STL or ascii VRML format. As STL only accepts triangles, lines are formated as
collapsed triangles and polygons are triangularized.
GiD_Thumbnail get_vectorial obj --> returns a list with 3 elements:
1st - the obj file contents ( refers to the 'ObjInMemory.mtl' material library file eventually)
2nd - (optional) the mtl file contents (i.e. the 'ObjInMemory.mtl', may refer to the 'ObjInMemory.png')
3rd - (optional) the texture data ( the ''ObjInMemory.png' binary data)
The returned data can be written directly in a file
Example:
# writing STL output
set fo [ open file.stl wb]
puts $fo [GiD_Thumbnail get_vectorial stl]
close $fo
# writting OBJ output
set obj_data [GiD_Thumbnail get_vectorial OBJ]
lassign $obj_data obj_objects obj_mtl obj_tex
set fo [open file.obj w]
puts $fo $obj_objects
close $fo
if { [llength $obj_mtl] > 0} {
# inside $obj_objects there is the refence 'usemtl ObjInMemory.mtl'
set fo [open ObjInMemory.mtl w]
puts $fo $obj_mtl
close $fo
}
if { [llength $obj_tex] > 0} {
# inside $obj_mtl there is the refence 'map_Kd ObjInMemory.png'
set fo [open ObjInMemory.png wb]
puts $fo $obj_tex
close $fo
}
get_statistics_mean
It returns an array of three real numbers with the mean of r g b components of all image pixels. (values from 0.0 to 255.0)
Other 152
e.g.
GiD_Thumbnail get_statistics_mean
->254.5277054398148 254.52159288194446 254.51443142361111
The mapping screen --> world (model) is done by intersecting the line perpendicular to the screen, passing through the
coordinates (screen_x,screen_y), with the plane parallel to the screen (in real model world) at the centre of the view /
model. The returned normal is the normal of this plane.
GiD_Togl current|list
To get or set the current togl (Tk OpenGL object), and the list of all togl's of all windows
Example:
set togl [GiD_Togl current]
GiD_Togl current $togl
set togls [GiD_Togl list]
Problem type developers can take advantage of the internal HTML browser if they wish to provide online help.
The GiDCustomHelp procedure below is how you can show help using the new format:
GiDCustomHelp ?args?
where args is a list of pairs option value. The valid options are:
-title : specifies the title of the help window. By default it is "Help on <problem_type_name>".
-dir : gives the path for the help content. If -dir is missing it defaults to "<ProblemType dir>/html". Multilingual
content could be present; in such a case it is assumed that there is a directory for each language provided. If the
current language is not found, language 'en' (for English) is tried. Finally, if 'en' is not found the value provided for
-dir is assumed as the base directory for the help content.
-start : is a path to an html link (and is relative to the value of -dir).
8.5.1 HelpDirs
With HelpDirs we can specify which of the subdirectories will be internal nodes of the help tree. Moreover, we can specify
labels for the nodes and a link to load when a particular node is clicked. The link is relative the node. For instance:
Assuming that html has been chosen as the base directory for the multilingual help content, the following structure is
possible:
html
Structure of the help content 153
Each content will probably have a directory structure to organize the information. By default the help system builds a tree
resembling the directory structure of the help content. In this way there will be an internal node for each subdirectory, and
the html documents will be the terminal nodes of the tree.
You can also provide a help.conf configuration file in order to provide more information about the structure of the help. In a
help file you can specify a table of contents (TocPage), help subdirectories (HelpDirs) and an index of topics (IndexPage).
8.5.3 TocPage
TocPage defines an html page as a table of contents for the current node (current directory). We have considered two ways
of specifying a table of contents:
For instance:
TocPage gid_toc.html
TocPage contents.ht DT
8.5.4 IndexPage
If we specify a topic index by IndexPage, we can take advantage of the search index. In IndexPage we can provide a set of
html index pages along with the structure type of the index. The type of the index could be:
For instance:
GiD offers you the opportunity to customize the pull-down menus. You can add new menus or to change the existing
ones. If you are creating a problem type, these functions should be called from the InitGIDProject or InitGIDPostProcess
functions (see TCL AND TK EXTENSION -pag. 91-).
).
To remove separators, the option_name is --- , but you can append an index (starting from 0) to specify wich separator
must be removed, if there are more than one.
e.g.
GiDMenu::RemoveOption "Geometry" [list "Create" "---2"] PRE
GiDMenu::UpdateMenus {}
Updates changes made on menus. This function must be called when all calls to create, delete or modify menus are
made.
GiD_RegisterPluginAddedMenuProc <procname>
GiD_UnRegisterPluginAddedMenuProc<procname>
The procedure prototype to be registered must not expect any parameter, something like this.
proc <procname> { } {
... do something ...
}
e.g. a plugin can modify a menu to add some entry, but this entry will be lost when GiD create again all menus, for
example when starting a new model. Registering the procedure will be applied again when recreating menus.
Example:
GiD_RegisterExtensionProc ".gif .png" PRE MyImageProcedure
GiDMenu::InsertOption "Help" [list "My Help"] 1 PRE "" "" "" insert _
GiDMenu::InsertOption "Help" [list "My Help" "My help 1"] 0 PRE "Command_help1" "" "" replace _
GiDMenu::InsertOption "Help" [list "My Help" "My help 2"] 1 PRE "Command_help2" "" "" replace _
Managing menus 156
GiDMenu::UpdateMenus
In this section the Tcl/Tk (scripted) customization of the look and feel of the data windows is shown. The layout of the
properties drawn in the interior of any of the data windows - either Conditions, Materials, Interval Data or Problem Data -
can be customized by a feature called TkWidget; moreover, the common behaviour of two specific data windows,
Conditions and Materials, can be modified by a Tcl procedure provided for that purpose. This common behaviour includes,
in the case of Materials for example, assigning/unassigning, drawing, geometry types, where to assign materials,
creating/deleting materials, etc.
8.7.1 TkWidget
The problem type developer can change the way a QUESTION is displayed and if he wishes he can also change the whole
contents of a window, while maintaining the basic behavior of the data set, i.e. in the Condition window: assign, unassign,
draw; in the Material window: create material, delete material; and so on.
With the default layout for the data windows, the questions are placed one after another in one column inside a container
frame, the QUESTION's label in column zero and the VALUE in column one. For an example see picture below.
CONDITION: Steel_section
CONDTYPE: over lines
CONDMESHTYPE: over body elements
QUESTION: Local_Axes#LA#(-Default-,-Automatic-)
VALUE: -Default-
QUESTION: SteelName
VALUE: IPN-80
QUESTION: SteelType
VALUE: A37
END CONDITION
The developer can override this behavior using TKWIDGET. TKWIDGET is defined as an attribute of a QUESTION and
the value associated with it must be the name of a Tcl procedure, normally implemented in a Tcl file for the problem type.
This procedure will take care of drawing the QUESTION. A TKWIDGET may also draw the entire contents of the window
and deal with some events related to the window and its data.
SYNC {
...
}
DEPEND {
...
}
CLOSE {
...
}
}
}
Note: It is also allowed to add extra arguments before the 'event' argument, and provide its values in theTKWIDGET field
e.g. declare this tkwidget procedure with a first argument "-width 20"
and then define the Tcl procedure ready to get the first extra argument 'configure_options' before 'events':
The argument event is the type of event and args is the list of arguments depending on the event type. The possible
events are: INIT, SYNC, CLOSE and DEPEND. Below is a description of each event.
INIT: this event is triggered when GiD needs to display the corresponding QUESTION and the list of arguments is
{frame row-var GDN STRUCT QUESTION}: frame is the container frame where the widget should be placed; row-var is
the name of the variable, used by GiD, with the current row in the frame; GDN and STRUCT are the names of internal
variables needed to access the values of the data; QUESTION is the QUESTION's name for which the
TKWIDGET procedure was invoked. Normally the code for this event should initialize some variables and draw the
widget.
SYNC: this is triggered when GiD requires a synchronization of the data. Normally it involves updating some of the
QUESTIONs of the data set. The argument list is {GDN STRUCT QUESTION}.
CLOSE: this is triggered before closing the window, as mentioned this can be canceled if an ERROR is returned from
the procedure.
DEPEND: this event is triggered when a dependence is executed over the QUESTION for which the TKWIDGET is
defined, ie. that QUESTION is an lvalue of the dependence. The list of arguments is {GDN STRUCT QUESTION ACTION
value} where GDN, STRUCT and QUESTION are as before, ACTION could be SET, HIDE or RESTORE and value is
the value assigned in the dependence.
The argument args is a variable amount of arguments, provided here as a list. Its content depends on the 'event'
argument.
e.g.
INIT args: PARENT CURRENT_ROW_VARIABLE GDN STRUCT QUESTION
SYNC args: GDN STRUCT QUESTION
DEPEND args: GDN STRUCT QUESTION ACTION VALUE
CLOSE args: GDN STRUCT QUESTION
and its meaning is:
CURRENT_ROW_VARIABLE: store a name of variable that provide the integer row number of the current field
GDN and STRUCT: identify the data (e.g set value [DWLocalGetValue $GDN $STRUCT $QUESTION])
QUESTION is the name of the question that identify the field
ACTION could be "HIDE", "SET" or "RESTORE"
The picture below shows a fragment of the data definition file and the GUI obtained. This sample is taken from the
problem type RamSeries/rambshell and in this case the TKWIDGET is used to create the whole contents of the condition
windows. For a full implementation, please download the problem type and check it.
TkWidget 158
CONDITION: Steel_section
CONDTYPE: over lines
CONDMESHTYPE: over body elements
QUESTION: Local_Axes#LA#(-Default-,-Automatic-)
VALUE: -Default-
QUESTION: SteelName
VALUE: -
QUESTION: SteelType
VALUE: -
TKWIDGET: SteelSections
END CONDITION
GidUtils::TkwidgetGetFilenameButton
To show an entry and a select file button that open the dialog window to select an existent file.
GidUtils::TkwidgetPickPointOrNode
To show an entry and a button to pick in screen the id number of a point in geometry mode or a node in mesh mode
GidUtils::TkwidgetGetLayername
To show a combobox with the current layers
GidUtils::TkwidgetGetGroupname
To show a combobox with the current groups
GidUtils::TkwidgetGetVector3D
TkWidget 159
To show in a single row three entries for x, y, z real coordinates of points or directions.
In this subsection we explain a Tcl procedure used to configure the common behaviour of Materials. We are working on
providing a similar functionality for Conditions using the same interface.
GiD_DataBehaviour controls properties of data windows for Materials and Conditions (not currently implemented). For
Materials we can modify the behaviour of assign, draw, unassign, impexp (import/export), new, modify, delete and
rename. We can also specify the entity type list with the assign option throught the subcommands geomlist and meshlist.
where
data_class could be "material" if we want to modify the behaviour of a particular material, or "materials" if a whole
book is to be modified;
name takes the value of a material's name or a book's name, depending on the value of data_class;
In case that the materials are not classified in books the keyword "Default" means its default implicit book.
cmd can take one of the values: show, hide, disable, geomlist and meshlist;
proplist is a list of options or entity types. When the value of cmd is show, hide or disable, then proplist can be a
subset of {assign draw unassign impexp new modify delete}. If the value of cmd is show it makes the option visible, if
the value is hide then the option is not visible, and when the value is disable then the option is visible but unavailable.
When the value of cmd is geomlist then proplist can take a subset of {points lines surfaces volumes} defining the
entities that can have the material assigned when in geometry mode; if the value of cmd is meshlist then proplist can
take the value elements. Bear in mind that only elements can have a material assigned in mesh mode. If cmd is not
provided, the corresponding state for each of the items provided in proplist is obtained as a result.
Example:
GiD_DataBehaviour materials Default geomlist {surfaces volumes}
GiD_DataBehaviour materials Solid hide {delete impexp}
Example:
GiD_ShowBook materials tables 0
GiDMenu::UpdateMenus
From GiD 11, a themes system has been integrated inside GiD.
In the following chapters, how to manage and use these system is explained in order to get a full integrated look of your
module.
A theme contain:
visual aspect as colors and shape of toolbars and windows.
collection of cursors.
collection of images (images can be classified in 2 categories, images on a root folder: logos, auxiliar images, ...
and images representin icons, this ones can be found on subfolders grouped by image size).
Definitions of which icon size is used in each categories (toolbars, menus).
Default colors of entities and background (this colors will be applied to user the first time that the theme is
Interaction with themes 160
Now there are ony two themes inside GiD: GiD_classic and GiD_black.
As this manual is for modules developers, you must know that the most common situation is to use most images provided
by GiD and for only the new icons that you want to use in your module, implement the themes structure inside your
module, creating the appropiated folder structure and configuration files, and providing images of the new icons for each
theme.
8.8.1 Common
gid_themes::GetThemes
Return the list of available themes
Example:
gid_themes::GetThemes
-> GiD_black GiD_classic GiD_classic_renewed
GiD_Set Theme(Current)|Theme(Size)|Theme(MenuType)|Theme(HighResolutionScaleFactor)
Some theme options can be accesed to get/set as GiD variables, with the GiD_Set command
Theme(Current) ?<theme_name>?
To get or set the current theme in use (to set a theme it is necessary a GiD restart)
Example:
GiD_Set Theme(Current)
-> GiD_classic
Theme(Size)
Integer index that represent the incons collection size (small, medium, large,...)
Theme(MenuType)
could be:native,generic
native:
On Mac OS X: use traditional Apple's menu bar intead of embed the menu bar inside the GiD main window
On Windows: use native menus
On Linux: is the same as generic
generic: Use Tk buttons for the menus
Theme(HighResolutionScaleFactor)
Double value to scale the icons (1.0 by default), to avoid problems with some screen resolutions.
The corresponding folder for each icon category is defined on the configuration of theme (will be one of the subfolders
inside image folder)
Example:
To get surface image for use on a button.
gid_themes::GetImage surface.png toolbar
This will return appropriate image depending on current theme, it could be for example:
(GiD Folder)\themes\GiD_classic\images\large_size(24andmore)\surface.png
Asking for images 161
Note: the full_path_filename points to a 'module' file, but it must be build in a relative way, based on the problemype
location.
e.g.
proc InitGIDProject { dir } {
set full_path_filename [file join $dir my_images_folder my_image.png]
set img [gid_themes::GetImage $full_path_filename]
...
To use proc gid_themes::GetImageModule { filename IconCategory }, you must replicate folder structure of (GiD
Folder)\themes\ inside your module folder.
inside each theme must be a configuration.xml file (could be a copy of the one found in GiD) but also can be configured
with only the following parameters:
<MODULE_THEME name="GiD_classic">
<version>1.1</version>
<alternative_theme>GiD_black</alternative_theme>
<SizeDefinitions>
<SizeDefinition name='small_size'>
<label>small size</label>
<folder>small_size(16andmore)</folder>
<alternative_folder>GiD_black/images/size16</alternative_folder>
</SizeDefinition>
<SizeDefinition name='large_size'>
<label>large size</label>
<folder>large_size(24andmore)</folder>
<alternative_folder>GiD_black/images/size24</alternative_folder>
</SizeDefinition>
</SizeDefinitions>
<IconCategories>
<menu>small_size</menu>
<toolbar>large_size</toolbar>
<small_icons>small_size</small_icons>
<large_icons>large_size</large_icons>
</IconCategories>
</MODULE_THEME>
The option "alternative_theme" its used if some file its not found, for try to find on the alternative theme (example themes
still on develop )
Also using this redirection, a complet themes that module is not interested on can be redirected to our main theme, in this
case we will need just 1 folder for each theme and configuration.xml inside it.
Note: for high resolution displays, with high DPI, check also the proc gid_themes::getDefaultHighResolutionScaleFac
tor{} to scale you images. This functions returns a scale factor, which may be changed by the user in the
preferences window, you'll need to scale your custom images and fonts. This factor is initially set to a value so that the
medium theme size icons are legible in high DPI screens.
The above mentioned functions, gid_themes::GetImage and gid_themes::GetImageModule already take into account this
factor.
Forcing themes use 162
When a module is loaded from inside GiD, module can not control theme configuration.
But if you are installing GiD together with your module, there is a variable inside scripts/ConfigureProgram.tcl to control
how GiD manage themes.
The variable is ::GidPriv(ThemeSelection), and its value can be:
1 (by default), user can choose the theme selection
Any existing theme (Example: GiD_classic), user will be forced to use this theme and options on menus and windows
about themes will be disabled.
With this option its possible to obtain a package gid+module totally customiced with your prefered visual aspect.
Create themes are only for modules that distribute they own package including GiD, or for GiD developers.
If you have created a theme for GiD and want that the theme will be distributed with GiD, just contact us at:
gid@cimne.upc.edu
An example of a customized theme is GiD classic renewed, which can be found in GiD's Data --> Problem type --> Internet
retrieve:
After downloading it, go to the Preferences window, select Graphical --> Appearance in the left tree and select the GiD
classic renewed under GiD theme. GiD will ask you to restart the program for the changes to take effect.
Look of the GiD classic renewed theme:
This theme is a work in progress and new version will be released with new icons.
Inside (GiD_Folder)/themes:
Each folder represent a theme (Example (GiD_Folder)/themes/GiD_black)
Inside each folder must be a configuration.xml
This file must contain the following information:
<GID_THEME name="GiD_black">
<info> theme name is the same as its folder name
images folder is always "GiD/themes/(name of theme)/images/"
cursors folder is always "GiD/themes/(name of theme)/cursors/"
if it does not find a folder it will use the alternative definition
size folder start inside "images" theme folder
alternative folder start from "GiD/themes/" folder
</info>
165
9 PLUG-IN EXTENSIONS
This section explains a new way to expand GiD capabilities: the plug-in mechanism.
Plug-ins which should be used by GiD shoud be present inside the $GID/plugins directory.
If a file with extension .tcl is located inside the GiD 'plugins' folder, with the same name as the folder containing it, then it
is automatically sourced when starting GiD.
This allow to do what the developer want, with Tcl language, e.g. change menus, source other Tcl files or load a 'Tcl
loadable library' that extend the Tcl language with new commands implemented at C level.
To know how to create a 'Tcl loadable library' some Tcl book must be read.
Note that 'GiD dynamic libraries' are different of 'Tcl loadable libraries'
'GiD dynamic libraries' must do specifically the task that GiD expects: now it is only available an interface for libraries that
import mesh and create results for GiD postprocess. In the future new interfaces to do other things could appear, and to be
usable must follow the rules explained in this chapter.
9.2.1 Introduction
As the variety of existent formats worldwide is too big to be implemented in GiD and, currently, the number of supported
formats for mesh and results information in GiD is limited, the GiD team has implemented a new mechanism which enables
third party libraries to transfer mesh and results to GiD, so that GiD can be used to visualize simulation data written in
whatever format this simulation program is using.
This new mechanism is the well know mechanism of plug-ins. Particularly GiD supports the loading of dynamic libraries to
read any simulation data and transfer the mesh and results information to GiD.
Viewing GiD as a platform of products, this feature allows a further level of integration of the simulation code in GiD by
means of transferring the results of the simulation to GiD in any format specified by this simulation code thus avoiding the
use of a foreign format.
The recognized plug-ins are automatically loaded in GiD and appear in the top menu bar in the Files->Import->Plugins
submenu.
9.2.2 In GiD
The recognized import plug-ins appear in the top menu bar under the menu Files->Import->Plugins:
In GiD 166
Import plug-ins menu showing the import plug-in examples included in GiD
These dynamic libraries can be manually loaded and called via TCL scripts, in GiD post-process's command line, or using
the post-process's right menu 'Files ImportDynamicLib' and the options LoadDynamicLib, UnloadDynamicLib,
CallDynamicLib:
For one plug-in library, named MyImportPlugin.dll (or MyImportPlugin.so in Linux or MyImportPlugin.dylib in mac
OS X ) to be automatically recognized by GiD and to be loaded and listed in the top's menu Files->Import->Plugins, the
library should lie inside a directory of the same name, i.e. MyImportPlugin/MyImportPlugin.dll, under any sub-folder of the
%GID%/plugins/Import directory:
Note that only the GiD 32 bits version can handle 32 bits import plug-in dynamic libraries, and only GiD 64 bits can handle
64 bits import plug-in dynamic libraries. Which version of GiD is currently running can be easily recognized in the title bar
of the main window (Title bar of GiD's window showing 'GiD x64', so the current GiD is the 64 bits version)
Together with the GiD installation, following import plug-ins are provided:
OBJ: Wavefront Object format from Wavefront Technologies
OFF: Object file format vector graphics file from Geomview
PLY: Polygon file format, aka Stanford Triangle Format, from the Stanford graphics lab.
PLY-tcl: this plug-in is the same as the above PLY one but with a tcl's progress bar showing the tasks done in the
library while a ply file is imported. For all of these plug-in examples both the source code, the Microsoft Visual Studio
projects, Makefiles for Linux and Mac OS X, and some little models are provided
In GiD 167
The 'tref.off' Object File Format example The 'bunny_standford.ply' Polygon File Format
example
GiD is compiled with the Tcl/Tk libraries (the Tcl version could be seen in Help->About - More...).
Remember that if the developed plugin is targeted for 32 bits, only GiD 32 bits can handle it. If the developed plugin is
developed for 64 bits systems, then GiD 64 bits is the proper one to load the plugin.
Header inclusion
In the plug-in code, in one of the .cc/.cpp/.cxx source files of the plug-in, following definition must be made and following
file should be included:
#define BUILD_GID_PLUGIN
#include "gid_plugin_import.h"
In the other .cc/.cpp/.cxx files which also use the provided functions and types, only the gid_plugin_import.h file should be
included, without the macro definition.
The macro is needed to declare the provided functions as pointers so that GiD can find them and link with its internal
functions.
When GiD is told to load the dynamic library, it will look for, and will call these functions:
GiD_PostImportGetLibName : returns the name of the library and should be unique. This name will appear in the
File->Import->Plugin menu and in the right menu.
GiD_PostImportGetFileExtensions : which should return a list of extensions handled by the library and will be used as
filter in the Open File dialogue window.
GiD_PostImportGetDescription: : returns the description of the library and will be displayed in the title bar of the Open
File dialogue window.
Once the library is registered, when the user selects the menu entry File->Import->Plugin->NewPlugin the Open File
dialogue window will appear showing the registered filters and description of the plug-in.
Developing the plug-in 168
The file selection window showing the plug-in description as title of the window and
filtering the file list with the registered extension
When the user selects a file then following functions are called:
GiD_PostImportFile : this function should read the file, transfer the mesh and results information to GiD and return 0 if
no problems appeared while the file was read or 1 in case of error.
GiD_PostImportGetErrorStr : this function will be called if the previous one returns 1, to retrieve the error string and
show the message to the user.
Inside the GiD_PostImportFile function, following functions can be called to pass information to GiD:
extern "C" int GiD_NewMesh( _t_gidMode gid_mode, _t_gidMeshType mesh_type, const char *name);
extern "C" int GiD_SetColor( int id, float red, float green, float blue, float alpha);
By following the tutorial of the chapter Defining a problem type of the GiD user manual.
By studing and modifing some existing Problem Types
The classic problem type system uses the files .prb, .mat, .cnd, .uni to define general properties, materials, conditions,
units.
Each cathegory of data is showed in a kind of window, and materials and conditions are associated to entities.
About writting the input file for the solver, the classical approach uses simple .bas GiD templates
The creation of a Problem Type involves the creation of a directory located inside the \problemtypes GiD folder, with the
name of the problem type and the extension .gid.
Note: now it is also possible to have a /problemtypes extra folder located at the <GiD user preferences folder>. This is
interesting in case that the user doesn't has privileges to copy a problemtype inside <GiD folder>/problemtypes
Problemtypes that exists when GiD start will appear in its menu (see Problem type from Reference Manual).
The problemtype configuration files are a collection of files inside this subfolder. The name for most of them will follow the
format problem_type_name.xxx where the extension refers to their particular function.
Considering problem_type_name to be the name of the problem type and project_name the name of the project, file
configuration is described by the following diagram:
PROBLEMTYPE 'CLASSIC' 176
Configuration files
problem_type_name.xml XML-based configuration
problem_type_name.cnd Conditions definitions
problem_type_name.mat Materials properties
problem_type_name.prb Problem and intervals data
problem_type_name.uni Units Systems
problem_type_name.sim Conditions symbols
***.geo Symbols geometrical definitions
***.geo Symbols geometrical definitions ...
Template files
problem_type_name.bas Information for the data input file
***.bas Information for additional files
***.bas Information for additional files ...
The files problem_type_name.sim, ***.geo and ***.bas are not mandatory and can be added to facilitate visualization
(both kinds of file) or to prepare the data input for restart in additional files (just ***.bas files). In the same way
problem_type_name.xml is not necessary; it can be used to customize features such as: version info, icon identification,
password validation, etc.
These files generate the conditions and material properties, as well as the general problem and intervals data to be
transferred to the mesh, at the same time giving you the chance to define geometrical drawings or symbols to represent
some conditions on the screen.
Files with extension .cnd contain all the information about the conditions that can be applied to different entities. The
condition can adopt different field values for every entity. This type of information includes, for instance, all the
displacement constraints and applied loads in a structural problem or all the prescribed and initial temperatures in a
thermial analysis.
An important characteristic of the conditions is that they must define what kind of entity they are going to be applied over,
i.e. over points, over lines, over surfaces, over volumes, over layers or over groups, and what kind of mesh entity they will
be transferred over, i.e. over nodes, over face elements or over body elements.
Over nodes This means that the condition will be transferred to the nodes contained in the geometrical entity where
the condition is assigned.
Over face elements ?multiple? If this condition is applied to a line that is the boundary of a surface or to a surface
that is the boundary of a volume, this condition is transferred to the higher elements, marking the affected face. If it is
declared as multiple, it can be transferred to more than one element face (if more than one exists). By default it is
considered as single, and only one element face will be marked.
Over body elements If this condition is applied to lines, it will be transferred to line elements. If assigned to surfaces,
it will be transferred to surface elements. Likewise, if applied to volumes, it will be transferred to volume elements.
Note: For backwards compatibility, the command 'over elements' is also accepted; this will transfer the condition either to
elements or to faces of higher level elements.
Another important feature is that all the conditions can be applied to different entities with different values for all the
defined intervals of the problem.
Therefore, a condition can be considered as a list of fields containing the name of the particular condition, the geometric
entity over which it is applied, the mesh entity over which it will be transferred, its corresponding properties and their
values.
Conditions file (.cnd) 177
CONDITION: condition_name
CONDTYPE: 'over points', 'over lines', 'over surfaces', 'over volumes', 'over layers', 'over groups'
CONDMESHTYPE: 'over nodes', 'over face elements','over face elements multiple', 'over body elements'
GROUPALLOW: points lines surfaces volumes nodes elements faces
QUESTION: field_name['#CB#'(...,optional_value_i,...)]
VALUE: default_field_value['#WIDTH#'(optional_entry_length)]
...
QUESTION: field_name['#CB#'(...,optional_value_i,...)]
VALUE: default_field_value['#WIDTH#'(optional_entry_length)]
END CONDITION
CONDITION: condition_name
...
END CONDITION
Note: CONDTYPE and CONDMESHTYPE are compulsory, and only a kind of type must be set.
Note: GROUPALLOW is only valid for conditions 'over groups' , is an special optional field to restrict allowed categories of
enties of the group to the ones listed (if this field is missing then all kind of entities are allowed). A list of multiple types
could be set.
Note: #CB# means Combo Box.
Note: #WIDTH# means the size of the entry used by the user to enter the value of the condition. Specifies an integer
value indicating the desired width of the entry window, in average-size characters of the widget's font.
Local Axes
QUESTION: field_name['#LA#'('global','automatic','automatic alternative','automatic main')]
VALUE: default_field_value['#WIDTH#'(optional_entry_length)]
This type of field refers to the local axes system to be used. The position of the values indicates the kind of local axes.
If it only has a single default value, this will be the name of the global axes.
If two values are given, the second one will reference a system that will be computed automatically for every node and will
depend on geometric constraints, like whether or not it is tangent, orthogonal, etc.
If a third value is given, it will be the name of the automatic alternative axes, which are the automatic axes rotated 90
degrees.
If a fourth value is given, it will be the name of the automatic main axes, valid only for sufaces using the main curvature
directions. (note that sometimes main curvatures are not well defined, e.g. for a planar surface or a sphere all directions
are main directions, because the curvature is constant)
All the different user-defined systems will automatically be added to these default possibilities.
To enter only a specific kind of local axes it is possible to use the modifiers #G#,#A#,#L#,#M#.
#G#: global axes;
#A#: automatic axes;
#L#: automatic alternative axes.
#M#: main curvature axes
When using these modifiers the position of the values does not indicate the kind of local axes.
Example
QUESTION: Local_Axes#LA#(Option automatic#A#,Option automatic_alt#L#)
VALUE: -Automatic-
Note: All the fields must be filled with words, where a word is considered as a string of characters without any blank
spaces. The strings signaled between quotes are literal and the ones inside brackets are optional. The interface is
case-sensitive, so any uppercase letters must be maintained. The default_field_value entry and various optional_value_i
entries can be alphanumeric, integers or reals. GiD treats them as alphanumeric until the moment they are written to the
solver input files.
Global axes:
X=1 0 0
Y=0 1 0
Z=0 0 1
Conditions file (.cnd) 178
Automatic axes:
For surfaces, this axes are calculated from the unitary normal N:
z'=N
if N is coincident with the global Y direction (Nx or Nz > some tolerance) then
x'=Y x N / |Y x N|
else
x'=Z x N / |Z x N|
y'=N x x'
z'=N
For lines, this axes are calculated from the unitary tangent T:
x'=T
if T is coincident with the global Z direction (Nx or Ny > some tolerance) then
y'=Y x x' / |Y x x'|
else
y'=Z x x' / |Z x x'|
z'=x' x y'
For curves
x'=unitary tangent to the curve on the place where the condition is applied
If this tangent is different of the Z global axe=(0,0,1) then
y'=Y x x'
else
y'=Z x x'
z'=x' x y'
Note: the tangent x' is considered different of (0,0,1) is the first or second component is greater than 1/64
Multiple assign:
By default a condition can be applied only once to the same entity and last assignation replace previous one, but this
behavior can be changed:
One flag that can optionally be added to a condition is:
CANREPEAT: yes
It is written after CONDMESHTYPE and means that one condition can be assigned to the same entity several times.
e.g.
QUESTION: Surface_number#FUNC#(NumEntity)
VALUE: 0
Conditions file (.cnd) 179
In the above example, NumEntity is one of the possible variables of the function. It will be substituted by the label of the
geometrical entity from where the node or element is generated.
In this second example, the x variable is used, which means the x-coordinate of the node or of the center of the element.
Others fields of the condition can also be used in the function. Variables y and z give the y- and z-coordinates of this point.
Note: There are other options available to expand the capabilities of the Conditions window (see Special fields).
1 First, you have to create the folder or directory where all the problem type files are located, problem_type_name.gid in
this case.
2 Then create and edit the file (problem_type_name.cnd in this example) inside the recently created directory (where all
your problem type files are located). As you can see, except for the extension, the names of the file and the directory
are the same.
3 Create the first condition, which starts with the line:
CONDITION: Point-Constraints
The parameter is the name of the condition. A unique condition name is required for this conditions file.
4 This first line is followed by the next pair:
CONDTYPE: over points
CONDMESHTYPE: over nodes
which declare what entity the condition is going to be applied over. The first line, CONDTYPE:... refers to the geometry,
and may take as parameters the sentences "over points", "over lines", "over surfaces" or "over volumes".
The second line refers to the type of condition applied to the mesh, once generated. GiD does not force you to provide
this second parameter, but if it is present, the treatment and evaluation of the problem will be more acurate. The
available parameters for this statement are "over nodes" and "over elements".
5 Next, you have to declare a set of questions and values applied to this condition.
QUESTION: Local-Axes#LA#(-GLOBAL-)
VALUE: -GLOBAL-
QUESTION: X-Force
VALUE: 0.0
QUESTION: X-Constraint:#CB#(1,0)
VALUE: 1
QUESTION: X_axis:#CB#(DEFORMATION_XX,DEFORMATION_XY,DEFORMATION_XZ)
VALUE: DEFORMATION_XX
END CONDITION
After the QUESTION: prompt, you have the choice of putting the following kinds of word:
An alphanumeric field name.
An alphanumeric field name followed by the #LA# statement, and then the single or double parameter.
An alphanumeric field name followed by the #CB# statement, and then the optional values between parentheses.
The VALUE: prompt must be followed by one of the optional values, if you have declared them in the previous
QUESTION: line. If you do not observe this format, the program may not work correctly.
In the previous example, the X-Force QUESTION takes the value 0.0. Also in the example, the X-Constraint QUESTION
includes a Combo Box statement (#CB#), followed by the declaration of the choices 1 and 0. In the next line, the value
takes the parameter 1. The X_axis QUESTION declares three items for the combo box:
DEFORMATION_XX,DEFORMATION_XY,DEFORMATION_XZ, with the value DEFORMATION_XX chosen.
Beware of leaving blank spaces between parameters. If in the first question you put the optional values (-GLOBAL,
-AUTO-) (note the blank space after the comma) there will be an error when reading the file. Take special care in the
Combo Box question parameters, so as to avoid unpredictable parameters.
6 The conditions defined in the .cnd file can be managed in the Conditions window (found in the Data menu) in the
Preprocessing component of GiD.
Example: Creating the conditions file 180
Files with the extension .prb contain all the information about general problem and intervals data. The general problem
data is all the information required for performing the analysis and it does not concern any particular geometrical entity.
This differs from the previous definitions of conditions and materials properties, which are assigned to different entities. An
example of general problem data is the type of solution algorithm used by the solver, the value of the various time steps,
convergence conditions and so on.
Within this data, one may consider the definition of specific problem data (for the whole process) and intervals data
(variable values along the different solution intervals). An interval would be the subdivision of a general problem that
contains its own particular data. Typically, one can define a different load case for every interval or, in dynamic problems,
not only variable loads, but also variation in time steps, convergence conditions and so on.
PROBLEM DATA
QUESTION: field_name['#CB#'(...,optional_value_i,...)]
VALUE: default_field_value
...
QUESTION: field_name['#CB#'(...,optional_value_i,...)]
VALUE: default_field_value
END PROBLEM DATA
INTERVAL DATA
QUESTION: field_name['#CB#'(...,optional_value_i,...)]
VALUE: default_field_value
...
QUESTION: field_name['#CB#'(...,optional_value_i,...)]
VALUE: default_field_value
END INTERVAL DATA
All the fields must be filled with words, where a word is considered as a string of characters without any blank spaces. The
strings signaled between quotes are literal and the ones inside brackets are optional. The interface is case-sensitive, so any
uppercase letters must be maintained. The default_field_value entry and various optional_value_i entries can be
alphanumeric, integers or real numbers, depending on the type.
Note: There are other options available to expand the capabilities of the Problem Data window (see Special fields).
Here is an example of how to create a problem data file, explained step by step:
1 Create and edit the file (problem_type_name.prb in this example) inside the problem_type_name directory (where all
your problem type files are located). Except for the extension, the names of the file and the directory must be the
same.
The first question defines a combo style menu called Unit_System, which has the SI option selected by default. The
second question defines a text field called Title, and its default value is Default_title.
6 The options defined in the .prb file can be managed in the Problem Data window (found in the Data menu) in the
Preprocessing component of GiD.
Files with the extension .mat include the definition of different materials through their properties. These are base materials
as they can be used as templates during the Preprocessing step for the creation of newer ones.
You can define as many materials as you wish, with a variable number of fields. None of the unused materials will be taken
into consideration when writing the data input files for the solver. Alternatively, they can be useful for generating a
materials library.
Conversely to the case of conditions, the same material can be assigned to different levels of geometrical entity (lines,
surfaces or volumes) and can even be assigned directly to the mesh elements.
In a similar way to how a condition is defined, a material can be considered as a group of fields containing its name, its
corresponding properties and their values.
The format of the file is as follows:
MATERIAL: material_name
QUESTION: field_name['#CB#'(...,optional_value_i,...)]
VALUE: default_field_value
...
QUESTION: field_name['#CB#'(...,optional_value_i,...)]
VALUE: default_field_value
END MATERIAL
MATERIAL: material_name
...
END MATERIAL
All the fields must be filled with words, where a word is considered as a string of characters without any blank spaces. The
strings signaled between quotes are literal and the ones within brackets are optional. The interface is case-sensitive, so any
uppercase letters must be maintained. The default_field_value entry and various optional_value_i entries can be
Materials file (.mat) 182
Note: There are other options available to expand the capabilities of the Materials window (see Special fields).
1 Create and edit the file (problem_type_name.mat in this example) inside the problem_type_name directory (where all
your problem type files are located). As you can see, except for the extension, the names of the file and the directory
are the same.
2 Create the first material, which starts with the line:
MATERIAL: Air
The parameter is the name of the material. A unique material name is required for this into this materials file (do not use
blank spaces in the name of the material).
3 The next two lines define a property of the material and its default value:
QUESTION: Density
VALUE: 1.0
You can add as many properties as you wish. To end the material definition, add the following line:
END MATERIAL
4 In this example we have introduced some materials; the .mat file would be as follows:
MATERIAL: Air
QUESTION: Density
VALUE: 1.01
END MATERIAL
MATERIAL: AISI_4340_Steel
QUESTION: YOUNG_(Ex)
VALUE: 21E+9
QUESTION: SHEAR_MODUL
VALUE: 8.07E+9
QUESTION: POISSON_(NUXY)
VALUE: 0.3
QUESTION: ALPX
VALUE: 0.0000066
QUESTION: DENSITY_(DENS)
VALUE: 0.785
END MATERIAL
MATERIAL: Concrete
QUESTION: Density
VALUE: 2350
END MATERIAL
5 The materials defined in the .mat file can be managed in the Materials window (found in the Data menu) in the
Preprocessing component of GiD.
Array fields
Fields of conditions, problem data or materials could store an array of values, and the lenght of this array is not predefined,
could be set at runtime.
For example, if a material has a variable property (an example would be where a property was dependent on temperature
and was defined with several values for several temperatures) a table of changing values may be declared for this
property. When the solver evaluates the problem, it reads the values and applies a suitable property value.
The first is a QUESTION line with a list of alphanumeric values between parentheses.
QUESTION: field_name(column_title_1,...,column_title_n)
These values are the names of each of the columns in the table so that the number of values declared is the number of
columns.
This first line is followed by another with the default data values. It starts with the words VALUE: #N#, and is followed by a
number that indicates the quantity of elements in the matrix and, finally, the list of values.
The number of values m declared for the matrix obviously has to be the number of columns n multiplied by the number of
rows to be filled.
e.g.
MATERIAL: Steel
QUESTION: TypeId
VALUE: Metal
STATE: Hidden
QUESTION: Internal_Points(X,Y,Z)
VALUE: #N# 3 0.0 0.0 0.0
HELP: Internal points coordinates
END MATERIAL
and example writting the values of this material from the .bas template: TEMPLATE FILES
*loop materials
*if(strcmp(Matprop(TypeId),"Metal")==0)
*set var N=Matprop(Internal_Points,int)
X Y Z
*for(i=1;i<=N;i=i+3)
*Matprop(Internal_Points,*i) *Matprop(Internal_Points,*operation(i+1)) *Matprop(Internal_Points,*operati
on(i+2))
*end for
*endif
*end materials
Note that in the example a hidden field named 'TypeId' is used to identify this and its derivated materials.
Aesthetic fields:
These fields are useful for organizing the information within data files. They make the information shown in the data
windows more readable. In this way you can better concentrate on the data properties relevant to the current context.
Book: With the Book field it is possible to split the data windows into other windows. For example, we can have
two windows for the materials, one for the steels and another for the concretes:
BOOK: Steels
...
All steels come here
...
BOOK: Concretes
...
All concretes come here
...
Special fields 184
The same applies to conditions. For general and interval data the book field groups a set of properties.
Title: The Title field groups a set of properties on different tabs of one book. All properties appearing after this
field will be included on this tab.
TITLE: Basic
...
Basics properties
....
TITLE: Advanced
...
Advanced properties
....
Help: With the Help field it is possible to assign a description to the data property preceding it. In this way you
can inspect the meaning of the property through the help context function by holding the cursor over the property
or by right-clicking on it.
QUESTION: X-Constraint#CB#(1,0)
VALUE: 1
HELP: If this flag is set, movement is ...
Special fields 185
Image: The Image field is useful for inserting descriptive pictures in the data window. The value of this field is
the file name of the picture relating to the problem type location.
IMAGE: young.png
Unit field: With this feature it is possible to define and work with properties that have units. GiD is responsible for the
conversion between units of the same magnitude
....
QUESTION: Normal_pressure#UNITS#
VALUE: 0.0Pa
...
Dependencies: Depending on the value, we can define some behavior associated with the property. For each value
we can have a list of actions. The syntax is as follows:
DEPENDENCIES:( <V1>,[ TITLESTATE,<Title>,<State> ],<A1>,<P1>,<NV1>,...,<An>,<Pn>,<NVn> ) ... (
<Vm>,<Am>,<Pm>,<NVm>,... )
where:
1 <Vi> is the value that triggers the actions. A special value is #DEFAULT#, which refers to all the values not
listed.
2 [TITLESTATE,<Title>,<State>] this argument is optional. Titlestate should be used to show or hide book
labels. Many Titlestate entries can be given. <Title> is the title defined for a book (TITLE: Title). State is the
visualization mode: normal or hidden.
3 <Ai> is the action and can have one of these values: SET, HIDE, RESTORE. All these actions change the value of
the property with the following differences: SET disables the property, HIDE hides the property and RESTORE
Special fields 186
State: Defines the state of a field; this state can be: disabled, enabled or hidden. Here is an example:
...
QUESTION: Elastic modulus XX axis
VALUE: 2.1E+11
STATE: HIDDEN
...
#MAT#('BookName'): Defines the field as a material, to be selected from the list of materials in the book
'BookName'. Here is an example:
QUESTION:Composition_Material#MAT#(BaseMat)
VALUE:AISI_4340_STEEL
Material field:
Declare in the tkwidget field to use the Tcl GidUtils::TkwidgetGetMaterialname e.g:
...
QUESTION: your_question
VALUE: your_materialname
TKWIDGET: GidUtils::TkwidgetGetMaterialname
Vector field
To pack in a single line the three components of a vector, internally stored in the same question as a list of three
real numbers, e.g.
...
QUESTION: your_question
VALUE: vx vy vz
TKWIDGET: GidUtils::TkwidgetGetVector3D
Special fields 187
When GiD is installed, the file units.gid is copied within the GiD directory. In this file a table of magnitudes is defined. For
each magnitude there is a set of units and a conversion factor between the unit and the reference unit. The units systems
are also defined. A unit system is a set of mangnitudes and the corresponding unit.
BEGIN TABLE
LENGTH : m, 100 cm, 1e+3 mm
...
STRENGTH : kg*m/s^2, N, 1.0e-1 kp
END
BEGIN SYSTEM(INTERNATIONAL)
LENGTH : m
MASS : kg
STRENGTH : N
...
TEMPERATURE : Cel
END
The syntax of the unit file (problem_type_name.uni) within the problem type is similar. It can include the line:
meaning that the user is able (or not able) to define his own system unit within the project. If the line does not appear in
the file the value is assumed to be ENABLED.
It is possible to ignore all units systems defined by default inside the file units.gid:
With the command HIDDEN: 'magnitude', 'magnitude' certain magnitudes will not be displyed in the Problem units window.
If the problem type uses a property which has a unit, then GiD creates the file project_name.uni in the project directory.
This file includes the information related to the unit used in the geometric model and the unit system used. The structure of
this file is:
MODEL: km
PROBLEM: USER DEFINED
BEGIN SYSTEM
LENGTH: m
PRESSURE: Pa
MASS: kg
STRENGTH: N
END
In this file, MODEL refers to the unit of the geometric and mesh model of preprecess and PROBLEM is the name of the
units system used by GiD to convert all the data properties in the output to the solver. If this name is USER DEFINED,
then the system is the one defined within the file. The block
BEGIN SYSTEM
...
Unit System file (.uni) 188
END
Unit system: It is possible to define more than one 'unit sytem'. When the user select a unit sytem it mean than when
writting to the calculation file the fields with units (material properties, conditions, general data, model length) they will be
written converted to the reference unit of this magnitude for the selected unit system.
The tcl procedure Units::SetUnitsDisallowed allow to specify a list of units to be disallowed (not used in graphical windows)
example
Files with the extension .sim comprise different symbols to represent some conditions during the preprocessing stage. You
can define these symbols by creating ad hoc geometrical drawings and the appropriate symbol will appear over the entity
with the applied condition every time you ask for it.
One or more symbols can be defined for every condition and the selection will depend on the specified values in the file,
which may be obtained through mathematical conditions.
The spatial orientation can also be defined in this file, depending on the values taken by the required data. For global
definitions, you have to input the three components of a vector to express its spatial direction. GiD takes these values from
the corresponding conditions window. The orientation of the vector can be understood as the rotation from the vector
(1,0,0) towards the new vector defined in the file.
For line and surface conditions, the symbols may be considered as local. In this case, GiD does not consider the defined
spatial orientation vector and it takes its values from the line or surface orientation. The orientation assumes the vector
Example: Creating the Symbols file 190
both constraints (&&) - the X-constraint and the Y-constraint - are fixed (their values are not zero).
For the third symbol, obtained from the file Support-2D.geo, only one of them has to be fixed (||) and the orientation of
the symbol will depend on which one is free and which one is fixed, showing on the screen the corresponding direction for
both degrees of freedom.
Finally, for the fourth symbol, onbtained from the file Normal.geo, it can be observed that the drawing of the symbol,
related to the local orientation will appear scaled according to the real-type values of the second, fourth and sixth field
values. Different types of C-language expressions are available in GiD. Thus, the last expression would be equivalent to
entering '(fabs(cond(real,2))>0. || fabs(cond(real,4))!=0. || fabs(cond(real,6))>1e-10)'.
Note: As previously mentioned, GiD internally creates a project_name.geo file when saving a project, where it keeps all
the information about the geometry in binary format. In fact, this is the reason why the extension of these files is .geo.
However, the file project_name.geo is stored in the project_name.gid directory, whereas these user-created ***.geo files
are stored in the problem_type_name.gid directory.
Once you have generated the mesh, and assigned the conditions and the materials properties, as well as the general
problem and intervals data for the solver, it is necessary to produce the data input files to be processed by that program.
To manage this reading, GiD is able to interpret a file called problem_type_name.bas (where problem_type_name is the
name of the working directory of the problem type without the .bas extension).
This file (template file) describes the format and structure of the required data input file for the solver that is used for a
particular case. This file must remain in the problem_type_name.gid directory, as well as the other files already described -
problem_type_name.cnd, problem_type_name.mat, problem_type_name.prb and also problem_type_name.sim and
***.geo, if desired.
In the case that more than one data input file is needed, GiD allows the creation of more files by means of additional
***.bas files (note that while problem_type_name.bas creates a data input file named project_name.dat, successive
***.bas files - where *** can be any name - create files with the names project_name-1.dat, project_name-2.dat, and so
on). The new files follow the same rules as the ones explained next for problem_type_name.bas files.
These files work as an interface from GiD's standard results to the specific data input for any individual solver module. This
means that the process of running the analysis simply forms another step that can be completed within the system.
In the event of an error in the preparation of the data input files, the programmer has only to fix the corresponding
problem_type_name.bas or ***.bas file and rerun the example, without needing to leave GiD, recompile or reassign any
data or re-mesh.
This facility is due to the structure of the template files. They are a group of macros (like an ordinary programming
language) that can be read, without the need of a compiler, every time the corresponding analysis file is to be written. This
ensures a fast way to debug mistakes.
Add
Break
Ndime Nelem Nintervals NLocalAxes Nmats Nnode NodesCoord NodesLayerName NodesLayerNum NodesNum Npoin
Operation
RealFormat Remove
Tcl Time
Units
WarningBox
When writing a command, it is generally not case-sensitive (unless explicitly mentioned), and even a mixture of uppercase
and lowercase will not affect the results.
*npoin, *ndime, *nnode, *nelem, *nmats, *nintervals. These return, respectively, the number of points, the
dimensions of the project being considered, the number of nodes of the element with the highest number, the number
of elements, the number of materials and the number of data intervals. All of them are considered as integers and do
not carry arguments (see *format,*intformat), except *nelem, which can bring different types of elements. These
elements are: Point, Linear, Triangle, Quadrilateral, Tetrahedra, Hexahedra, Prism, Pyramid, Sphere,
depending on the number of edges the element has, and All, which comprises all the possible types. The command
*nmats returns the number of materials effectively assigned to an entity, not all the defined ones.
*GenData. This must carry an argument of integer type that specifies the number of the field to be printed. This
number is the order of the field inside the general data list. This must be one of the values that are fixed for the whole
problem, independently of the interval (see Problem and intervals data file (.prb)). The name of the field, or an
abreviation of it, can also be the argument instead. The arguments REAL or INT, to express the type of number for the
field, are also available (see *format,*intformat,*realformat,*if). If they are not specified, the program will print
a character string. It is mandatory to write one of them within an expression, except for strcmp and strcasecmp. The
numeration must start with the number 1.
Note: Using this command without any argument will print all fields
*IntvData. The only difference between this and the previous command is that the field must be one of those fields
varying with the interval (see Problem and intervals data file (.prb)). This command must be within a loop over
intervals (see *loop) and the program will automatically update the suitable value for each iteration.
Note: Using this command without any argument will print all fields
*MatProp. This is the same as the previous command except that it must be within a loop over the materials (see
*loop). It returns the property whose field number or name is defined by its argument. It is recommended to use
names instead of field numbers.
If the argument is 0, it returns the material's name.
Note: Using this command without any argument will print all fields
Single value return commands 192
Caution: If there are materials with different numbers of fields, you must ensure not to print non-existent fields using
conditionals.
MaterialLocalNum To get the local material number from its global id or its name.
The local material id is the material number for the calculation file, taking into account the materials applied to mesh
elements)
It has a single argument, an integer of the material global number or its name.
Example:
*ElemsMatProp. This is the same as Matprop but uses the material of the current element. It must be within a loop
over the elements (see *loop). It returns the property whose field number or name is defined by its argument. It is
recommended to use names instead of field numbers.
Example:
*loop elements
*elemsnum *elemsmat *elemsmatprop(young)
*end elements
*Cond. The same remarks apply here, although now you have to notify with the command *set (see *set) which is the
condition being processed. It can be within a loop (see *loop) over the different intervals should the conditions vary for
each interval.
Note: Using this command without any argument will print all fields
*CondName. This returns the conditions's name. It must be used in a loop over conditions or after a *set cond
command.
*CondNumFields. This returns the number of fields of the current condition. It must be used in a loop over conditions
or after *set cond
*CondNumEntities. You must have previously selected a condition (see *set cond). This returns the number of
entities that have a condition assigned over them.
All of these commands must be within a proper loop (see *loop) and change automatically for each iteration. They are
considered as integers and cannot carry any argument. The number of materials will be reordered numerically,
beginning with number 1 and increasing up to the number of materials assigned to any entity.
*FaceElemsNum: must be inside a *loop faces, and print the element's number owner of the face
*FaceIndex: must be inside a *loop faces, and print the face index on the element (starting from 1)
The commands *LayerName, *LayerNum and *LayerColorRGB must be inside a loop over layers; you cannot use
these commands in a loop over nodes or elements.
Example:
*loop layers
Single value return commands 193
*LayerName *LayerColorRGB
*Operation(LayerColorRGB(1)/255.0) *Operation(LayerColorRGB(2)/255.0) *Operation(LayerColorRGB(3)/25
5.0)
*end layers
*NodesLayerNum: This returns the layer's number. It must be used in a loop over nodes.
*NodesLayerName: This returns the layer's name. It must be used in a loop over nodes.
*ElemsLayerNum: This returns the layer's number. It must be used in a loop over elems.
*ElemsLayerName: This returns the layer's name. It must be used in a loop over elems.
*LayerNumEntities. You must have previously selected a layer (see *set layer). This returns the number of entities
that are inside this layer.
These commands must be inside a loop over groups, or after set group.
Example:
*loop groups
*groupnum "*GroupFullName" ("*groupname" parent:*groupparentnum) *groupcolorrgb
*set group *GroupName *nodes
*if(GroupNumEntities)
nodes: *GroupNumEntities
*loop nodes *onlyingroup
*nodesnum
*end nodes
*end if
*set group *GroupName *elems
*if(GroupNumEntities)
elements: *GroupNumEntities
*loop elems *onlyingroup
*elemsnum
*end elems
*end if
*set group *GroupName *faces
*if(GroupNumEntities)
faces: *GroupNumEntities
*loop faces *onlyingroup
*faceelemsnum:*faceindex
*end faces
*end if
*end groups
*GroupNumEntities. You must have previously selected a group (see *set group). This returns the number of entities
that are inside this group.
*LoopVar. This command must be inside a loop and it returns, as an integer, what is considered to be the internal
variable of the loop. This variable takes the value 1 in the first iteration and increases by one unit for each new
iteration. The parameter elems,nodes,materials,intervals, used as an argument for the corresponding loop, allows the
program to know which one is being processed. Otherwise, if there are nested loops, the program takes the value of
the inner loop.
*Operation. This returns the result of an arithmetical expression what should be written inside parentheses
immediately after the command. This operation must be defined in C-format and can contain any of the commands
that return one single value. You can force an integer or a real number to be returned by means of the parameters INT
or REAL. Otherwise, GiD returns the type according to the result.
sin
cos
tan
asin
acos
atan
atan2
exp
fabs
abs
pow
sqrt
log
log10
max
min
strcmp
strcasecmp
*operation(4*elemsnum+1)
*operation(8*(loopvar-1)+1)
Note: There cannot be blank spaces between the commands and the parentheses that include the parameters.
*LocalAxesNum. This returns the identification name of the local axes system, either when the loop is over the nodes
or when it is over the elements, under a referenced condition.
*nlocalaxes. This returns the number of the defined local axes system.
*IsQuadratic. This returns the value 1 when the elements are quadratic or 0 when they are not.
*Clock. This returns the number of clock ticks (aprox. milliseconds) of elapsed processor time.
Example:
*Units('magnitude'). This returns the current unit name for the selected magnitude (the current unit is the unit
shown inside the unit window).
Example:
*Units(LENGTH)
*FactorUnit('unit'). This returns the numeric factor to convert a magnitude from the selected unit to the basic unit.
Example:
*FactorUnit(PRESSURE)
*FileId returns a long integer representing the calculaton file, written following the current template.
This value must be used to provide the channel of the calculation file to a tcl procedure to directly print data with the
GiD_File fprintf special Tcl command.
These commands return more than one value in a prescribed order, writing them one after the other. All of them except
LocalAxesDef are able to return one single value when a numerical argument giving the order of the value is added to the
command. In this way, these commands can appear within an expression. Neither LocalAxesDef nor the rest of the
Multiple values return commands 195
commands without the numerical argument can be used inside expressions. Below, a list of the commands with the
appropriate description is displayed.
*NodesCoord. This command writes the node's coordinates. It must be inside a loop (see *loop) over the nodes or
elements. The coordinates are considered as real numbers (see *realformat and *format). It will write two or three
coordinates according to the number of dimensions the problem has (see *Ndime).
If *NodesCoord receives an integer argument (from 1 to 3) inside a loop of nodes, this argument indicates which
coordinate must be written: x, y or z. Inside a loop of nodes:
*NodesCoord writes three or two coordinates depending on how many dimensions there are.
*NodesCoord(1) writes the x coordinate of the actual node of the loop.
*NodesCoord(2) writes the y coordinate of the actual node of the loop.
*NodesCoord(3) writes the z coordinate of the actual node of the loop.
If the argument real is given, the coordinates will be treated as real numbers.
Coordinates:
Node X Y
*loop nodes
*format "%5i%14.5e%14.5e"
*NodesNum *NodesCoord(1,real) *NodesCoord(2,real)
*end nodes
This command effects a rundown of all the nodes in the mesh, listing their identifiers and coordinates (x and y).
Coordinates:
Node X Y
1 -1.28571e+001 -1.92931e+000
2 -1.15611e+001 -2.13549e+000
3 -1.26436e+001 -5.44919e-001
4 -1.06161e+001 -1.08545e+000
5 -1.12029e+001 9.22373e-002
...
*NodesCoord can also be used inside a loop of elements. In this case, it needs an additional argument that gives the
local number of the node inside the element. After this argument it is also possible to give which coordinate has to be
written: x, y or z.
*ElemsConec. This command writes the element's connectivities, i.e. the list of the nodes that belong to the element,
displaying the direction for each case (anti-clockwise direction in 2D, and depending on the standards in 3D). For
shells, the direction must be defined. However, this command accepts the argument swap and this implies that the
ordering of the nodes in quadratic elements will be consecutive instead of hierarchical. The connectivities are
considered as integers (see *intformat and *format).
If *ElemsConec receives an integer argument (begining from 1), this argument indicates which element connectity
must be written:
*loop elems
all conectivities: *elemsconec
first conectivity *elemsconec(1)
*end elems
Note: In the first versions of GiD, the optional parameter of the last command explained was invert instead of swap,
as it is now. It was changed due to technical reasons. If you have an old .bas file prior to this specification, which
contains this command in its previous form, when you try to export the calculation file, you will be warned about this
change of use. Be aware that the output file will not be created as you expect.
*GlobalNodes. This command returns the nodes that belong to an element's face where a condition has been defined
(on the loop over the elements). The direction for this is the same as for that of the element's connectivities. The
Multiple values return commands 196
returned values are considered as integers (see *intformat and *format).If *GlobalNodes receives an integer
argument (beginning from 1), this argument indicates which face connectity must be written.
So, the local numeration of the faces is:
*LocalNodes. The only difference between this and the previous one is that the returned value is the local node's
numbering for the corresponding element (between 1 and nnode).
*CondElemFace. This command return the number of face of the element where a condition has been defined
(beginning from 1). The information is equivalent to the obtained with the localnodes command
*ElemsNnode. This command returns the number of nodes of the current element (valid only inside a loop over
elements).
Example:
*loop elems
*ElemsNnode
*end elems
*ElemsNnodeCurt. This command returns the number of vertex nodes of the current element (valid only inside a loop
over elements). For example, for a quadrilateral of 4, 8 or 9 nodes, it returns the value 4.
*ElemsNNodeFace. This command returns the number of face nodes of the current element face (valid only inside a
loop over elements onlyincond, with a previous *set cond of a condition defined over face elements).
Example:
*loop elems
*ElemsNnodeFace
*end elems
*ElemsNNodeFaceCurt. This command returns the short (corner nodes only) number of face nodes of the current
element face (valid only inside a loop over elements onlyincond, with a previous *set cond of a condition defined over
face elements).
Example:
*loop elems
*ElemsNnodeFaceCurt
*end elems
*ElemsType: This returns the current element type as a integer value: 1=Linear, 2=Triangle, 3=Quadrilateral,
4=Tetrahedra, 5=Hexahedra, 6=Prism, 7=Point,8=Pyramid,9=Sphere,10=Circle. (Valid only inside a loop over
elements.)
*ElemsTypeName: This returns the current element type as a string value: Linear, Triangle, Quadrilateral,
Tetrahedra, Hexahedra, Prism, Point, Pyramid, Sphere, Circle. (Valid only inside a loop over elements.)
*ElemsCenter: This returns the element center. (Valid only inside a loop over elements.)
Note: This command is only available in GiD version 9 or later.
*ElemsRadius: This returns the element radius. (Valid only inside a loop over sphere or Circle elements.)
Note: This command is only available in GiD version 8.1.1b or later.
Multiple values return commands 197
*ElemsNormal. This command writes the normal's coordinates. It must be inside a loop (see *loop) over elements,
and it is only defined for triangles, quadrilaterals, and circles (and also for lines in 2D cases).
If *ElemsNormal receives an integer argument (from 1 to 3) this argument indicates which coordinate of the normal
must be written: x, y or z.
*LocalAxesDef. This command returns the nine numbers that define the transformation matrix of a vector from the
local axes system to the global one.
Example:
*loop localaxes
*format "%10.4lg %10.4lg %10.4lg"
x'=*LocalAxesDef(1) *LocalAxesDef(4) *LocalAxesDef(7)
*format "%10.4lg %10.4lg %10.4lg"
y'=*LocalAxesDef(2) *LocalAxesDef(5) *LocalAxesDef(8)
*format "%10.4lg %10.4lg %10.4lg"
z'=*LocalAxesDef(3) *LocalAxesDef(6) *LocalAxesDef(9)
*end localaxes
*LocalAxesDef(EulerAngles). This is as the last command, only with the EulerAngles option. It returns three
numbers that are the 3 Euler angles (radians) that define a local axes system
How to calculate X[3] Y[3] Z[3] orthonormal vector axes from three euler angles angles[3]
Z[0]= sinC*sinB
Z[1]= cosC*sinB
Z[2]= cosB
where
cosA=cos(angles[0])
sinA=sin(angles[0])
cosB=cos(angles[1])
sinB=sin(angles[1])
cosC=cos(angles[2])
sinC=sin(angles[2])
How to calculate euler angles angles[3] from X[3] Y[3] Z[3] orthonormal vector axes
*LocalAxesDefCenter. This command returns the origin of coordinates of the local axes as defined by the user. The
"Automatic" local axes do not have a center, so the point (0,0,0) is returned. The index of the coordinate (from 1 to 3)
can optionally be given to LocalAxesDefCenter to get the x, y or z value.
Example:
*LocalAxesDefCenter
Multiple values return commands 198
*\ To avoid line-feeding you need to write *\, so that the line currently being used continues on the following line of the
file filename.bas.
*# If this is placed at the beginning of the line, it is considered as a comment and therefore is not written.
** In order for an asterisk symbol to appear in the text, two asterisks ** must be written.
*Include. The include command allows you to include the contents of a slave file inside a master .bas file, setting a
relative path from the Problem Type directory to this secondary file.
Example:
*include includes\execntrlmi.h
Note: The *.bas extension cannot be used for the slave file to avoid multiple output files.
*MessageBox. This command stops the execution of the .bas file and prints a message in a window; this command
should only be used when a fatal error occurs.
Example:
*MessageBox error: Quadrilateral elements are not permitted.
*WarningBox. This is the same as MessageBox, but the execution is not stopped.
Example:
WarningBox Warning: Exist Bad elements. A STL file is a collection of triangles bounding a volume.
The following commands must be written at the beginning of a line and the rest of the line will serve as their modifiers. No
additional text should be written.
*loop, *end, *break. These are declared for the use of loops. A loop begins with a line that starts with *loop (none of
these commands is case-sensitive) and contains another word to express the variable of the loop. There are some lines
in the middle that will be repeated depending on the values of the variable, and whose parameters will keep on
changing throughout the iterations if necessary. Finally, a loop will end with a line that finishes with *end. After *end,
you may write any kind of comments in the same line. The command *break inside a *loop or *for block, will finish
the execution of the loop and will continue after the *end line.
The variables that are available for *loop are the following:
elems, nodes, faces, materials, conditions, layers, groups, intervals, localaxes. These commands mean,
respectively, that the loop will iterate over the elements, nodes, faces of a group, materials, conditions, layers,
groups, intervals or local axes systems. The loops can be nested among them. The loop over the materials will
iterate only over the effectively assigned materials to an entity, in spite of the fact that more materials have been
defined. The number of the materials will begin with the number 1. If a command that depends on the loop is
located outside it, the number will also take by default the value 1.
- If the variable is material you can include the modifier *NotUsed to make a loop over those materials that are
defined but not used.
- If the variable is conditions you must include one of the modifiers: *Nodes, *BodyElements,
Specific commands 200
*end conditions
*end intervals
This do a loop for each interval, and for each condition defined 'over groups' list the groups where the condition was
applied and its values.
*if, *else, *elseif, *endif. These commands create the conditionals. The format is a line which begins with *if
followed by an expression between parenthesis. This expression will be written in C-language syntax, value return
commands, will not begin with *, and its variables must be defined as integers or real numbers (see *format,
*intformat, *realformat), with the exception of strcmp and strcasecmp. It can include relational as well as arithmetic
operators inside the expressions.
*if((fabs(loopvar)/4)<1.e+2)
*if((p3<p2)||p4)
*if((strcasecmp(cond(1),"XLoad")==0)&&(cond(2)!=0))
The first example is a numerical example where the condition is satisfied for the values of the loop under 400, while
the other two are logical operators; in the first of these two, the condition is satisfied when p3<p2 or p4 is different
from 0, and in the second, when the first field of the condition is called XLoad (with this particular writing) and the
second is not null.
If the checked condition is true, GiD will write all the lines until it finds the corresponding *else, *elseif or *endif (*end
is equivalent to *endif after *if). *else or *elseif are optional and require the writing of all the lines until the
corresponding *endif, but only when the condition given by *if is false. If either *else or *elseif is present, it must be
written between *if and *endif. The conditionals can be nested among them.
The behaviour of *elseif is identical to the behaviour of *else with the addition of a new condition:
*if(GenData(31,int)==1)
...(1)
*elseif(GenData(31,int)==2)
...(2)
*else
...(3)
*endif
In the previous example, the body of the first condition (written as 1) will be written to the data file if GenData(31,int)
is 1, the body of the second condition (written as 2) will be written to the data file if GenData(31,int) is 2, and if
neither of these is true, the body of the third condition (written as 3) will be written to the data file.Note: A conditional
can also be written in the middle of a line. To do this, begin another line and write the conditional by means of the
command *\.
*for, *end, *break. The syntax of this command is equivalent to *for in C-language.
*for(varname=expr.1;varname<=expr.2;varname=varname+1)
*end for
The meaning of this statement is the execution of a controlled loop, since varname is equal to expr.1 until it is equal to
expr.2, with the value increasing by 1 for each step. varname is any name and expr.1 and expr.2 are arithmetical
expressions or numbers whose only restrictions are to express the range of the loop.
The command *break inside a *loop or *for block, will finish the execution of the loop and will continue after the
*end line.
Example:
*for(i=1;i<=5;i=i+1)
variable i=*i
*end for
It is not necessary to write these commands in lowercase, so *Set will also be valid in all the examples.
*set cond.: In the case of the conditions, GiD allows the combination of a group of them via the use of *add cond.
When a specific condition is about to be used, it must first be defined, and then this definition will be used until another
is defined. If this feature is performed inside a loop over intervals, the corresponding entities will be chosen. Otherwise,
the entities will be those referred to in the first interval.
It is done in this way because when you indicate to the program that a condition is going to be used, GiD creates a
table that lets you know the number of entities over which this condition has been applied. It is necessary to specify
whether the condition takes place over the *nodes, over the *elems or over *layers to create the table.
So, a first example to check the nodes where displacement constraints exist could be:
*Set Cond Volu-Cstrt *nodes
*Add Cond Surf-Cstrt *nodes
*Add Cond Line-Cstrt *nodes
*Add Cond Poin-Cstrt *nodes
These let you apply the conditions directly over any geometric entity.
Example 1:
Example 2:
*loop layers
*set Layer *LayerName *elems
*loop elems *OnlyInLayer
Nº:*ElemsNum Name of Layer:*ElemsLayerName Nº of Layer :*ElemsLayerNum
*end elems
*end layers
In this example the command *LayerName is used to get the layer name.
There are some modifiers available to point out particular specifications of the conditions.
If the command *CanRepeat is added after *nodes or *elems in *Set cond, one entity can appear several times in the
entities list. If the command *NoCanRepeat is used, entities will appear only once in the list. By default, *CanRepeat is
off except where one condition has the *CanRepeat flag already set.
A typical case where you would not use *CanRepeat might be:
In this case, when two lines share one endpoint, instead of two nodes in the list, only one is written.
In this case, if one triangle of a quadrilateral has more than one face in the marked boundary then we want this
element to appear several times in the elements list, once for each face.
Other modifiers are used to inform the program that there are nodes or elements that can satisfy a condition more
Specific commands 202
than once (for instance, a node that belongs to a certain number of lines with different prescribed movements) and
that have to appear unrepeated in the data input file, or, in the opposite case, that have to appear only if they satisfy
more than one condition. These requirements are achieved with the commands *or(i,type) and *and(i,type),
respectively, after the input of the condition, where i is the number of the condition to be considered and type is the
type of the variable (integer or real).
For the previous example there can be nodes or elements in the intersection of two lines or maybe belonging to
different entities where the same condition had been applied. To avoid the repetition of these nodes or elements, GiD
has the modifier *or, and in the case where two or more different values were applied over a node or element, GiD
only would consider one, this value being different from zero. The reason for this can be easily understood by looking
at the following example. Considering the previous commands transformed as:
where *or(1,int) means the assignment of that node to the considered ones satisfying the condition if the integer value
of the first condition's field is different from zero, and (*or(2,int) means the same assignment if the integer value of
the second condition's field is different from zero). Let us imagine that a zero in the first field implies a restricted
movement in the direction of the X-axis and a zero in the second field implies a restricted movement in the direction of
the Y-axis. If a point belongs to an entity whose movement in the direction of the X-axis is constrained, but whose
movement in the direction of the Y-axis is released and at the same time to an entity whose movement in the direction
of the Y-axis is constrained, but whose movement in the direction of the X-axis is released, GiD will join both conditions
at that point, appearing as a fixed point in both directions and as a node satisfying the four expressed conditions that
would be counted only once.
The same considerations explained for adding conditions through the use of *add cond apply to elements, the only
difference being that the command is *add elems. Moreover, it can sometimes be useful to remove sets of elements
from the ones assigned to the specific conditions. This can be done with the command *remove elems. So, for
instance, GiD allows combinations of the type:
To indicate that all dummy elements apart from the linear ones will be considered, as well as:
The format for *set var differs from the syntax for the other two *set commands. Its syntax is as follows:
*intformat, *realformat,*format. These commands explain how the output of different mathematical expressions
will be written to the analysis file. The use of this command consists of a line which begins with the corresponding
version, *intformat, *realformat or *format (again, these are not case-sensitive), and continues with the desired
writing format, expressed in C-language syntax argument, between double quotes (").
Specific commands 203
The integer definition of *intformat and the real number definition of *realformat remain unchanged until another
definition is provided via *intformat and *realformat, respectively. The argument of these two commands is composed
of a unique field. This is the reason why the *intformat and *realformat commands are usually invoked in the initial
stages of the .bas file, to set the format configuration of the integer or real numbers to be output during the rest of the
process.
The *format command can include several field definitions in its argument, mixing integer and real definitions, but it
will only affect the line that follows the command's instance one. Hence, the *format command is typically used when
outputting a listing, to set a temporary configuration.
In the paragraphs that follow, there is an explanation of the C format specification, which refers to the field
specifications to be included in the arguments of these commands. Keep in mind that the type of argument that the
*format command expects may be composed of several fields, and the *intformat and *realformat commands'
arguments are composed of an unique field, declared as integer and real, respectively, all inside double quotes:
A format specification, which consists of optional and required fields, has the following form:
%[flags][width][.precision]typeThe start of a field is signaled by the percentage symbol (%). Each field
specification is composed of: some flags, the minimum width, a separator point, the level of precision of the field, and
a letter which specifies the type of the data to be represented. The field type is the only one required.
The most usual representations are integers and floats. For integers the letters d and i are available, which force the
data to be read as signed decimal integers, and u for unsigned decimal integers.
For floating point representation, there are the letters e, f and g, these being followed by a decimal point to separate
the minimum width of the number from the figure giving the level of precision.The number of digits after the decimal
point depends on the requested level of precision.
Note: The standard width specification never causes a value to be truncated. A special command exists in GiD:
*SetFormatForceWidth, which enables this truncation to a prescribed number of digits.
For string representations, the letter s must be used. Characters are printed until the precision value is reached.
*Intformat "%5i"
With this sentence, usually located at the start of the file, the output of an integer quantity is forced to be right aligned
on the fifth column of the text format on the right side. If the number of digits exceeds five, the representation of the
number is not truncated.
*Realformat "%10.3e"
This sentence, which is also frequently located in the first lines of the template file, sets the output format for the real
numbers as exponential with a minimum of ten digits, and three digits after the decimal point.
*format "%10i%10.3e%10i%15.6e"
This complex command will specify a multiple assignment of formats to some output columns. These columns are
generated with the line command that will follow the format line. The subsequent lines will not use this format, and will
follow the general settings of the template file or the general formats: *IntFormat, *RealFormat.
*SetFormatForceWidth, *SetFormatStandard The default width specification of a "C/C+" format, never causes a
value to be truncated.
*SetFormatForceWidth is a special command that allows a figure to be truncated if the number of characters to print
exceeds the specified width.
For example:
*SetFormatForceWidth
*set var num=-31415.16789
*format "%8.3f"
*num
*SetFormatStandard
*format "%8.3f"
*num
Output:
-31415.1
-31415.168
The first number is truncated to 8 digits, but the second number, printed with "C" standard, has 3 numbers after the
decimal point, but more than 8 digits.
*Tcl This command allows information to be printed using the Tcl extension language. The argument of this command
must be a valid Tcl command or expression which must return the string that will be printed. Typically, the Tcl
command is defined in the Tcl file (.tcl , see TCL AND TK EXTENSION -pag. 91- for details).
Example: In this example the *Tcl command is used to call a Tcl function defined in the problem type .tcl file. That
function can receive a variable value as its argument with *variable. It is also possible to assign the returned value to a
variable, but the Tcl procedure must return a numerical value.
proc MultiplyByTwo { x } {
return [expr {$x*2}]
}
All the rules that apply to filename.bas files are also valid for other files with the .bas extension. Thus, everything in this
section will refer explicitly to the file filename.bas. Any information written to this file, apart from the commands given, is
reproduced exactly in the output file (the data input file for the numerical solver). The commands are words that begin with
the character *. (If you want to write an asterisk in the file you should write **.) The commands are inserted among the
text to be literally translated. Every one of these commands returns one (see Single value return commands) or multiple
(see Multiple values return commands) values obtained from the preprocessing component. Other commands mimic the
traditional structures to do loops or conditionals (see Specific commands). It is also possible to create variables to manage
some data. Comparing it to a classic programming language, the main differences will be the following:
The text is reproduced literally, without printing instructions, as it is write-oriented.
There are no indices in the loops. When the program begins a loop, it already knows the number of iterations to
perform. Furthermore, the inner variables of the loop change their values automatically. All the commands can be
divided into three types:
Commands that return one single value. This value can be an integer, a real number or a string. The value
depends on certain values that are available to the command and on the position of the command within the loop
or after setting some other parameters. These commands can be inserted within the text and write their value
where it corresponds. They can also appear inside an expression, which would be the example of the conditionals.
For this example, you can specify the type of the variable, integer or real, except when using strcmp or
strcasecmp. If these commands are within an expression, no * should precede the command.
Commands that return more than one value. Their use is similar to that of the previously indicated commands,
except for the fact that they cannot be used in other expressions. They can return different values, one after the
other, depending on some values of the project.
Commands that perform loops or conditionals, create new variables, or define some specifications. The latter
Detailed example 215
This window gives information about the location, materials and conditions of the problem type. The window has two
buttons: CONTINUE lets you continue working with the cmas2d problem type; RANDOM SURFACE creates a random 2D
surface in the plane XY.
What follows is the Tcl code for the example. There are three main procedures in the cmas2d.tcl file:
This procedure creates the window with information about the path, the materials and the conditions of the project.
The window has two buttons: if CONTINUE is pressed the window is dismissed; if RANDOM SURFACE is pressed, it
calls the CreateRandomSurface procedure.
"Cancel"]]
if {$ret ==0} {
Create_surface
destroy $w
}
}
This procedure is called when the RANDOM SURFACE button is pressed. Before creating the surface, a dialog box
asks you to continue with or cancel the creation of the surface. If the surface is to be created, the
Create_surface procedure is called. Then, the window is destroyed.
proc Create_surface {} {
set a_x [expr rand()*10]
set a_y [expr rand()*10]
set b_x [expr $a_x + rand()*10]
set b_y [expr $a_y + rand()*10]
set c_x [expr $b_x + rand()*10]
set c_y [expr $b_y - rand()*10]
if {$a_y < $c_y} {
set d_y [expr $a_y - rand()*10]
set d_x [expr $a_x + rand()*10]
} else {
set d_y [expr $c_y - rand()*10]
set d_x [expr $c_x - rand()*10]
}
GiD_Process escape escape escape geometry create line \
$a_x,$a_y,0.000000 $b_x,$b_y,0.000000 $c_x,$c_y,0.000000 $d_x,$d_y,0.000000 close
GiD_Process escape escape escape escape geometry create NurbsSurface Automatic \
4 escape
GiD_Process 'Zoom Frame escape escape escape escape
}
A 2D surface (a four-sided 2D polygon) is created. The points of this surface are chosen at random.