0% found this document useful (0 votes)
273 views225 pages

GiD 15 Customization Manual

Uploaded by

Han Lee
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
273 views225 pages

GiD 15 Customization Manual

Uploaded by

Han Lee
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 225

GiD

The universal, adaptative and user


friendly pre and postprocessing
system for computer analysis
in science and engineering

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.

The customization in GiD is done by creating a Problem Type.


3

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)

Compulsory nodes: (the values of these nodes are just examples)


<Name>cmas2d_customlib</Name> to provide an identifier name for the problem type.
<Version>1.0</Version> dotted version number of the problem type.

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'.

It is possible to set other non-standard nodes, to use

3.1 ValidatePassword node

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... }

The script should return one of three possible codes:


7

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.

4.1 Structure of the problem type

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.

File extension Description


name_default.spd Main configuration file of the data tree, XML-based.
name.bas Information for data input file. It should be an empty file
name.tcl Main TCL file, initialization
name.cnd Conditions definition. It should not be modified by the user
scripts/*.tcl Output description to the file of analysis

Main configuration file of the data tree, XML-based.


The main configuration file in XML format contains the definition of all the data (except the geometry) necessary to
perform an analysis. It is defined in XML format with the extension .spd (specific problem type data) and contains all
the definition of all the data that defines the analysis like boundary conditions, loads, materials, loadcases, etc.
The syntax rules of the .spd file are very simple, logical, concise, easy to learn and to use. The file is human-legible,
clear and easy to create. Moreover, the information is stored in plain text format. It can be viewed in all major of
browsers, and it is designed to be self-descriptive.
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 allows to aggregate efficiently elements. CustomLib takes
advantage of this hierarchical structure to convert automatically the main XML file to a physical tree on the GiD
window. The XML elements can have attributes, which provide additional information about elements.
It is necessary to modify this XML document in order to add conditions, or general data to the problem type.

Main TCL file, initialization


A TCL initialization file is used to create complex windows or menus. Contains the initialization routines
Structure of the problem type 8

Output description to the file of analysis


A TCL file located in the <scripts> folder determines the way in which the final information has to be written inside the
input files that will be read by the solver.

Conditions file
File with extension .cnd is used but should not be modified by the problemtype creator.

Information for data input file


File .bas is not used it should be existing but void.

Several other TCL files

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.

4.3 Data tree fields

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.

e.g. if the problemtype is named 'cmas2d_customlib' the main node will be

<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

pn - Label that will be visualized by the user. It can be translated.


icon - It allows to put an image in .png format in the data tree. The image should be stored inside the images folder of the
problem type.
help - It displays a pop-up window of help information related to the task the user is performing.
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.
update_proc - It calls a TCL procedure, when clicking on the 'Ok' button in the window. Square brackets are not
supported.
actualize_tree - Itupdates the information in the whole data tree, and automatically refresh data shown in the user
interface. It is a boolean value as a 1 or 0 that indicates if it is activated or deactivated. If the data source is changed, such
as new fields have been added or data values and field have been modified, all the user interface will reflect those changes.
Furthermore, all the TCL procedures defined in the data tree will be called and the whole data tree will be refreshed.
Therefore, this instruction must be carried out only when necessary.
actualize - This only updates a specified field in data tree. Note that only this specified field will be refreshed in the user
interface, and not the whole data tree. It is a boolean value as a 1 or 0 that indicates if it is activated or deactivated.
del_cancel_button - It is a boolean value as a 1 or 0 that indicates if the cancel button is removed (1) or not (0). On the
resulting window there will be only the 'OK' button, as follows,

Fields to allow customize tree contextual menu:


addcontextualmenu -To add a new option to the menu. Expects a Tcl list of items, each item with subitems "icon text
tcl_command"
replacecontextualmenu -To replace a menu option. Expects a Tcl list of items, each item with subitems "old_text icon
text tcl_command"
removecontextualmenu -To remove a menu options. Expects a Tcl list of items, each item with subitems "old_text"

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>

Example: (customize contextual menu)


<blockdata n="Simulation_type" pn="Simulation data" icon="[icon_simtype]"
addcontextualmenu="{advanced-16 {Add option 1} CompassFEM::Test} {advanced-16 {Add option 2}
CompassFEM::Test}" replacecontextualmenu="{{Edit} advanced-16 {Edit mod.} CompassFEM::Test} {{View this}
advanced-16 {View this mod.} CompassFEM::Test_mod}"removecontextualmenu="{View this} {Edit}"</blockdata>

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)

There are Tcl predefined procedures to facilitate drawing with OpenGL:

gid_groups_conds::import_gid_mesh_as_openGL <filename> <color_lines> <color_surfaces>


To automatically import a GiD mesh file to be drawn with OpenGL.
The filename to be read must be a GiD ASCII mesh of lines, triangles and quadrilaterals (with as few elements as as
possible). This mesh could be exported from the menu Files->Export->GiD mesh. The procedure read the mesh and
invoke GiD_OpenGL draw commands.
The mesh must represent a normalized shape, centered at the origin and contained in a box of size 1 for every of its
dimensions (a 2x2x2 cube)
gid_groups_conds::draw_symbol_image <image> <values_list>
To automatically import in image file to be drawn with OpenGL.
The image must use some valid image format (png, gif, jpg,...), and is expected to be inside a folder named /images of
the problemtype
The values_list argument is currently not used.
symbol 13

gid_groups_conds::draw_symbol_text <txt> <values_list>


To automatically print a text with OpenGL.
The values_list argument is currently not used.

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:

proc Cmas2d::DrawSymbolWeight { values_list } {


variable _opengl_draw_list
if { ![info exists _opengl_draw_list(weight)] } {
set _opengl_draw_list(weight) [GiD_OpenGL draw -genlists 1]
GiD_OpenGL draw -newlist $_opengl_draw_list(weight) compile
set filename_mesh [file join [Cmas2d::GetDir] symbols weight_2d.msh]
gid_groups_conds::import_gid_mesh_as_openGL $filename_mesh black blue
GiD_OpenGL draw -endlist
}
set weight_and_unit [lrange [lindex $values_list [lsearch -index 0 $values_list Weight]] 1 2]
set weight [lindex $weight_and_unit 0]
set scale [expr {$weight*0.1}]
set transform_matrix [list $scale 0 0 0 0 $scale 0 0 0 0 $scale 0 0 0 0 1]
set list_id [GiD_OpenGL draw -genlists 1]
GiD_OpenGL draw -newlist $list_id compile
GiD_OpenGL draw -pushmatrix -multmatrix $transform_matrix
GiD_OpenGL draw -call $_opengl_draw_list(weight)
GiD_OpenGL draw -popmatrix
GiD_OpenGL draw -endlist
return $list_id
}

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

It permits to create or edit a function defined by points for a determined field.


e.g. for a property variable with the temperature.

It can contain the following fields: <functionVariable>

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.

proc MyDensityFunction { domNode args } {


set result [join [list scalar [list interpolator_func x x Temp]] ,]
return $result
}

The proc referenced by the 'function' must return as value something like this:
scalar,interpolator_func x x Temp

where scalar is a keyword,


interpolator_func is the same name used in <functionVariable n="interpolator_func" ...
x is the same variable name used in <functionVariable ... variable="x" ...
Temp is the magnitude accoding to the units used in <functionVariable ... units="°C">

The graphical interface will show something like this

and pressing the rigth button will open a window to edit the xy graph:
functionVariable 17

Interpolation function window

4.3.1.11 Annex I: Using functions

The following section is of purely practical nature. It contains examples of the most common functions from the areas
CustomLib deals with.

Example no. 1: Using functions based on Interpolated Data


The linear interpolation uses two or more pairs of input data points that approximate a function. To define functions based
on interpolated data, use the function dialog box, which can be opened from the data tree automatically clicking on the
button Σ as follows,

An example of the <value/> node field in the .spd file is the following:

<value n="disc_load" pn="Discrete load" min_two_pnts="1" single_value="1" function="[loads_function_time]"


function_func="" state="normal" v="1.0">
<function>
<functionVariable n="interpolator_func" pn="Interpolation function" variable="x" units="s">
<value n="point" pn="Point" v="0.0,0.0"/>
<value n="point" pn="Point" v="10.0,1.0"/>
<value n="point" pn="Point" v="1.0e9,1.0"/>
</functionVariable>
</function>
</value>

<proc n="loads_function_time" args="">


return [cmas2d_CustomLIB::chk_loads_function_time $domNode]
</proc>

proc cmas2d_CustomLIB::chk_loads_function_time { domNode } {


set loads [list [list scalar]]
lappend loads [list interpolator_func x x T]
return [join $loads ,]
}

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

if { $m ne "-" } { set e $f1.sw$idx.e } else { set e $f1.sw$idx }


tk::TabToWindow $e
error [= "Value %s is not OK" $pn]
}
incr idx
}
set xp {functionVariable[@variable="t"]}
if { [$funcNode selectNodes $xp] eq "" } {
set fvarNode [$funcNode appendChildTag functionVariable]
} else {
set fvarNode [$funcNode selectNodes $xp]
foreach i [$fvarNode childNodes] { $i delete }
}
$fvarNode setAttribute n sinusoidal_load pn [= "Sinusoidal load"] \
variable "t"
foreach i [list amplitude circular_frequency phase_angle initial_time end_time] \
pn [list [= "Amplitude (%s)" A] \
[= "Frequency (%s)" f] [= "Phase angle (%s)" \u3a6] \
[= "Initial time (%s)" t0] [= "End time (%s)" t1]] \
m [list - Frequency Rotation T T] {

set v [$fvarNode appendChildTag value [list attributes() \


n $i pn $pn v $ProblemTypePriv($i)]]
if { $m ne "-" } {
set newunits [gid_groups_conds::nice_units_to_units \
$ProblemTypePriv(${i}_units)]
$v setAttribute unit_magnitude $m \
units $newunits
}
}
}
}
}

Example no. 3: Editable multiline text for entering mathematical expressions


The following example allows to enter a numerical or math expression, such as a formula, into an editable multiline text
box. CustomLib will display automatically the resulting math expression in the data tree. Moreover, the user will be able to
overwrite this expression with a different formula using Ramdebugger editor. The 'Edit' button opens Ramdebugger, the
graphical debugger for the scripting lenguage Tcl-Tk.

Editable multiline text box called 'TCL code' and


'Edit' button.
Annex I: Using functions 23

It is possible to create and modify the function inside


Ramdebugger editor. The TCL-TK source code is colorized and
supports automatic indentation.

The <condition/> node field in the .spd file is as follows,

<condition n="custom_constraints" pn="Custom constraints" ov="point,line,surface,volume" state="normal"


ov_default="surface" ovm="" help="A constraint defined by using the TCL extension language">
<dependencies node="value[@n='over_what']" att1="v" v1="node" att2="state" v2="disabled"
condition="@ov='point'"/>
<dependencies node="value[@n='over_what']" att1="state" v1="normal" condition="@ov='line' or @ov='surface' or
@ov='volume'"/>
<value n="units" pn="Units set" v="N-m-kg" values="N-m-kg,N-cm-kg,N-mm-kg"/>
<value n="tcl_code" pn="TCL code" v="" fieldtype="long text"/>
<value n="over_what" pn="Over" v="node" values="node,element" dict="node,node,element,element" editable="0"
help="Condition will be applied to either over every selected element or every selected node"/>
<edit_command n="edit_custom_data" pn="Edit" proc="edit_custom_data constraints" edit_type="callback"/>
</condition>

<proc n="edit_custom_data" args="custom_type callback">


custom_data_edit $domNode $dict $custom_type $callback
</proc>

proc custom_data_edit { domNode dict custom_type callback } {

if { ![interp exists ramdebugger] } { interp create ramdebugger }


ramdebugger eval [list set argv [list -noprefs -rgeometry 600x500+300+300 \
-onlytext]]
package require RamDebugger

if { [dict exists $dict tcl_code] } {


set data [string trim [dict get $dict tcl_code]]
} else {
set xp {string(value[@n="tcl_code"]/@v)}
set data [string trim [$domNode selectNodes $xp]]
}
if { $data eq "" } {
set data [format "# %s # %s " [= "Enter TCL code to define a load"] \
[= "Use menu 'Custom data' for help"]]
}
Annex I: Using functions 25

$t insert insert "("


$t insert insert [string repeat , %NARGS%]
$t insert insert ")"
$t mark set insert "insert-[expr {%NARGS%+1}]c"
}
set cmd [string map [list %N% $n %NARGS% $nargs] \
$cmd]
lappend menu [list command $name "" "" "" -command $cmd]
}
lappend menu [list separator]

foreach "n nfull" [list \


add_to_load_vector "add_to_load_vector ?-substitute? ?-local? nodenum loadvector" \
addload "addload ?-local? pressure|triangular_pressure|punctual_load args"] {
set name [= "Insert command '%s'" $n]
set cmd {
$::RamDebugger::text insert insert [list %NFULL%]
}
set cmd [string map [list %NFULL% $nfull] $cmd]
lappend menu [list command $name "" "" "" -command $cmd]
}
switch $custom_type {
constraints { set title [= "Constraints data"] }
properties { set title [= "Properties data"] }
loads { set title [= "Loads data"] }
default { set title [= "Custom data"] }
}
ramdebugger eval [list RamDebugger::AddCustomFileTypeMenu $title $menu]
}

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. Σ).

Example of equation defined on a field of the data tree using


a Function Editor window

This will open the Function Editor window and load the current expression into it, which can be empty.

The <value/> node field in the .spd file is as follows,

<value n="Density" pn="Density" v="" unit_magnitude="M/L^3" units="kg/m^3" help="Density of the fluid"


function="[loads_function editor]" pn_function="Density" function_func="function_loads"/>

proc function_loads { ftype what n pn frame domNode funcNode \


units_var ov_var } {
switch $ftype {
editor {
return [function_editor $what $n $pn $frame $domNode \
$funcNode $units_var $ov_var]
}
}
}

proc function_editor { what n pn f domNode funcNode \


units_var ov_var } {
Annex I: Using functions 26

# Create your own child window implemented in Tcl/Tk.


}

<proc n="loads_function" args="load_name">


return [chk_loads_function $domNode $load_name]
</proc>

proc chk_loads_function { domNode load_name } {


set loads [list [list scalar]]
if { [lsearch "editor" $load_name] != -1 } {
lappend loads [list editor ""]
return [join $loads ,]
}
return [join $loads ,]
}

4.3.1.12 Annex II: Using matrices

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.

Matrix editor window allows to edit the contents of a square matrix

The <value/> node field in the .spd file is the following:

<value n="nu" pn="nu" function="matrix_func,scalar" dimension_function="3" state="normal" symmetric_function="0"


has_diag="0" components_function="x,y,z" v="0.3" function_func="loads_function" help="Poisson coefficient"/>
Annex II: Using matrices 27

The <value/> node field in the .spd file is the following:

<value n="nu_s" pn="nu" function="matrix_func,scalar" dimension_function="3" state="normal" symmetric_function="1"


has_diag="1" components_function="a,b,c" v="0.3" help="Poisson coefficient"/>

The parameters are as follows,


dimension_function: Determine the dimensions of a the given square matrix.
symmetric_function: It is a boolean value as a 1 or 0. It allows to indicate that it is given only the upper triangular part
of a symmetric matrix.
components_function: List of numbers or names. The natural way to refer to rows and columns in a matrix is via the
row and column numbers. However, the user can also give names to these entities.
has_diag: It is a boolean value as a 1 or 0, that allows to indicate if it is a diagonal matrix.

<proc n="loads_function" args="">


return [cmas2d_CustomLIB::chk_loads_function $domNode]
</proc>

proc cmas2d_CustomLIB::chk_loads_function { domNode } {


set loads [list [list scalar]]
lappend loads [list interpolator_func x x T]
return [join $loads ,]
}

4.4 Access to tree data information

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.

set document [$::gid_groups_conds::doc documentElement]


set xpath {/cmas2d_customlib_data/condition[@n='Point_Weight']/group[@name='Point Weight
Auto1']/value[@n='Weight']}
set xml_node [$document selectNodes $xpath]
set value [get_domnode_attribute $xml_node v]
Xpath 29

* Matches any element node


@* Matches any attribute node
node() Matches any node of any kind

In the table below we have listed some path expressions and the result of the expressions:

/bookstore/* Selects all the child element nodes of the bookstore


element
//* Selects all elements in the document
//title[@*] Selects all title elements which have at least one
attribute of any kind

Selecting Several Paths


By using the | operator in an XPath expression you can select several paths.
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:

| Computes two node-sets //book | //cd


+ Addition 6+4
- Subtraction 6-4
* Multiplication 6*4
div Division 8 div 4
= Equal price=9.80
!= Not equal price!=9.80
< Less than price<9.80
<= Less than or equal to price<=9.80
> Greater than price>9.80
>= Greater than or equal to price>=9.80
or or price=9.80 or price=9.70
and and price>9.00 and price<9.90
mod Modulus (division remainder) 5 mod 2

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.

Example of combobox items

Table to select the unit to insert

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>

Unit system definition


The field used to choose the unit system is special. It has the attribute units_system_definition="1", it does not contain
any "v" attribute, and it contains a unique dependency related to the units fields.
Units 31

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,

<container n="units" pn="Units" icon="units-16" help="Units definition">


<value n="units_mesh" pn="Geometry units" unit_mesh_definition="1" icon="units-16"/>
<value n="units_system" pn="Unit system" units_system_definition="1" icon="units-16"
state="hidden">
<dependencies node="//*[@unit_definition or @unit_mesh_definition='1']"
att1="change_units_system" v1="{@v}"/>
</value>
<container n="basic_units" pn="General units" icon="units-16" state="normal">
<value n="units_length" pn="Length" unit_definition="L"/>
<value n="units_mass" pn="Mass" unit_definition="M"/>
<value n="units_force" pn="Force" unit_definition="F"/>
<value n="units_pressure" pn="Pressure" unit_definition="P"/>
<value n="units_temperature" pn="Temperature" unit_definition="Temp"/>
<value n="units_time" pn="Time" unit_definition="T"/>
</container>
</container>

Example of window to specify the selection of


units

International and Imperial systems


There are two primary systems used to define units: the international and imperial systems, as seen below. The
international system of units is the modern standardized form of the metric system. It sets standard measurements and
conversions, and is the most commonly and universally accepted system of units. The imperial system, also known as
British Imperial, is the system of units first defined in the British Weights and Measures Act of 1824, which was later
refined and reduced.

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

Defining magnitudes and units


Units 32

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:

<value n="ini_temp" pn="Initial temperature" v="20.0" unit_magnitude="Temp" units="°C"/>

Note: For instance, it is convenient to change magnitudes like unit_magnitude="F/L^2" by unit_magnitude="P".

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

4.7 Main procedures

PROBLEMTYPE 'CUSTOMLIB'>Main procedures


The main procedures available to be used in the TCL files, are listed below.

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::begin_problemtype spd_file defaults_file ""


This procedure allows to load the problem type and should be defined in the InitGIDProject procedure. The arguments
are the following:
spd_file - The directory of the main configuration file (.spd).
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::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

gid_groups_conds::import_export_materials widget xpath


This procedure allows to open the 'Import/export materials' window. It receives as arguments:
widget - Parent widget.
xpath - It is thexpath expression to the field 'container' of materials.

4.8 Description of the local axes

Local axes definition


CustomLib lets the user to define new coordinates reference systems. Local axes can be assigned to entities using the Local
axes window.

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.

The Local axes window to assign local axes into entities

Local coordinates will be shown by selecting the Draw button.

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.

The Generic Local axes tab-sheet

User defined local axes menu


CustomLib also offers the opportunity to customize the pull-down menu when creating a problem type in the following way:
Description of the local axes 35

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 code to make this change in the menu would be as follows,

GidAddUserDataOptionsMenu [= "Local axes"] "gid_groups_conds::local_axes_menu %W" $ipos

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.

Local axes assigned on lines


The model has been created related to a global axes system XYZ that is unique for the entire problem. The main property
of this system is that the local X� axe must have the same direction than the line.

Local axes system X�Y�Z� assigned on a line element

The ways for defining local axes systems are:

-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.

Local axes assigned on surfaces


The model is created related to a global axes system XYZ that is unique for the entire problem. The main property of this
local axes system is that the local Z� axe must have the same direction than the normal of the element.
Description of the local axes 36

Local axes system X�Y�Z� assigned on a surface element

The ways for defining local axes systems are:

-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:

<container n="local_axes" pn="Local axes">


<container n="local_axes_window" pn="Local axes definition">
<edit_command n="local_axes_win" proc="gid_groups_conds::local_axes_window" edit_type="exclusive"/>
</container>
</container>

Example no. 2
Here is an example of application for opening the Local axes window from a conditions window, as follows:

The <condition/> node field in the .spd file is:

<condition n="local_axes" pn="Local axes condition" ov="surface" local_axes="normal" ovm="element"/>

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:

The <condition/> node field in the .spd file is the following:

<condition n="constraints" pn="constraints" ov="point,line,surface" ovm="node">


<value n="Local_axes" pn="Local axes" v="0" values="0,1" editable="0" local_axes="disabled" help="If the
direction to define is not coincident with the global axes, it is possible to define a set of local axes and prescribe the
displacements related to that local axes">
<dependencies node="." att1="local_axes" v1="normal" value="1"/>
<dependencies node="." att1="local_axes" v1="disabled" not_value="1"/>
</value>
</condition>

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 field

The non-editable combobox In the combobox options The <condition/> node field in the .spd file could be the following:

<condition n="pressure_load" pn="Pressure load" ov="surface" ovm="element">


<value n="load_type" pn="Load type" v="global" values="global,local" local_axes="disabled" editable="0" help="The
load can be applied in global axes, or in the Local Axes defined for the entity">
<dependencies node="." att1="local_axes" v1="normal" value="local"/>
<dependencies node="." att1="local_axes" v1="disabled" not_value="local"/>
</value>
</condition>

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:

The <condition/> node field in the .spd file is as follows:


<condition n="local_axes_directions" pn="Local axes directions" ov1="surface" ov2="line" ov1p="Local axes surfaces"
ov2p="Tangent lines" ovm1="element" ovm2="none" help="Select surfaces in order to define its local axes tangents
based in selected lines" />

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

There will be different styles of local axes definitions:


Automatic: The program automatically generates one local axes compatible with the geometry.

New local axes window to apply local axes

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':

User defined local axes definition, XZ will be defined on screen


Writing the input file for calculation 39

4.9 Writing the input file for calculation

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>

GiD_WriteCalculationFile init ?-mode append? ?-encoding external|utf-8? <filename>


To open for writting the calculation file.
Before to print any information to the file it must be opened with this command. Next prints of
GiD_WriteCalculationFile will use implicilty this opened channel.

GiD internal strings are utf-8 codified,


-encoding external : (default) strings to print are converted to the current external encoding.
-encoding utf-8: strings are not converted.

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

GiD_WriteCalculationFile puts ?-nonewline? <string>


Print the string in the calculation file and a carriage return
-nonewline avoid the carriage return.

Example:
GiD_WriteCalculationFile puts "hello world"

GiD_WriteCalculationFile coordinates ?-count? ?-return? ?-factor <factor>? <format>


This command must be used to print all nodes of the mesh. It prints <num> <x> <y> <z> for each node.
<format> must be a "C-like" format for an integer an three doubles.
Are only printed the values with supplied format, e.g. if the format is "%d %f" only the node number and its x will be
printed.
If a %.0s is specified then the corresponding value is not printed (trick to avoid print some values)
If -count is specified then only return the number of entities, without print.
If -return is specified then return the string, without print.
If -factor <factor> is set the the coordinates will be scaled by the <factor> (that must be a real number, 1.0 by
default). It is used aid to write the mesh based on the declared mesh unit and the current reference length unit.

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"

set unit_origin [gid_groups_conds::give_mesh_unit]


set unit_destination [gid_groups_conds::give_active_unit L]
set mesh_factor [gid_groups_conds::convert_unit_value L 1.0 m mm]
GiD_WriteCalculationFile coordinates -factor $mesh_factor "%d %g %g %g"
Writing the input file for calculation 40

GiD_WriteCalculationFile all_connectivities ?-elemtype <etype>? ?-count? ?-return? ?-connec_ordering


corners_faces|corner_face_corner_face? <format>
This command must be used to print all elements of the mesh. It prints the element number and its connectivities for
each element of type <etype> of the mesh (all types if -elemtype is not set)
<format> must be an integer for the element id and as much integers as connectivities to be printed.
<etype> can be: Linear|Triangle|Quadrilateral|Tetrahedra|Hexahedra|Prism|Point|Pyramid|Sphere|Cir
cle
If -count is specified then only return the number of entities, without print.
If -return is specified then return the complete string, without print.
for quadratic elements the order of nodes could be specified with -connec_ordering
corners_faces|corner_face_corner_face
by default the order is corners_faces (first are printed the corners and then the quadratic nodes)

Example:
GiD_WriteCalculationFile all_connectivities -elemtype Triangle "id: %d connectivities: %d %d %d"

GiD_WriteCalculationFile connectivities|nodes|elements|has_elements ?-elemtype <etype>? ?-localaxes


<groupsLADict>? ?-elements_faces all | elements | faces? ?-number_ranges <NRDict>? ?-count?
?-unique? ?-error_if_repeated? ?-multiple? ?-all_entities? ?-print_faces_conecs? ?-sorted? ?-do_subst?
?-connec_ordering? ?-return? <groupsDict>

To get entities information related to groups: connectivities, nodes, elements of the group names specified in the
<groupsDict> dictionary

for connectivities it prints the element number and its connectivities


for nodes it prints the node number and optionally (if the provided format expect it) its x y z real coordinates
for elements it prints the element number (for element faces prints element numer and face number, element from 1,
face from 0)
-elemtype <etype> can be: Linear|Triangle|Quadrilateral|Tetrahedra|Hexahedra|Prism|Point|Pyramid|
Sphere|Circle
-localaxes can be set in order to write local coordinate axes, where <formatLADict> is a dictionary (list of pairs
key-value), with key equal to LA_name and value equal to a format, which could be for instance {%d[euler_angles
matrix/matrixT "%g%g%g%g%g%g%g%g%g"]}. The euler_angles is a function and matrix or matrixT its
argument in order to remark that its rotation matrix or its transposed matrix should be written. A format equal to
"" should be specified at the end of the GiD_WriteCalculationFile function. The EAmat function permits to have
more control about the rotation matrix related to the euler angles using for instance the format {%d[EAmat 1
1][EAmat 2 1][EAmat 3 1][EAmat 1 2][EAmat 2 2][EAmat 3 2][EAmat 1 3][EAmat 2 3][EAmat 3 3]} to write the
directions of the local coordinate systems. The three angles giving the rotation matrix are called Euler angles.
A -do_subst flag should be required in order to replace the previous formulas in the GiD_WriteCalculationFile.
<groupsLADict> is a dictionary (list of pairs key value) of local axes, with key=LA_name and value=format
-elements_faces can be set to specify any type (all), body elements (elements) or face elements (faces).
Therefore, it considers element connectivities or face elements connectivities.
-unique can be set to specify that each entity should be written once.
-multiple can be used in order to consider a list of variables containing a dictionary value (list of pairs key value).
It is known that "dict set dictionary key value" command takes the name of a variable containing a dictionary
value and places an updated dictionary value in that variable, containing a mapping from the given key to the
given value. It should be noted that when multiple keys are present, this operation creates or updates a chain of
nested dictionaries and the GiD_WriteCalculationFile function requires -multiple flag.
-all_entities can be set to specify that all entities should be considered.
-do_subst can be set to replace formulas.
-number_ranges can be set to print the list of entities, in case of consecutive ids, with a compressed notation
n_start:n_end (meaning n_start,n_start+1,..., n_end) group entities using a groups dictionary.
<NRDict> is a dictionary with key the format associated to a group name in <groupsDict> and value another
format with and extra integer, typically the first format prefixed by "%d:"
-sorted can be set to apply a string ordering.
-print_faces_conecs can be set to print face element connectivities. A -elements_faces of face elements should
be specified when a -print_faces_conecs is used.
-connec_ordering can be set to specify a connectivities ordering as corner-middle edge-corner
(corner_face_corner_face), default is first all corner nodes (corners_faces)
Writing the input file for calculation 41

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 to print also its x y z coordinates:


set format_by_group [dict create $group_name "%d of group $group_name with coordinates %g %g %g"]
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 element id of the triangle elements belonging to $group_name


GiD_WriteCalculationFile elements -elemtype Triangle [dict create $group_name "element id:%d node
ids:%d %d %d "]

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 "]

Functions to convert between different unit types


There are a couple of functions that are essential when writing the input file for the calculation. These functions permit the
treatment of the units, and facilitates the conversion from one measurement to another. They are the following:

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 nodeObject to_unit


This function converts the value of a nodeObject from the current unit for the original number to another unit, where
the arguments are 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_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.

gid_groups_conds::convert_unit_value magnitude value unit_from to_unit


This function converts a number from one unit type to another unit type, for the same magnitude. It receives as
arguments:
magnitude - Unit definition, it is the name 'n' of the physical quantity (eg. "L" for Length)
value - The number to be converted.
unit_from - A text string, denoting the unit for the original number.
Writing the input file for calculation 42

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_unit_factor magnitude unit


This function returns the conversion factor for the unit given. The arguments are as follows:
magnitude - Unit definition, it is the name 'n' of the physical quantity (eg. "L" for Length)
unit - A text string, denoting the unit chosen to obtain the conversion factor.

gid_groups_conds::convert_v_to_default value magnitude unit_from


This function converts a number from one unit type to the unit type by default, for the same magnitude. It receives as
arguments:
value - The number to be converted.
magnitude - Unit definition, it is the name 'n' of the physical quantity (eg. "L" for Length)
unit_from - A text string, denoting the unit for the original number.

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)

4.9.1 Cheatsheet of writing functions

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 "Input Data file for Frame3DD - 3D structural frame analysis


([gid_groups_conds::give_active_unit F],[gid_groups_conds::give_active_unit
L],[gid_groups_conds::give_active_unit M])"

Nodes in the mesh


See how we get the number of nodes of the whole mesh. Also notice the way we are passing the writing format for the
coordinates.

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 "

Elements assigned to the condition that assigns a material

set condition_name "frameData"


set condition_formats [list {"%1d" "element" "id"} {"%13.5e" "property" "Ax"} {"%13.5e" "property"
"Asy"} ... {"%13.5e" "material" "Density"}]
set formats [customlib::GetElementsFormats $condition_name $condition_formats]
set number_of_elements [GiD_WriteCalculationFile elements -count -elemtype Linear $formats]
customlib::WriteConnectivities $condition_name $formats "" active

Contraints
This is the way we get the number of nodes assigned to a condition called 'constraints' in the spd.

set constraints_list [list "constraints"]


set number_of_constraints [customlib::GetNumberOfNodes $constraints_list]

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.

set document [$::gid_groups_conds::doc documentElement]


set xpath "/frame3dd_data/container\[@n = 'extraOptions' \]/value\[@n = 'shear_deformation' \]"
set xml_node [$document selectNodes $xpath]
set shear_deformation [get_domnode_attribute $xml_node v]
customlib::WriteString "$shear_deformation # 1=Do, 0=Don't include shear deformation effects"

Single load case


This is the way we get the number of elements assigned to a condition, and then print the element id and the
properties assigned to it.

set condition_name "line_Uniform_load"


set condition_formats [list {"%1d" "element" "id"} {"%13.5e" "property" "Load_x"} {"%13.5e"
"property" "Load_y"} {"%13.5e" "property" "Load_z"}]
set formats [customlib::GetElementsFormats $condition_name $condition_formats]
set number_of_elements [GiD_WriteCalculationFile elements -count -elemtype Linear $formats]
customlib::WriteConnectivities $condition_name $formats "" active

Several load cases


For the several load case, we will need to iterate over the xml nodes corresponding to the blockdatas that define each
load case.
For each load case, we need to print all the loads information, so we need to know if a load has any group assigned.
If so, we'll need to know how many elements are involved, and print them with the properties of the load.

set xpath "/frame3dd_data/container\[@n = 'staticCases' \]/blockdata"


set xml_nodes [$document selectNodes $xpath]
foreach load_case $xml_nodes {
set xpath "./condition\[@n = 'uniformLoad' \]/group"
set groups [$load_case selectNodes $xpath]
set number_of_elements 0
set formats_dict [dict create ]
foreach group $groups {
set group_name [get_domnode_attribute $group n]
set Ux_node [$group selectNodes "./value\[@n = 'Ux'\]"]
set Ux_value [get_domnode_attribute $Ux_node v]
set Uy_node [$group selectNodes "./value\[@n = 'Uy'\]"]
set Uy_value [get_domnode_attribute $Uy_node v]
set Uz_node [$group selectNodes "./value\[@n = 'Uz'\]"]
set Uz_value [get_domnode_attribute $Uz_node v]
set format "%5d $Ux_value $Uy_value $Uz_value"
set formats_dict [dict merge $formats_dict [dict create $group_name $format]]
}
set number_of_elements [GiD_WriteCalculationFile elements -count -elemtype Linear
$formats_dict]
if {$number_of_elements > 0} {
GiD_WriteCalculationFile elements -elemtype Linear $formats_dict
}
}

4.10 User preferences

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.

To set/get user preferences variables these procedures must be used.

gid_groups_conds::get_preference <name> <default_value>


This function returns the value of a preference, or the default value if the preference does not already exist. It receives
as arguments:
name - Name of the preference
value - Default value

gid_groups_conds::set_preference <name> <value>


This function imposes the value of a preference. It receives as arguments:
name - Name of the preference
User preferences 44

value - Default value

Example: get or set a user variable named 'verbosity_level', with default value=0

set level [gid_groups_conds::get_preference verbosity_level 0]


gid_groups_conds::set_preference verbosity_level 2

4.11 Import export materials

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.

4.12 About CustomLib

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

4.13 CustomLIB extras

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

The extra content on this package is:


New fields added to the spd file.

4.13.1 SPD_fields

4.13.1.1 include

It's used to join diferent parts of the spd file.


It must contain the following attributes:
path: relative path, from the problemtype folder
It can contain the following attributes:
active: Specifies if the part must be added in the final

All attributes will be transfered to the included node, except "n" "active" and "path"

Example:

<include path="xml/materials.xml"/>

4.13.2 Extra functions

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::ProcessIncludesRecurse filename basedir


This procedure parses the active include nodes of the specified file, and replaces them for the node found in the
path files. Basedir is the directory where the file specified by the path field is.

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

customlib::WriteConnectivities list_of_condition_names parameters


Utility to print elements and connectivities.
In the spd file, we can define condition tags to assign properties to a GiD group. The list_of_condition_names is the
list of these conditions whose groups' elements must be printed.
parameters is a list of lists of 3 words, and defines the format and the information that we want to print. The first
word is always a format. The second word can be "element", "material", "property" or "string". "element" is set to write
element information. "material" is set to print any material property. "string" is set to print a string. The third word
depends on the second one. If it's "element", the third can be: "id" or "connectivities". If it's "material", the third one
can be "MID", "Density" or any material property according to GetMaterials function. Obviously, to use 'material' data,
Extra functions 46

a material must be defined in the condition.


Valid examples:
{"%10d" "element" "id"}
{"%10d" "element" "connectivities"}
{"%10d" "node" "id"}
{"%10d" "material" "MD"}
{"%10d" "material" "Density"}
{"%10d" "property" "Weight"}
{"%10d" "string" "str..."}
...

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

# These instructions print the following text


1 54 52 43 1
2 59 61 51 1
3 68 70 67 1
4 53 57 47 1
...

customlib::WriteNodes list_of_condition_names parameters ?flags?


Utility to print the nodes of the groups of the conditions specified at list_of_condition_names, and the information
asigned to them.

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::GetNumberOfNodes list_of_condition_names ?flags?


Utility to get the number of nodes of the groups of the conditions specified at list_of_condition_names.

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.

customlib::WriteMaterials parameters ?state?


state can be 'all' or 'used'.
Utility to print the list of materials, and their properties defined in parameters.
Example:
set parameters [list {"%4d" "material" "MID"} {"%13.5e" "material" "Density"}]
customlib::WriteMaterials $parameters used

# 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.

You can find it's documentation here -> https://github.com/GiDHome/gid_smart_wizard

You can find an example here -> http://github.com/GiDHome/cmas2d_customlib_wizard


49

5 EXECUTING AN EXTERNAL PROGRAM


Once all the problem type files are finished (.cnd, .mat, .prb, .sim, .bas files), you can run the solver. You may wish to run
it directly from inside GiD.

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:

1st argument: project_name (name of the current project);


2nd argument: c:\a\b\c\project_name.gid (path of the current project);
3rd argument: c:\a\b\c\problem_type_name.gid (path of the problem type selected);

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

5.1 Showing feedback when running the solver

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.

5.2 Commands accepted by the GiD command.exe

The keywords are as follows:


%
Shift
Rem
Chdir (Cd)
Del (Delete, Erase)
Copy
Rename (Ren, Move)
Mkdir (Md)
Commands accepted by the GiD
command.exe 50

Set
Echo (@echo)
If
Call
Goto
:
Type

Unknown instructions will be executed as from an external file.

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.

if[not] exist fileName command


if [not] string1==string2 command
if[not] errorlevel number command

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.

Note: Exist can also be used to check if a directory exists.

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.

call[drive:][path] file [parameters]

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

6 PREPROCESS DATA FILES

6.1 Geometry format: Modelname.geo

DESCRIPTION OF THE FORMAT

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

6.1.1 Geometry example

This example consists on a simple cylinder, like the one


shown on the right.
It contains points, curves of type straight lines,
circumference arcs and curved NURBS with
circumference shape, and surfaces of the types planar,
Coon and NURBS with cylindrical form, and there is a
single volume.

Note: This model could be found at: Examples\Cylinder_


ASCII.gid
65

7 POSTPROCESS DATA FILES


In GiD Postprocess you can study the results obtained from a solver program. The solver and GiD Postprocess
communicate through the transfer of files. The solver program has to write the results to a file that must have the
extension .post.res and its name must be the project name. Other allowed extensions are .post.lst,.post.bin and .post.h5.

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

Postprocessing data files can be:


ASCII files, where the mesh and results should be provided in two separated files;
binary files, a binary version of the ASCII files but mesh and results can be stored in one file;
hdf5 files, mesh and results are stored in one hdf5 file.
All three formats can be writen using the freely available GiDPost library, whose source code, and some pre-built binaries,
can be downloaded from https://www.gidhome.com --> GiDPlus --> GidPost.

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.

The ASCII format consists of two files:


Mesh Data File: project_name.post.msh for volume and surface (3D or 2D) mesh information, and
Results Data File: project_name.post.res for results information.

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.

7.1 Results format: ModelName.post.res

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.

This is the ASCII format description:

The first line of the files with results written in this new postprocess format should be:

GiD Post Results File <version>

where <version> must be:


1.0 in general
>=1.1 in case of binary compressed format
>=1.2 in case of contain some OnNurbsSurface result

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:

include "My Other Results File"

This is useful, for instance, for sharing several GaussPoints definitions and ResultRangeTable among different analyses.

This 'include' should be outside the Blocks of information.

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).

7.1.1 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.

The structure is as follows, and should:


Begin with a header that follows this model:
GaussPoints "gauss_points_name" Elemtype my_type "mesh_name"
where
GaussPoints, elemtype: are not case-sensitive;
"gauss_points_name": is a name for the gauss points set, which will be used as reference by the results that
are located on these gauss points;
my_type: decribes which element type these gauss points are for, i.e. Line, Triangle, Quadrilateral,
Tetrahedra, Prism, Pyramid or Hexahedra ;
"mesh_name": is an optional field. If this field is missing, the gauss points are defined for all the elements of
type my_type. If a mesh name is given, the gauss points are only defined for this mesh.
Gauss Points 67

Be followed by the gauss points properties:


Number of Gauss Points: number_gauss_points_per_element
Nodes included
Nodes not included
Natural Coordinates: Internal
Natural Coordinates: Given
natural_coordinates_for_gauss_point_1 . . . natural_coordinates_for_gauss_point_n

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:

Internal coordinates: Internal coordinates: Internal coordinates:


( 0, 0) a=0.57735027 a=0.77459667
(-a,-a) ( a,-a) ( a, a)
(-a,-a) ( a,-a) (-a, a) ( 0,-a) ( a, 0)
( a, a) (-a, a) ( 0, a) (-a, 0) ( 0, 0)

Gauss Points positions of the quadrature of Gauss-Legendre Quadrilaterals

Internal coordinates: Internal coordinates: Internal coordinates:


a=1/3 a=1/2 a=0.09157621 b=0.8168475
7
c=0.44594849 d=0.1081030
( a, a) ( a, 0) ( a, a) ( 0, a)
1
( a, a) ( b, a) ( a, b)
( c, d) ( c, c) ( d, c)

Gauss Points positions of the quadrature of Gauss for Triangles


Gauss Points 68

For tetrahedra the order of the Internal Gauss Points is this:

Internal coordinates: Internal coordinates:


a=(5+3*sqrt(5))/20=0.585410196624968 a=0.108103018168070
b=(5-sqrt(5))/20 =0.138196601125010 b=0.445948490915965
c=0.816847572980459

( 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)

For hexahedra the order of the Internal Gauss Points is this:

Internal coordinates: Internal coordinates:


a=0.577350269189626 a = 0.774596669241483

(-a,-a,-a) ( a,-a,-a) ( a, a,-a) (-a, a,-a)


(-a,-a, a) ( a,-a, a) ( a, a, a) (-a, a, a)
( 0,-a,-a) ( a, 0,-a) ( 0, a,-a) (-a, 0,-a)
(-a,-a, 0) ( a,-a, 0) ( a, a, 0) (-a, a, 0)
( 0,-a, a) ( a, 0, a) ( 0, a, a) (-a, 0, a)

(-a,-a,-a) ( a,-a,-a) ( a, a,-a) (-a, a,-a) ( 0, 0,-a)

(-a,-a, a) ( a,-a, a) ( a, a, a) (-a, a, a) ( 0,-a, 0) ( a, 0, 0) ( 0, a, 0) (-a, 0, 0)


( 0, 0, a)
( 0, 0, 0)

For prisms the order of the Internal Gauss Points is this:


Gauss Points 69

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)

The given natural coordinates for Gauss Points should range:


between 0.0 and 1.0 for Triangles, Tetrahedra and Prisms, and
between -1.0 and 1.0 for Quadrilaterals, Hexahedra and Pyramids.

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

Nodes not included


Nodes included

The default value is nodes not included

Note: By now, Natural Coordinates for line elements cannot be "Given"

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.

End with this tail:


End GaussPoints

where End GaussPoints: is not case-sensitive.

Here is an example of results on Gauss Points:

GaussPoints "Board gauss internal" ElemType Triangle "board"


Number Of Gauss Points: 3
Natural Coordinates: internal
end gausspoints

Internal Gauss points

The following Internal gauss points are automatically defined.


Results can use this names without explicitly define them with a GaussPoints / End GaussPoints statement.

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.

7.1.2 Result Range Table

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.

The structure is as follows and should:


Begin with a header that follows this model:
ResultRangesTable "ResultsRangeTableName"
where ResultRangesTable: is not case-sensitive; "ResultsRangeTableName": is a name for the Result Ranges Table,
which will be used as a reference by the results that use this Result Ranges Table.
Result Range Table 71

Be followed by a list of Ranges, each of them defined as follows:


Min_Value - Max_Value: "Range Name"
where
Min_value : is the minimum value of the range, and may be void if the Max_value is given. If void, the
minimum value of the result will be used;
Max_value : is the maximum value of the range, and may be void if the Min_value is given. If void, the
maximum value of the result will be used;
"Range Name" : is the name of the range which will appear on legends and labels.

End with this tail:


End ResultRangesTable
where
End ResultRangesTable: is not case-sensitive.

Here are several examples of results range tables:

Ranges defined for the whole result:

ResultRangesTable "My table"


# all the ranges are min <= res < max except
# the last range is min <= res <= max
- 0.3: "Less"
0.3 - 0.7: "Normal"
0.7 - : "Too much"
End ResultRangesTable

Just a couple of ranges:

ResultRangesTable "My table"


0.3 - 0.7: "Normal"
0.7 - 0.9: "Too much"
End ResultRangesTable

Or using the maximum of the result:

ResultRangesTable "My table"


0.3 - 0.7: "Normal"
0.7 - : "Too much"
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.

The structure is as follows and should:


Begin with a result header that follows this model:
Result "result name" "analysis name" step_value result_type result_location "location name"
where
Result: is not case-sensitive;
"result name": is a name for the Result, which will be used for menus; if the result name contains spaces it
should be written between "" or between {}.
"analysis name": is the name of the analysis of this Result, which will be used for menus; if the analysis name
contains spaces it should be written between "" or between {}.
step_value: is the value of the step inside the analysis "analysis name";
result_type: describes the type of the Result. It should be one of the following:
Scalar: one component per result
Vector: two, three or four components for result: x, y, z and ( signed) modulus
Matrix: three components for 2D matrices, six components for 3D matrices
PlainDeformationMatrix: four components: Sxx, Syy, Sxy, Szz
MainMatrix: the three main unitary eigen vectors (three components each) and three eigen values of the
matrix
LocalAxes: three euler angles to specify the local axis
ComplexScalar: two components to specify a + b · i
ComplexVector: four components for 2D complex vectors, six or nine components for 3D vectors: rX iX rY iY
rZ iZ |r| |i| |vector| --> to specify the vector ( rX + iX, rY + iY, rZ + iZ)
ComplexMatrix: six components for 2D matrices ( Sxx_real, Syy_real, Sxy_real, Sxx_imag, Syy_imag,
Sxy_imag), and twelwe components for 3D matrices (Sxx_real, Syy_real, Szz_real, Sxy_real, Syz_real,
Result 72

Sxz_real, Sxx_imag, Syy_imag, Szz_imag, Sxy_imag, Syz_imag, Sxz_imag)


result_location: is where the Result is located. It should be one of the following:
OnNodes
OnGaussPoints
OnNurbsSurface
If the Result is OnGaussPoints, a "location name" should be entered;
"location name": is the name of the Gauss Points on which the Result is defined.

Note: Results can be visually grouped into 'folders' like in the following picture

Results grouped into folders

by just grouping of results using double slahes in the result names:


Result �Mechanical//Pressures//Water pressure� �Time analysis� 60
Result �Physical//Saturation� �Time analysis� 60 Scalar OnNodes
and so on...

Be followed (optionally) by result properties:


ResultRangesTable "Name of a result ranges table"
ComponentNames "Name of Component 1", "Name of Component 2"
Unit "result unit"
where
ResultRangesTable "Name of a result ranges table": (optional) is not case-sensitive, followed by the name of the
previously defined Result Ranges Table, which will be used if the Contour Ranges result visualization is chosen (see
Result Range Table -pag. 70-);
ComponentNames "Name of Component 1", "Name of Component 2": (optional) is not case-sensitive, followed by
the names of the components of the results which will be used in GiD. Missing components names will be
automatically generated. The number of Component Names are:
One for a Scalar Result
Three for a Vector Result
Six for a Matrix Result
Four for a PlainDeformationMatrix Result
Six for a MainMatrix Result
Three for a LocalAxes Result
Two for a ComplexScalar Result
Six or nine for ComplexScalar
Unit: the unit of the result.

End with the result values:


Values
Result 73

node_or_elem_number component_1_value ... component_n_value


...
node_or_elem_number component_1_value ... component_n_value
End Values

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.

There is a model with isogeometric results OnNurbsSurface at: Examples\IGA_shell.gid\IGA_shell.post.res

The number of components for each Result Value are:


for Scalar results: one component result_number_i scalar_value
for Vector results: three components, with an optional fourth component for signed modules result_number_i
x_value y_value z_value result_number_i x_value y_value z_value signed_module_value
for Matrix results: three components (2D models) or six components (3D models)2D: result_number_i
Sxx_value Syy_value Sxy_value3D: result_number_i Sxx_value Syy_value Szz_value Sxy_value Syz_value
Sxz_value
for PlainDeformationMatrix results: four components result_number_i Sxx_value Syy_value Sxy_value
Szz_value
for MainMatrix results: twelve components result_number_i Si_value Sii_value Siii_value Vix_value Viy_value
Viz_value Viix_value Viiy_value Viiz_value Viiix_value Viiiy_value Viiiz_value
for LocalAxes results: three components describing the Euler angles result_number_i euler_ang_1_value
euler_ang_2_value euler_ang_3_value.
Look for LocalAxesDef(EulerAngles) at Multiple values return commands for a more detailed explanation to
calculate axis from euler angles and vice-versa.
for ComplexScalar results: two components to specify a + b · i
for ComplexVector results: four components for 2D complex vectors, six or nine components for 3D vectors:
rX iX rY iY rZ iZ |r| |i| |vector| --> to specify the vector ( rX + iX, rY + iY, rZ + iZ)

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.

7.1.3.1 Results example

Here is an example of results for the table in the previous example (see Mesh example -pag. 81-):

GiD Post Results File 1.0

GaussPoints "Board gauss internal" ElemType Triangle "board"


Number Of Gauss Points: 3
Natural Coordinates: internal
end gausspoints

GaussPoints "Board gauss given" ElemType Triangle "board"


Number Of Gauss Points: 3
Natural Coordinates: Given
0.2 0.2
0.6 0.2
0.2 0.6
End gausspoints

GaussPoints "Board elements" ElemType Triangle "board"


Number Of Gauss Points: 1
Natural Coordinates: internal
end gausspoints

GaussPoints "Legs gauss points" ElemType Line


Number Of Gauss Points: 5
Nodes included
Natural Coordinates: Internal
End Gausspoints

ResultRangesTable "My table"


# el ultimo rango es min <= res <= max
- 0.3: "Less"
0.3 - 0.9: "Normal"
0.9 - 1.2: "Too much"
End ResultRangesTable

Result "Gauss element" "Load Analysis" 1 Scalar OnGaussPoints "Board elements"


Values
Results example 76

0.05 0.05 0.7


15 0.1 -0.1 0.5
0.04 -0.04 1.0
0.05 -0.05 0.7
16 0.05 -0.05 0.7
0.04 -0.04 1.0
-0.05 -0.05 0.7
17 0.0 0.0 0.8
-0.04 -0.04 1.0
-0.04 0.04 1.0
18 0.0 0.0 0.8
0.04 0.04 1.0
0.04 -0.04 1.0
19 0.04 -0.04 1.0
0.04 0.04 1.0
0.0 0.0 1.2
20 0.04 -0.04 1.0
0.0 0.0 1.2
-0.04 -0.04 1.0
21 -0.04 -0.04 1.0
0.0 0.0 1.2
-0.04 0.04 1.0
22 -0.04 0.04 1.0
0.0 0.0 1.2
0.04 0.04 1.0
End Values

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

7.1.4 Result group

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.

The structure is as follows and should:


Begin with a header that follows this model
ResultGroup "analysis name" step_value my_location "location name"
where
ResultGroup: is not case-sensitive;
"analysis name": is the name of the analysis of this ResultGroup, which will be used for menus; if the analysis
name contains spaces it should be written between "" or between {}.
step_value: is the value of the step inside the analysis "analysis name";
my_location: is where the ResultGroup is located. It should be one of the following: OnNodes, OnGaussPoints. If
the ResultGroup is OnGaussPoints, a "location name" should be entered.
Result group 77

"location name": is the name of the Gauss Points on which the ResultGroup is defined.

Be followed by at least one of the results descriptions of the group


ResultDescription "result name" my_result_type[:components_number]
ResultRangesTable "Name of a result ranges table"
ComponentNames "Name of Component 1", "Name of Component 2"
where
ResultDescription: is not case-sensitive;
"result name": is a name for the Result, which will be used for menus; if the result name contains spaces it should
be written between "" or between {}.
my_type: describes the type of the Result. It should be one of the following: Scalar, Vector, Matrix,
PlainDeformationMatrix, MainMatrix, or LocalAxes. The number of components for each type is as follows:
One for a Scalar: the_scalar_value
Three for a Vector: X, Y and Z
Six for a Matrix: Sxx, Syy, Szz, Sxy, Syz and Sxz
Four for a PlainDeformationMatrix: Sxx_value, Syy, Sxy and Szz
Twelve for a MainMatrix: Si, Sii, Siii, ViX, ViY, ViZ, ViiX, ViiY, ViiZ, ViiiX, ViiiY and ViiiZ
Three for a LocalAxes: euler_ang_1, euler_ang_2 and euler_ang_3
Two for ComplexScalar: real and imag
Six for ComplexVector: x_real, x_imag, y_real, y_imag, z_real, z_imag
Twelve for ComplexMatrix: Sxx_real, Syy_real, Szz_real, Sxy_real, Syz_real, Sxz_real, Sxx_imag, Syy_imag,
Szz_imag, Sxy_imag, Syz_imag, Sxz_imag
Following the description of the type of the result, an optional modifier can be appended to specify the number of
components separated by a colon. It only makes sense to indicate the number of components on vectors and matrices:
Vector:2, Vector:3 or Vector:4: which specify:
Vector:2: X and Y
Vector:3: X, Y and Z
Vector:4: X, Y, Z and |Vector| (module of the vector, with sign for some tricks)
The default (Vector) is 3 components per vector.
Matrix:3 or Matrix:6: which specify:
Matrix:3: Sxx, Syy and Sxy
Matrix:6: Sxx, Syy, Szz, Sxy, Syz and Sxz
The default (Matrix) is 6 components for matrices.
ComplexVector:4 or ComplexVector:6 which specify
ComplexVector:4: x_real, x_imag, y_real, y_imag
ComplexVector:6: x_real, x_imag, y_real, y_imag, z_real, z_imag
ComplexMatrix:3 or ComplexMatrix:6 which specify
ComplexMatrix:3: Sxx_real, Syy_real, Sxy_real, Sxx_imag, Syy_imag, Sxy_imag
ComplexMatrix:6: Sxx_real, Syy_real, Szz_real, Sxy_real, Syz_real, Sxz_real, Sxx_imag, Syy_imag,
Szz_imag, Sxy_imag, Syz_imag, Sxz_imag

Here are some examples:


ResultDescription "Displacements" Vector:2
ResultDescription "2D matrix" Matrix:3
ResultDescription "LineDiagramVector" Vector:4

and where (optional properties)


ResultRangesTable "Name of a result ranges table": (optional) is not case-sensitive, and is followed by the name of
the previously defined Result Ranges Table which will be used if the Contour Ranges result visualization is chosen
(see Result Range Table -pag. 70-);
ComponentNames "Name of Component 1", "Name of Component 2": (optional) is not case-sensitive, and is
followed by the names of the components of the results which will be used in GiD. The number of Component
Names are:
One for a Scalar Result
Three for a Vector Result
Six for a Matrix Result
Four for a PlainDeformationMatrix Result
Six for a MainMatrix Result
Result group 78

Three for a LocalAxes Result

End with the results values:


Values
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
End Values

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.

The number of components for each ResultDescription are:


for Scalar results: one component result_number_i scalar_value
for Vector results: three components result_number_i x_value y_value z_value
for Matrix results: six components (3D models)3D: result_number_i Sxx_value Syy_value Szz_value
Sxy_value Syz_value Sxz_value
for PlainDeformationMatrix results: four components result_number_i Sxx_value Syy_value Sxy_value
Szz_value
for MainMatrix results: twelve components result_number_i Si_value Sii_value Siii_value Vix_value Viy_value
Viz_value Viix_value Viiy_value Viiz_value Viiix_value Viiiy_value Viiiz_value
for LocalAxes results: three components describing the Euler angles result_number_i euler_ang_1_value
euler_ang_2_value euler_ang_3_value

End Values: is not case-sensitive, and indicates the end of the results group values section.

Note: Vectors in a ResultGroup always have three components.

Note: Matrices in a ResultGroup always have six components.

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.

Nodal ResultGroup example:

ResultGroup "Load Analysis" 1 OnNodes


ResultDescription "Ranges test" Scalar
ResultRangesTable "My table"
ResultDescription "Scalar test" Scalar
ResultRangesTable "Pressure"
ResultDescription "Displacements" Vector
ComponentNames "X-Displ", "Y-Displ" "Z-Displ"
ResultDescription "Nodal Stresses" Matrix
ComponentNames "Sx", "Sy", "Sz", "Sxy", "Syz", "Sxz"
Values
1 0.0 0.000E+00 0.000E+00 0.000E+00 0.0 0.550E+00 0.972E-01 -0.154E+00 0.0 0.0 0.0
Result group 79

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

Gauss Points ResultGroup example:

GaussPoints "My Gauss" ElemType Triangle "2D Beam"


Number Of Gauss Points: 3
Natural Coordinates: Internal
End gausspoints

ResultGroup "Load Analysis" 1 OnGaussPoints "My Gauss"


ResultDescription "Gauss test" Scalar
ResultDescription "Vector Gauss" Vector
ResultDescription "Gauss Points Stresses" PlainDeformationMatrix
Values
1 1.05 1 0 0.0 -19.4607 -1.15932 -1.43171 -6.18601
2.1 0 1 0.0 -19.4607 -1.15932 -1.43171 -6.18601
3.15 1 1 0.0 -19.4607 -1.15932 -1.43171 -6.18601
2 1.2 0 0 0.0 -20.6207 0.596461 5.04752 -6.00727
2.25 0 0 0.0 -20.6207 0.596461 5.04752 -6.00727
3.3 2.0855e-05 -1.9174e-05 0.0 -20.6207 0.596461 5.04752 -6.00727
3 1.35 2.0855e-05 -1.9174e-05 0.0 -16.0982 -1.25991 2.15101 -5.20742
2.4 2.0855e-05 -1.9174e-05 0.0 -16.0982 -1.25991 2.15101 -5.20742
3.45 2.0855e-05 -1.9174e-05 0.0 -16.0982 -1.25991 2.15101 -5.20742
...

191 29.55 4.2781e-05 -0.00017594 0.0 -0.468376 12.1979 0.610867 3.51885


30.6 4.2781e-05 -0.00017594 0.0 -0.468376 12.1979 0.610867 3.51885
31.65 4.2781e-05 -0.00017594 0.0 -0.468376 12.1979 0.610867 3.51885
192 29.7 4.2781e-05 -0.00017594 0.0 0.747727 11.0624 1.13201 3.54303
30.75 4.2781e-05 -0.00017594 0.0 0.747727 11.0624 1.13201 3.54303
31.8 2.4357e-05 -0.00018974 0.0 0.747727 11.0624 1.13201 3.54303
End Values

7.2 Mesh format: ModelName.post.msh

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:

Begin with a header that follows this model:


MESH "mesh_name" dimension mesh_dimension Elemtype element_type Nnode element_num_nodes
where
MESH, dimension, elemtype, nnode: are keywords that are not case-sensitive;
"mesh_name": is an optional name for the mesh;
mesh_dimension: is 2 or 3 according to the geometric dimension of the mesh;
element_type: describes the element type of this MESH. It should be one of the following; Point, Line,
Triangle, Quadrilateral, Tetrahedra, Hexahedra, Prism, Pyramid, Sphere, Circle ;
element_num_nodes: the number of nodes of the element:

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

Sphere: 1 node and a radius


Circle: 1 node, a radius and a normal (x, y, z)

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 declaring the units of the mesh coordinates


Unit "mesh unit"

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.

# color 127 127 0

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.

Be followed by the coordinates:


coordinates
1 0.0 1.0
3.0 . . .1000
-2.5 9.3 21.8
end coordinates
where
the pair of keywords coordinates and end coordinates are not case-sensitive;
between these keywords there should be the nodal coordinates of all the MESHes or the current one.

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.

Be followed by the elements connectivity


elements
#el_num node_1 node_2 node_3 optional_material_number
1 1 2 3 215
. . .
1000 32 48 23 215
end elements

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.

7.2.1 Mesh example

This example clarifies the description:

#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

- binary format: mesh+result_1.post.bin, mesh+result_2.post.bin, mesh+result_3.post.bin, ...


- ascii format: mesh_1.post.msh + mesh_1.post.res, mesh_2.post.msh + mesh_2.post.res, ...
Note: the steps values ( or analysis) should be diferent for each pair mesh+result.
To read them you can use File-->Open Multiple (see POSTPROCESS > Files menu from Reference Manual)
2. define on binary file or two ascii files (msh+res):

Meshes that belong to a group should be defined between the following highlighted commands

Group "group name"


MESH "mesh_name" dimension ...
...
end elements

MESH "another_mesh" ...


...
end elements
end group

Results which refer to one of the groups should be written between these highlighted commands

OnGroup "group name"


Result "result name"
...
end values
...
end ongroup

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.

For instance, an analysis which is 10 steps long:


For steps 1, 2, 3 and 4: an 'environment' mesh of 10000 elements and a 'body' mesh of 10000 elements are used

MESH "environment"
... Coordinates
...
10000 ...
end elements
MESH "body" ...
...
20000 ...
end elements

and its results

GiD Post Results File 1.0


...
Results "result 1" "time" 1.0 ...
...
Results "result 1" "time" 2.0 ...
...
Results "result 1" "time" 3.0 ...
...
Results "result 1" "time" 4.0 ...
...
end values

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

and its results are

GiD Post Results File 1.0


...
Results "result 1" "time" 5.0 ...
...
Results "result 1" "time" 6.0 ...
...
Results "result 1" "time" 7.0 ...
...
Results "result 1" "time" 8.0 ...
...
end values

For steps 9 and 10: the last meshes to be used are of 20000 and 40000 elements, respectively

MESH "environment" ...


Coordinates
...
20000 ...
end elements
MESH "body" ...
...
60000 ...
end elements

and its results are

GiD Post Results File 1.0


...
Results "result 1" "time" 9.0 ...
...
Results "result 1" "time" 10.0 ...
...
end values

There are two ways to postprocess this:

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

Group "steps 5, 6, 7 and 8"


MESH "environment" ...
...
MESH "body" ...
...
end group

Group "steps 9 and 10"


MESH "environment" ...
...
Group of meshes 85

MESH "body" ...


...
end group

and
all_analysis.post.res (note the ongroup - end ongroup pairs)

GiD Post Results File 1.0


OnGroup "steps 1, 2, 3 and 4"
...
Results "result 1" "time" 1.0 ...
...
Results "result 1" "time" 2.0 ...
...
Results "result 1" "time" 3.0 ...
...
Results "result 1" "time" 4.0 ...
...
end ongroup

OnGroup "steps 5, 6, 7 and 8"


...
Results "result 1" "time" 5.0 ...
...
Results "result 1" "time" 6.0 ...
...
Results "result 1" "time" 7.0 ...
...
Results "result 1" "time" 8.0 ...
...
end ongroup

OnGroup "steps 9 and 10"


...
Results "result 1" "time" 9.0 ...
...
Results "result 1" "time" 10.0 ...
...
end ongroup

and use the normal Open option.

7.3 List file format: ModelName.post.lst

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

The file contains a list of the files to be read by the postprocess:


The first line should contain one of these words:
Single: just a single file ( two for ascii files: one for mesh and another for results) is provided to be read;
Merge: several filenames are provided, one filename per line, which are to be merged inside GiD, for instance
when the files come from a domain decomposed simulation;
Multiple: several filenames are provided, one filename per line, which are read in GiD, for instance if they belong
to a DEM simulation, or FEM simulation with mesh refinement;
next lines: the mesh and results files to be read, with one filename per line;
List file format: ModelName.post.lst 86

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;

Example of a list file:

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.

7.4 Graphs file format: ModelName.post.grf

The graph file that GiD uses is a standard ASCII file.


Every line of the file is a point on the graph with X and Y coordinates separated by a space.
Comment lines are also allowed and should begin with a '#'.

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

7.5 Binary format

The postprocess binary format is strongly based in the ascii format.


Each line of the Mesh and Result headers are stored as a 4-byte integer with the length of the string followed by the
0-terminated string-line.
Mesh coordinates, conectivities and result values are stored as binary data, 4-byte integers and 4-byte floating point
values.
Finally the whole binary data file is compressed with z-lib.

You can debug the file following these steps:


1 rename the file for instance to .post.res.gz
2 uncompress it with your favoutire compressor
3 you can 'edit' the file with emacs, notepad++ or any other editor
4 you can also look for the 'Result' header with CLI tools like:
grep -a Result ./test.post.bin | awk ' BEGIN { RS ="\0" } ; { printf " %s ", $0 }' | grep -a
Result | less
Output example:
Result "PRESSURE" "Kratos" 1 Scalar OnNodes^Y
Result "VELOCITY" "Kratos" 1 Vector OnNodesE
Result "PRESSURE" "Kratos" 2 Scalar OnNodes^Y
Result "VELOCITY" "Kratos" 2 Vector OnNodesE
Result "PRESSURE" "Kratos" 3 Scalar OnNodes^Y
Result "VELOCITY" "Kratos" 3 Vector OnNodesE
...

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.

7.6 HDF5 format

In HDF5 the postprocess information is stored in several groups.


You can always look at the structure of GiDPost hdf5 format with the freely available HDFView utility of the HDFGroup and
which can be found at https://support.hdfgroup.org/products/java/.

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

8 TCL AND TK EXTENSION


This chapter looks at the advanced features of GiD in terms of expandability and total control. Using the Tcl/Tk extension
you can create script files to automatize any process created with GiD. With this language new windows and functionalities
can be added to the program.

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.

8.1 Event procedures

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

Note: default values are category==GENERAL and propietary==gid

To be called a Tcl procedure must be previously registered, using

GiD_RegisterEvent <event_name> <procedure> ?<category>? ?<propietary>?


<event_name> must be a valid event, like GiD_Event_InitProblemtype
<procedure> is the name of our procedure, with appropiated prototype of arguments
Can know the expected arguments with the command GiD_Info events -args <event_name>, or reading this
documentation.
Avoid to use as procedure name the event_name, to avoid conflicts. It is recommended for example use a prefix or
namespace that suggest that is defined by our own problemtype, etc.)

<category>: GENERAL, PROBLEMTYPE, PLUGIN (default==GENERAL)


used for a better classification.
<propietary>: the name of our problemtype, etc. (according with category, default == gid)

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_UnRegisterEvent <event_name> <procedure> ?<category>? ?<propietary>?


Event procedures 92

To unregister an event, previously registered with GiD_RegisterEvent

GiD_UnRegisterEvents ?<category>? ?<propietary>?


To unregister all events of a category and propietary

GiD_GetRegisteredEventProcs <event_name> ?<category>? ?<propietary>?


To get the list of procedures registered for the event, category and propietary

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

GiD_GetIsRegisteredEventProc <event_name> <procedure> ?<category>? ?<propietary>?


Return 1 if this procedure is registered for the event, 0 else

RaiseEvent_Registered <event_name> <args>


To raise an event from Tcl scripting (providing the appropriated arguments)

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

GiD_Event_AfterNewGIDProject: will be called just after start a new GiD project.

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.

proc GiD_Event_BeforeReadGIDProject { filename } {


...body...
set value ...
return $value
}

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.

proc GiD_Event_AfterReadGIDProject { filename } {


}

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.

proc GiD_Event_AfterInsertGIDProject { filename } {


}

GiD_Event_AfterSetProjectName:

proc GiD_Event_AfterSetProjectName { name } {


}
Read 94

GiD_Event_BeforeOpenFile:

proc GiD_Event_BeforeOpenFile { filename format } {


...body...
set value ...
return $value
}
filename: the full name of the file to be 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.
If it returns -cancel- then the reading is cancelled.

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.

proc GiD_Event_AfterOpenFile { filename format error } {


}

8.1.1.3 Write

GiD_Event_BeforeSaveGIDProject / GiD_Event_AfterSaveGIDProjectwill be called just before save a GiD


project. It receives the argument modelname which is the path of the model folder, without the .gid extension.
If GiD_Event_BeforeSaveGIDProject returns -cancel- then the writting is cancelled.

proc GiD_Event_BeforeSaveGIDProject { modelname } {


... body ...
set value ...
return $value
}

proc GiD_Event_AfterSaveGIDProject { modelname } {


}

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.

proc GiD_Event_AfterSaveAsGIDProject { old_modelname new_modelname } {


}

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.

proc GiD_Event_AfterSaveFile { filename format error } {


}

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

proc GiD_Event_AfterSaveImage { filename format } {


}

8.1.1.4 Geometry

GiD_Event_AfterCreatePoint/Line/Surface/Volume: will be called just after create the entity, providing its number

proc GiD_Event_AfterCreatePoint { num } {


}
Geometry 95

proc GiD_Event_AfterCreateLine { num } {


}

proc GiD_Event_AfterCreateSurface { num } {


}

proc GiD_Event_AfterCreateVolume { num } {


}

GiD_Event_BeforeDeletePoint/Line/Surface/Volume: will be called just before delete the entity, providing its
number

proc GiD_Event_BeforeDeletePoint { num } {


}

proc GiD_Event_BeforeDeleteLine { num } {


}

proc GiD_Event_BeforeDeleteSurface { num } {


}

proc GiD_Event_BeforeDeleteVolume { num } {


}

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.

proc GiD_Event_AfterRenumber { useof leveltype renumeration } {


}

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]
}

8.1.1.5 Copy / Move

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

proc GiD_Event_BeforeCopy { useof transformation error } {


}

proc GiD_Event_AfterCopy { useof transformation error } {


}

proc GiD_Event_BeforeMove { useof transformation error } {


}

proc GiD_Event_AfterMove { useof transformation error } {


}

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

proc GiD_Event_BeforeMeshGeneration { element_size } {


...body...
set value ...
return $value
}

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.

proc GiD_Event_AfterMeshGeneration { fail } {


}

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_BeforeMeshErrors { filename } {


...body...
set value ...
return $value
}

GiD_Event_BeforeMeshProgress: to start some progressbar, provide an approximated information of the amount of


entities to be meshed

proc GiD_Event_BeforeMeshProgress { num_other num_lines num_surfaces num_volumes } {


}

GiD_Event_MeshProgress: to update some progressbar, provide approximated percents of the progress

proc GiD_Event_MeshProgress { percent_total percent_other percent_lines percent_surfaces percent_volumes


num_nodes num_elements } {
}

GiD_Event_AfterMeshProgress: to end some progressbar

proc GiD_Event_AfterMeshProgress { } {
}

GiD_Event_AfterChangeMesh:

proc GiD_Event_AfterChangeMesh { num_nodes num_elements } {


}

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.

proc GiD_Event_AfterRenumber { useof leveltype renumeration } {


}

8.1.1.7 Dimensions

GiD_Event_BeforeDeleteDimension: will be called just before delete the entity, providing its number

proc GiD_Event_BeforeDeleteDimension { num } {


}

GiD_Event_AfterCreateDimension: will be called just after create the entity, providing its number

proc GiD_Event_AfterCreateDimension { num } {


}

8.1.1.8 Layers

GiD_Event_AfterCreateLayer: will be called just after create the layer 'name'


Layers 97

proc GiD_Event_AfterCreateLayer { name } {


}

GiD_Event_AfterRenameLayer: will be called just after the layer 'oldname' has been renamed to 'newname'

proc GiD_Event_AfterRenameLayer { oldname 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.

proc GiD_Event_BeforeDeleteLayer { name } {


...body...
set value ...
return $value
}

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

proc GiD_Event_AfterChangeLayer { name property } {


}

GiD_Event_AfterChangeParentLayer: will be called when moving a layer to another parent of the tree.

proc GiD_Event_AfterChangeParentLayer { oldname newname } {


}

GiD_Event_AfterSetLayerToUse: will be called when setting 'name' as current layer to use

proc GiD_Event_AfterSetLayerToUse { name } {


}

GiD_Event_AfterSendToLayer: will be called when changing entities to the layer 'name'

proc GiD_Event_AfterSendToLayer { name } {


}

GiD_Event_AfterChangeLayersOrSets:

proc GiD_Event_AfterChangeLayersOrSets { num_sets num_off num_back num_transparent } {


}

8.1.1.9 Groups

GiD_Event_AfterCreateGroup: similar to layer commands

proc GiD_Event_AfterCreateGroup { name } {


}

GiD_Event_AfterRenameGroup:

proc GiD_Event_AfterRenameGroup { oldname newname } {


}

GiD_Event_BeforeDeleteGroup: will be called just before delete the group 'name'


If it returns -cancel- the deletion is cancelled.

proc GiD_Event_BeforeDeleteGroup { name } {


...body...
set value ...
return $value
}

GiD_Event_AfterDeleteGroup:

proc GiD_Event_AfterDeleteGroup { name } {


}
Groups 98

GiD_Event_AfterChangeGroup: property could be color, visible, state, allowed_types

proc GiD_Event_AfterChangeGroup { name property } {


}

GiD_Event_AfterGroupParentGroup: will be called when moving a group to another parent of the tree.

proc GiD_Event_AfterChangeParentGroup { oldname newname } {


}

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

8.1.2.1 Start / End

GiD_Event_InitProblemtype / GiD_Event_BeforeInitProblemtype: will be called when the problem type is selected.


It receives the dir argument, which is the absolute path to the problem_type_name.gid directory, which can be useful
Start / End 99

inside the routine to locate some alternative files.

proc GiD_Event_InitProblemtype { dir } {


}

proc GiD_Event_BeforeInitProblemtype { dir } {


}

Note:InitGIDProject is a deprecated alias of GiD_Event_InitProblemtype

GiD_Event_EndProblemtype: will be called when this project is about to be closed. It has no arguments.

proc GiD_Event_EndProblemtype {} {
}

Note: EndGIDProject is a deprecated alias of GiD_Event_EndProblemtype

GiD_Event_AfterChangeProblemtype

proc GiD_Event_AfterChangeProblemtype { oldproblemtype newproblemtype } {


}

GiD_Event_AfterSetProblemtypeName

proc GiD_Event_AfterSetProblemtypeName { name } {


}

8.1.2.2 Read / Write

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.

proc GiD_Event_LoadModelSPD { filespd } {


}

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.

proc GiD_Event_LoadProblemtypeSPD { filespd } {


}

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.

proc GiD_Event_SaveModelSPD { filespd } {


}

Note:SaveGIDProject is a deprecated event alias of GiD_Event_SaveModelSPD

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.

proc GiD_Event_BeforeTransformProblemType { file oldproblemtype newproblemtype } {


...body...
set value ...
Transform 100

return $value
}

GiD_Event_AfterTransformProblemType: will be called just after transforming a model from a problem type to a new
problem type version.

It must return a list of the items: value and messages


value 1 if there were model changes done in this procedure, 0 else.
If it returns -cancel- as a special value, then the transformation messages won't be shown.
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.
messages: explains the transforming operations done.

proc GiD_Event_AfterTransformProblemType { file oldproblemtype newproblemtype messages } {


...body...
set value ...
return [list $value $messages]
}

8.1.2.4 Materials

GiD_Event_AfterCreateMaterial: will be called just after create the material 'name'

proc GiD_Event_AfterCreateMaterial { name } {


}

GiD_Event_AfterRenameMaterial: will be called just after the mateial 'oldname' has been renamed to 'newname'

proc GiD_Event_AfterRenameMaterial { oldname newname } {


}

GiD_Event_BeforeDeleteMaterial: will be called just before delete the material 'name'


If it returns -cancel- the material deletion is cancelled.

proc GiD_Event_BeforeDeleteMaterial { name } {


...body...
set value ...
return $value
}

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)

proc GiD_Event_AfterChangeMaterial { name changedfields } {


}

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.

proc GiD_Event_AfterAssignMaterial { name leveltype } {


}

8.1.2.5 Conditions

GiD_Event_AfterCreateCondition: will be called just after create the condition 'name'

proc GiD_Event_AfterCreateCondition { name } {


}

GiD_Event_BeforeDeleteCondition: will be called just before delete the condition 'name'


If it returns -cancel- the material condition is cancelled.

proc GiD_Event_BeforeDeleteCondition { name } {


...body...
set value ...
return $value
Conditions 101

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)

proc GiD_Event_AfterChangeCondition { name changedfields } {


}

8.1.2.6 Intervals

GiD_Event_AfterCreateInterval: will be called just after a new interval is created, providing its integer id

proc GiD_Event_AfterCreateInterval { interval_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.

proc GiD_Event_BeforeDeleteInterval { interval_id } {


...body...
set value ...
return $value
}

GiD_Event_AfterDeleteInterval: will be called just after a interval is deleted, providing its integer id

proc GiD_Event_AfterDeleteInterval { interval_id } {


}

GiD_Event_AfterSetIntervalToUse: will be called just after a the current interval is changed, providing its integer id

proc GiD_Event_AfterSetIntervalToUse { interval_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)

proc GiD_Event_AfterChangeModelUnitSystem { old_unit_system new_unit_system } {


}

8.1.2.8 Calculation file

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.

proc GiD_Event_BeforeWriteCalculationFile { file } {


...body...
set value ...
return $value
}

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.

proc GiD_Event_AfterWriteCalculationFile { file error } {


...body...
set value ...
return $value
}

GiD_Event_SelectOutputFilenames: allow to select a custom list of output files to be shown by


Calculation file 102

"Calculate->View process info" (in case that we want to not use the list of 'OutFiles' declared in the
bat file).

proc GiD_Event_SelectOutputFilenames { filenames } {


...
return $new_filenames
}

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.

proc GiD_Event_SelectGIDBatFile { dir basename } {


...body...
set value ...
return $value
}

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.

proc GiD_Event_BeforeRunCalculation { batfilename basename dir problemtypedir gidexe args } {


...body...
set value ...
return $value
}

GiD_Event_AfterRunCalculation: will be called just after the analysis finishes.


If it returns -cancel-as a value then the window that inform about the finished process will not be opened.
It receives as arguments:
basename: the short name model;
dir: the full path to the model directory;
problemtypedir: the full path to the Problem Types directory;
where: must be local or remote (remote if it was run in a server machine, using ProcServer);
error: returns 1 if an calculation error was detected;
errorfilename: an error filename with some error explanation, or nothing if everything was ok.

proc GiD_Event_AfterRunCalculation { basename dir problemtypedir where error errorfilename } {


...body...
set value ...
return $value
}

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

8.1.3.1 Start / End

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 {} {
}

GiD_Event_InitGIDPostProcess: will be called when postprocessing starts. It has no arguments.

proc GiD_Event_InitGIDPostProcess {} {
...body...
set value ...
return $value
}

GiD_Event_AfterSetPostModelName

proc GiD_Event_AfterSetPostModelName { name } {


}

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

GiD_Event_AfterCreateGraphSet: will be called when a new graphset is created

proc GiD_Event_AfterCreateGraphSet { name } {


}

GiD_Event_BeforeDeleteGraphSet: will be called just before delete the graphset 'name'


GUI 108

proc GiD_Event_MessageBoxOptionsButtons { title question message_small options labels image } {


}

proc GiD_Event_MessageBoxOptionsButtonsModeless { title question message_small options labels image } {


}

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.

proc GiD_Event_MessageBoxGetNormal { title } {


}

proc GiD_Event_MessageBoxGetFilename { category mode title initial_filename file_types default_extension


multiple more_options } {
}

8.1.4.2 View

GiD_Event_AfterChangeViewMode: useof: can be "GEOMETRYUSE", "MESHUSE", "POSTUSE" or "GRAPHUSE".

proc GiD_Event_AfterChangeViewMode { useof } {


body...
}

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_GetBoundingBox{ useof } {


...body...
return [list $xmin $ymin $zmin $xmax $ymax $zmax]
}

Note:TclCalcModelBoundaries is a deprecated alias of GiD_Event_GetBoundingBox.

GiD_Event_AfterDrawModel: to allow some OpenGL custom draw, before swapbuffers.

proc GiD_Event_AfterDrawModel {} {
}

GiD_Event_AfterRedraw:

proc GiD_Event_AfterRedraw {} {
}

GiD_Event_AfterChangeRenderMode: render_mode could be "flat", "normal", "smooth",...

proc GiD_Event_AfterChangeRenderMode { render_mode } {


}

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"

proc GiD_Event_AfterChangeLicenceStatus { status } {


}

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

proc GiD_Event_AfterProcess { words is_rotation } {


}

GiD_Event_BeforeSetVariable / GiD_Event_AfterSetVariable:will be called just before or after set the value of a GiD
variable

proc GiD_Event_BeforeSetVariable { variable value } {


#to avoid change the variable return -cancel-
}

proc GiD_Event_AfterSetVariable { variable value } {


}

GiD_Event_AfterSaveKernelDefaults:will be called just after save the C++ variables in the user preferences file

proc GiD_Event_AfterSaveKernelDefaults { filename } {


}

8.2 GiD_Process function

GiD_Process command_1 command_2 ...

Tcl command used to execute GiD commands.


This is a simple function, but a very powerful one. It is used to enter commands directly inside the central event manager.
The commands have the same form as those typed in the command line within GiD.

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:

GiD_Process Mescape Geometry Create Line 0,0,0 10,0,0 escape

Note: Mescape is a multiple 'escape' command, to go to the top of the commands tree.

8.3 GiD_Info function

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

GiD_Info conditions ovpnt | ovline | ovsurf | ovvol | ovlayer | ovgroup


This command returns a list of the conditions in the project. One of the arguments ovpnt, ovline, ovsurf, ovvol must be
given to indicate the type of condition required, respectively, conditions over points, lines, surfaces or volumes.

Instead of ovpnt, ovline, ovsurf, ovvol, ovlayer, ovgroup the following options are also available:

?-interval <intv>? ?-array? ?-localaxes | -localaxesmat | -localaxescenter | -localaxesmatcenter?


<condition_name> ?geometry|mesh|groups ?<entity_id>|-count?

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.

Other options available if the condition name is given are


otherfields: to get some special fields of that condition
book: to get the book of the condition.
condmeshtype: to know how the condition was defined to be applied on mesh entities: over nodes, over body elements,
over face elements, over face elements multiple
canrepeat: to know how the condition was defined to be applied only once or more to the same entity: values are 0 or 1
groupallow: to know how the condition 'over groups' was defined to allow the group to have entities of one or more kinds
of {points lines surfaces volumes nodes elements faces}

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"

in: GiD_Info conditions Point-Weight


out: "ovpnt 1 Weight 0"

in: GiD_Info conditions Point-Weight geometry


out: {{E 8 - 2334} {E 20 - 2334} {E 31 - 343}}

in: GiD_Info conditions Point-Weight geometry -count


out: "3"

in: GiD_Info Conditions -localaxes Concrete_rec_section mesh 2


out: {E 2 - {4.7123889803846897 1.5707963267948966 0.0}}

8.3.3 coordinates

GiD_Info Coordinates ?-no_model? <point_id>|<node_id> [geometry|mesh]

This command returns the coordinates (x,y,z) of a given point or node.


If -no_model flag is specified then entities are stored in a special container, it doesn't belong to the model

8.3.4 check

GiD_Info check

This command returns some specialized entities check.


For lines it has the following syntax:
GiD_Info check line <entity_id> isclosed
check 111

For surfaces:
GiD_Info check surface <entity_id> isclosed | isdegeneratedboundary | selfintersection
And for volumes:
GiD_Info check volume <entity_id> orientation | boundaryclose

The result for each argument is:


line | surface | volume: Type of entity.
<entity_id>: The number of an entity.
isclosed: For lines: 1 if start point is equal to end point, 0 otherwise. For surfaces: A surface is closed if its
coordinate curves (of the full underlying surface) with parameter 0 and 1 are equal. It returns a bit encoded
combination of closed directions: 0 if it is not closed, 1 if it is closed in u, 2 if it is closed in v, 3 if it is closed in
both u and v directions.
isdegeneratedboundary: A surface is degenerated if some boundary in parameter space (south, east, north or
west) becomes a point in 3d space. It returns a bit encoded combination of degenerated boundaries, for example:
0 if it is not degenerated, 9=2^0+2^3 if south and west boundaries are degenerated.
selfintersection: Intersections check between surface boundary lines. It returns a list of detected intersections.
Each item contains the two line numbers and their parameter values.
orientation: For volumes, it returns a two-item list. The first item is the number of bad oriented volume surfaces,
and the second item is a list of these surfaces' numbers.
boundaryclose: For volumes, a boundary is topologically closed if each line is shared by two volume surfaces. It
returns 0 if it is not closed and must be corrected, or 1 if it is closed.

Example:
in: GiD_Info check volume 5 orientation
out: 2 {4 38}

8.3.5 events

GiD_Info events ?-deprecated? ?-args <event_name>?

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

GiD_Info events -deprecated


return a list of Tcl events that are mark as deprecated, there is a new similar event that is recommendable to be used
instead.
deprecated events are also raised for back compatibility with problemtypes that are already implementing them.

GiD_Info events -args <event_name>


Return the list of arguments of the event

Event procedures -pag. 91-

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

If GiD is a x32 binary executable, then this command returns 32.


If GiD is a x64 binary executable, then this command returns 64.

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

This command returns the coordinates (x,y,z) of the center of rotation.

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

-bbox ?-use geometry|mesh? <layer_name_1> <layer_name_2> ...


Returns an item with a list of six real numbers representiong two coordinates (x1,y1,z1,x2,y2,z2) which define the
bounding box of the entities that belong to the list of layers.
If the option -use geometry|mesh is used, the command returns the bounding box of the geometry or the
bounding box of the mesh.
If the list of layers is empty, the maximum bounding box is returned.
?-count? -entities <type> ?-elementtype <elementtype>? ?-higherentity <num>?: One of the following
arguments must be given for <type>: nodes, elements, points, lines, surfaces or volumes. A layer name
must also be given. The command will return the nodes, elements, points, lines surfaces or volumes of that layer.
If -count is set then the amound of entities is returned instead of the list of its ids.

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"

in: GiD_Info layers -on


out: "layer1 layer2"

in: GiD_Info layers -entities lines layer2


out: "6 7 8 9"

in: GiD_Info layers -count -entities lines layer2


out: 4

8.3.14 library

GiD_Info library
To access to information of some linked libraries (e.g. gid mesh libraries)

GiD_Info library names


This command returns a list of libraries

GiD_Info library version <library_name>


This command returns a string with the version of the code of the library.
<library_name> must be one of the ones returned by GiD_Info library names

GiD_Info library format_version <library_name>


This command returns a string with the version of the data format used to transmit the input/output of the library
<library_name> must be one of the ones returned by GiD_Info library names
The data format could be transmitted in memory or serialized in a .gidml file with HDF5 syntax.

8.3.15 listmassproperties

GiD_Info ListMassProperties ?-no_model? Points|Lines|Surfaces|Volumes|Nodes|Elements <entity_id>

If -no_model flag is specified then entities are stored in a special container, it doesn't belong to the model

This command returns properties of the selected entities.


It returns the length if entities are lines, area if surfaces, volume if volumes, or the center of gravity if entities are
nodes or elements. It has the following arguments:
Points/Lines/Surfaces/Volumes/Nodes/Elements: Type of entity.
entity_id: The number of an entity. It is also possible to enter a list of entities (e.g.: 2 3 6 45) or a range of entities
(e.g.: entities from 3 to 45, would be 3:45).

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

GiD_Info list_entities ?-no_model? Status|PreStatus|PostStatus

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:

in: GiD_Info list_entities PreStatus


out:
Project name: UNNAMED
Problem type: UNKNOWN
Changes to save(0/1): 1
Necessary to mesh again (0/1): 1
Using LAYER: NONE

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 points with 0 conditions: 6


number of lines: 6
number of lines with 1 higher entities: 6

number of lines with 0 conditions: 6


number of surfaces: 1
number of surfaces with 0 higher entities: 1

number of surfaces with 0 conditions: 1


number of volumes: 0

number of nodes: 8
number of nodes with 0 conditions: 8
number of Triangle elements: 6
number of elements with 0 conditions: 6

Total number of elements: 6


Last size used for meshing: 10
Internal information:
Total MeshingData:0 Active: 0 0%

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

in: GiD_Info magnitudes 0


out: ACCELERATION ANGLE LENGTH MASS STRENGTH PRESSURE TEMPERATURE

GiD_Info magnitudes 0|1 <magnitude_name> units


return a list of unit names and conversion factors from the reference unit (the first listed)
<magnitude_name> is the name of the magnitude, like LENGTH or other magnitudes that could be defined by the
problemtype

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

This command returns a list of the materials in the project.


GiD_Info materials(<bookname>) returns only the materials that belong to the book <bookname>)

These options are also available:


<material_name>: If a material name is given, its properties are returned.
It is also possible to add the option otherfields to get the fields of that material, or the option book to get the book of
that material.
books: If this option is given, a list of the material books in the project is returned.

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)

NumElements <Elemtype> ?<nnode>?: returns the number of elements of the mesh.


Elemtype can be: Line | Triangle | Quadrilateral | Tetrahedra | Hexahedra | Prism | Pyramid | Point |
Sphere | Circle | Any.
nnode is the number of nodes of an element, if this argument is missing the amount does not take into account the
number of nodes.
NumNodes: Returns the total number of nodes of the mesh.
MaxNumElements: Returns the maximum element number.
MaxNumNodes: Returns the maximum node number.

Elements <Elemtype> ?<first_id>? ?<last_id>? ?-sublist|-array? ?-avoid_frozen_layers? ?-layer


<layername>? ?-group <groupname>?: Returns a list with the element number, the connectivities , radius if it
is a sphere, normal if it is a circle, and the material number, from 'first_id' to 'last_id, if they are specified.

Nodes ?<first_id>? ?<last_id>? ?-sublist|-array? ?-avoid_frozen_layers? ?-layer <layername>?


?-group <groupname>?: Returns a list with the node number and x y z coordinates, from 'first_id' to 'last_id', if
they are specified
Modifiers:
-sublist : Instead of a plane list it returns each result item as a Tcl list (enclosed in braces)
mesh 117

-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"

in: GiD_Info Mesh MaxNumNodes


out: "1623"

set data [GiD_Info Mesh EmbeddedDistances]


lassign $data nodes distances
set length [objarray length $nodes_list]
for {set i 0} {$i < $length} {incr i } {
set node_id [objarray get $nodes $i]
set distance [objarray get $distances $i]
W "$node_id $distance"
}

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.

This command has the following arguments:


MinAngle / MaxAngle / ElemSize / ElemMinEdge / ElemMaxEdge / ElemShapeQuality /
ElemMinJacobian / Radius: quality criterion.
Line / Triangle / Tetrahedra / Quadrilateral / Hexahedra / Prism / Pyramid / Point / Sphere / Circle:
type of element.
<min_value>: e.g. minimum number of degrees accepted.
<max_value>: e.g. maximum number of degrees accepted.
if min_value and max_value are set to 0 then limits will be automatically set to the minimum and maximum of the mesh
<num_divisions>: number of divisions.

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

Returns information about the Opengl/glew version and renderer.

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

GiD_Info bounding_box ?point|line|surface|volume <entity_id>?

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

The result for each argument is:


line|surface: Type of entity.
<entity_id>: The number of an entity.
coord: 3D coordinate of the point with parameter t (line) or u,v (surface).
deriv_t: First curve derivative at parameter t.
deriv_tt: Second curve derivative at parameter t.
t_fromcoord: t parameter closest to a 3D point. It is possible to specify alse the <t_seed>
t_fromrelativelength: parameter corresponding to a relative (from 0 to 1) arc length t
length_to_t: lenght of the curve until the parameter t (if t=1.0 then it is the total lengh)
deriv_u,deriv_v: First partial u or v surface derivatives.
deriv_uu,deriv_vv,deriv_uv: Second surface partial derivatives.
normal: Unitary surface normal at u,v parameters.
uv_fromcoord: u,v space parameters closest to a 3D point. It is possible to specify alse the <u_seed> <v_seed>
maincurvatures: return a list with 8 numbers: v1x v1y v1z v2x v2y v2z c1 c2
v1x v1y v1z : first main curvature vector direction (normalized)
v2x v2y v2z : second main curvature vector direction (normalized)
c1 c2: main curvature values
uv_projection_z_fromcoord: to get the location u v of a point x y projected in direction z on a surface (the z of
the point must not be supplied). It is possible to specify alse the <u_seed> <v_seed>

e.g: set uv [GiD_Info parametric surface $id uv_projection_z_fromcoord $x $y]

Note: The vector derivatives are not normalized.


Example:
in: GiD_Info parametric line 26 deriv_t 0.25
out: 8.060864 -1.463980 0.000000

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

GiD_Info postproces arewein


This command returns YES if the user is in the GiD postprocess, and NO, if not.

GiD_Info postprocess get


This command returns information about the GiD postprocess. The following options are available:
all_volumesets: Returns a list of all volumes.
all_surfacesets: Returns a list of all surfaces.
all_cutsets: Returns a list of all cuts.
all_graphs: Returns a list of all graphs.
postprocess 119

all_line_graphs: Returns a list of the line graphs.


all_volumes_colors: Returns a list of the volume colors used in the project. Colors are represented in RGB
hexadecimal format. Example: #000000 would be black, and #FFFFFF would be white.
all_surfaces_colors: Returns a list of the surface colors used in the project. Colors are represented in RGB
hexadecimal format. Example: #000000 would be black, and #FFFFFF would be white.
all_cuts_colors : Returns a list of the cut colors used in the project. Colors are represented in RGB hexadecimal
format. Example: #000000 would be black, and #FFFFFF would be white.
cur_volumes: Returns a list of the visible volumes.
cur_surfaces: Returns a list of the visible surfaces.
cur_cuts: Returns a list of the visible cuts.
all_display_styles: Returns a list of all types of display styles available.
cur_display_style: Returns the current display style.
all_display_renders: Returns a list of all types of rendering available.
cur_display_render: Returns the current rendering method.
num_lights: Returns the current number of active lights. The option can be changed in
View->Render->Lights menu.
all_display_culling: Returns a list of all types of culling available.
cur_display_culling: Returns the current culling visualization.
cur_display_transparence: Returns Opaque or Transparent depending on the current transparency.
Transparency is chosen by the user in the Select & Display Style window.
cur_display_body_type: Returns Massive if the option Massive is selected in the Select & Display
Style window. It returns Hollow if that option is not activated.
all_analysis: Returns a list of all analyses in the project.
all_steps "analysis_name": Returns the number of steps of "analysis_name".
cur_analysis: Returns the name of the current analysis.
cur_step: Returns the current step.
is_mesh_variable_along_steps : Returns 1 if the postprocess mesh is changing along the time
all_results_views: Returns all available result views.
all_graphs_views: Returns all available graphs types.
graphs_option: ?-allowed_values? <graphset_property>| <graph_property> <graph_name>
whith -allowed_values flag it is returned a list with the possible values of the property instead of the current property
value.
To get graphset properties
<graphset_property> could be: CurrentStyle Grids MainTitle TitleVisible LegendLocation CoordType AngleAxis
AngleUnit ShowOrigAxes ShowRadMarks ColorOrig ColorRad PatRad OutlineOnModel ShowGraphs X_axis Y_axis
ShowModelView LineWidth PointSize
To ge graph properties (must specify also the <graph_name>)
<graph_property> could be: Style Color ColorAsCFill LineWidth Pattern PatternFactor PointSize Title NumResults
ResultsX ResultsY LabelX LabelY Visible
axis_option ShowAxes|Type|Dimensions|AxesWidth|AxisXColor|AxisYColor|AxisZColor|
XYZLabels|Grid|GridXColor|GridYColor|GridZColor|GridXDivisions|GridYDivisions|
GridZDivisions|FactorPatron|Patron|Label|LabelColorAxes|LabelType|VarFontSize|LabelColor|Arrow|ArrowXColor
: Returns the current value for the specified property of the drawing axes option.
cur_results_view: Returns the current result view.
cur_results_list: This option has one more argument: the kind of result visualization must be given. The
available kinds of result visualization are given by the option all_results_views. The command returns a list of all
the results that can be represented with that visualization in the current step of the current analysis.
result_unit "result_name": Returns the unit name, the multiplier factor and the addition factor of the result
"result_name".
results_list: This option has three arguments: the first argument is the kind of result visualization. The available
kinds of result visualization are given by the option all_results_views. The second argument is the analysis
name. The third argument is the step number. The command returns a list of all the results that can be
represented with that visualization in the given step.
cur_result: Returns the current selected result. The kind of result is selected by the user in the View
results window.
cur_components_list "result_name": Returns a list of all the components of the result "result_name".
cur_complex_components_list "result_name": Returns a list of all the complex components of the result
postprocess 120

"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

cur_diagram_factor "result_name" "analysis_name" "step_value": Returns the current diagram factor of


"result_name" "analysis_name" "step_value".
cur_contour_limits: Returns the minimum and maximum value of the current value.
cur_contour_color_config: Returns the current values in the More color options window in
Postprocess->Contour fill and lines preferences window.
contour_lines_width: Returns the contour lines width value.
info_point_size: Returns the current values for the Point element options in Postprocess->Mesh
elements preferences window.
info_point_size_factor "analysis_name" "step_value" "result_name" "component_name": Returns the
current point element factor for "analysis_name" "step_value" "result_name" "component_name".
edge_colour: Returns the edge color for drawing the elements.
info_sphere_size: Returns the current values for the Sphere element options in Postprocess->Mesh
elements preferences window.
info_sphere_size_factor "analysis_name" "step_value" "result_name" "component_name": Returns the
current sphere element factor for "analysis_name" "step_value" "result_name" "component_name".
info_line_size: Returns the current values for the Line element options in Postprocess->Mesh
elements preferences window.
info_stream_line_size: Returns the stream line size value.
current_color_scale: Returns a list of the colors used for the color scale; the first element of the list is the
number of colors. Each color is represented in RGB hexadecimal format. Example: #000000 would be black, and
#FFFFFF would be white.
info_legend: Returns the current values showed in the legend.
propertymassive|transparent|transparency|displaystyle|edgewidth|visibility|visualizeresults
"mesh_name": returns value of the specified property for the entered mesh name.
results_view_list: Returns the current result view, analysis name, step, result name and component name.
diagram_options: Returns the current value in Postprocess->Line diagrams preferences window.
result_surface_options: Returns the current values in Postprocess->Result surface preferences window.
result_stream_lines_options: Returns the current stream lines detail render, the color mode, the color of
monochrome mode and the initial rotation. The values can be found inPostprocess->Stream lines preferences
window.
vector_detail: Returns the current value for vector detail option.
vector_size: Returns the current value for vector size option.
AllVectors: Returns "Yes" if the draw interior vectors option is enabled, "No" if don't.
VectorNumCols: Returns the current number of colors for vectors when the color mode is set to "by modules".
VMonoColor: Returns the current color for vectors when the color mode is set to "monochrome".
VectorTensionColour: Returns the current color for tension vector color option.
VectorCompressionColour: Returns the current color for compression vector color option.
VectorColour: Returns the current color mode for vectors.
VectorOffset: Returns the current value for vector offset option.
VectorFilterFactor: Returns the current value for vector filter factor option.
isosurface_options: Returns the current values in Postprocess->Iso surfaces preferences window.
legends_state: Returns the current values in Postprocess->Legends and comments preferences window.
stream_draw_arrows Arrows|ArrowsSize|ArrowsFreq|ArrowsColor: Returns the current values for draw
arrows?, arrows size, arrows frequency or arrows color option.
stream_label: Returns the current value for stream line label option.
stream_length: Returns the current value for stream line maximum lenght option.
stream_max_points: Returns the current value for stream line maximum points option.
Results_Preference "result_name" "visualization" "property": Returns the current value of the preference
defined by "result_name" "visualization" "property".
scale_result_options: Returns the current values for options in Utilities->Scale result view menu.
colour_map_list: Returns the list of available color maps for contour fill visualization.
view_follows_node_options: Returns the current values for "view centered and following node" in the
Window->Animate window.

8.3.28 problemtypepath

GiD_Info problemtypepath

This command returns the absolute path to the current problem type.
project 122

8.3.29 project

GiD_Info Project <item>?

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"

in: GiD_Info Project ModelName


out: "e:\models\car_model"

8.3.30 unitssystems

GiD_Info unitssystems ?gid|prj|usersys|modunit|prbsys|udstate|magused?

return information about the sytems of units

GiD_Info unitssystems
return 1 if the problemtype is using units, 0 else

GiD_Info unitssystems gid|prj|usersys|modunit|prbsys|udstate|magused

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

GiD_Info variables -pre|-post|<variable_name>


This command returns the value of the variable indicated.
GiD variables can be found in the Right buttons menu (see UTILITIES>Tools from Reference Manual), under the option
Utilities -> 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

This command returns the current view parameters. Something like:


{x -13.41030216217041 13.41030216217041} {y 10.724431991577148 -10.724431991577148} {z -30.0 30.0} {e
10.0} {v 0.0 0.0 0.0} {r 1.0}
{m 1.0 0.0 0.0 0.0 0.0 1.0 0.0 0.0 0.0 0.0 1.0 0.0 0.0 0.0 0.0 1.0} {c 0.0 0.0 0.0} {pd 0.0} {pno 0.0} {pfo 0.0} {pf
4.0} {pv 0.0} {NowUse 0}
{DrawingType 0} {LightVector 90.0 90.0 150.0 0.0}

See VIEW>View entry>Save/Read View of Reference Manual for a brief explanation of this parameters

8.4 Special Tcl commands

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

GiD_Project set <option> ?<value>?


To set on off or ask the current state of some options, to control the redraw and wait state of GiD:
option could be disable_graphics|disable_windows|disable_warnline|disable_graphinput|disable_graphinterp|disable_writeb
atch|waitstate|windows_layout
value 0|1
GiD_Project set windows_layout value <1 2LR 2UD 3L 3U 3R 3D 4 EXT>

GiD_Project view <option> ?<value>?


Project 124

To handle view parameters.


GiD_Project view clip_planes_x ?{left right}?
GiD_Project view clip_planes_y ?{top bottom}?
GiD_Project view clip_planes_z ?{near far}?
GiD_Project view clip_planes_margin ?value?
GiD_Project view rotation_vector ?{x y z}?
GiD_Project view rotation_factor ?value?
GiD_Project view rotation_matrix ?{v11 ... v44}?
GiD_Project view rotation_center ?{x y z}?
GiD_Project view perspective_distance ?value?
GiD_Project view perspective_ortho_near ?value?
GiD_Project view perspective_ortho_far ?value?
GiD_Project view perspective_factor ?value?
GiD_Project view perspective_view ?value?
GiD_Project view mode ?GEOMETRYUSE|MESHUSE|POSTUSE|GRAPHUSE?
GiD_Project view render_mode ?value?
GiD_Project view ligth_vector ?{x y z ?w?}?

8.4.1.1 batchfile

GiD_Project batchfile
To handle the batch file where processed commands are recorded

GiD_Project batchfile get name


It returns the file name of the batch, associated to the current model
GiD_Project batchfile flush
To force flush in the file (e.g. to read its updated contents)

8.4.1.2 set

GiD_Project set <option> ?<0|1>?


To set on off or ask the current state of some options, to control the redraw and wait state of GiD:
<option> could be disable_graphics|disable_windows|disable_warnline|disable_graphinput|disable_writebatch
|waitstate|windows_layout

GiD_Project set disable_graphics ?<0|1>?


The value 0/1 Enable/Disable Graphics (GiD does not redraw)

EXAMPLE to disable the redraw:


GiD_Project set disable_graphics 1

GiD_Project set disable_windows ?<0|1>?


The value 0/1 Enable/Disable Windows (GiD displays, or not, windows which require interaction with the user)

EXAMPLE to disable the interaction windows:


GiD_Project set disable_windows 1

GiD_Project set disable_warnline ?<0|1>?


The value 0/1 Enable/Disable printing messages in the lower messages bar.

GiD_Project set disable_graphinput ?<0|1>?


The value 0/1 Enable/Disable GraphInput (enable or disable peripherals: mouse, keyboard, ...)

EXAMPLE to disable the peripherals input:


GiD_Project set disable_graphinput 1

GiD_Project set disable_writebatch ?<0|1>?


The value 0/1 Enable/Disable writting the batch file that records the commands send to be processed.

GiD_Project set waitstate ?<0|1>?


The value 0/1 Enable/Disable the Wait state (GiD displays a hourglass cursor in wait state)

EXAMPLE to set the state to wait:


set 125

GiD_Project set waitstate 1

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

GiD_Project set windows_layout ?<1 2LR 2UD 3L 3U 3R 3D 4>?


To set or ask the layout of the drawing windows
1-> 1 window
2LR -> 2 windows placed horizontally (Left-Right)
2UD -> 2 windows placed vertically (Up - Down)
3L -> 3 windows, the biggest on the Left
3U-> 3 windows, the biggest Up
3R -> 3 windows, the biggest on the Right
3D -> 3 windows, the biggest Down
4 -> 4 windows

8.4.1.3 view

GiD_Project view <option> ?<value>?


To handle view parameters
<option> could be
clip_planes_x|clip_planes_y|clip_planes_z|clip_planes_margin|rotation_vector|rotation_factor|rotation_mat
rix|rotation_center|perspective_distance|perspective_ortho_near|perspective_ortho_far|perspective_factor|
perspective_view|view_mode|render_mode|ligth_vector

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

GiD_Project view ligth_vector ?{x y z ?w?}


Light direction.
If w is missing the is defaulted to 0.0 and the ligth will be directional

8.4.2 Geometry

GiD_Geometry -v2 ?-no_model? create|delete|get|list point|line|surface|volume <num>|append <data>


To create, delete, get data or list the identifiers of geometric entities:
<num>|append: <num> is the entity identifier (integer > 0). You can use the word 'append' to set a new
number automatically.
<data>: is all the geometric definition data (create) or a selection specification (delete, get or list):

-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

create: to make new geometric entities


GiD_Geometry create volume <num>|append volume|contactvolume <layer> {surface1...surfacen}
{verso1...verson} ?<transformation_matrix>?
for contactvolume is necessary to specify the <transformation_matrix> : a vector of 16 reals representing a 4x4
transformation matrix that maps surface1 into surface2
GiD_Geometry create surface <num>|append planarsurface|nurbssurface|coonsurface|meshsurface|contactsurfac
e<layer> {line1...linen} {verso1...verson} <geometrical_data>
<geometrical data> depends of each entity type (see get command)
GiD_Geometry create line <num>|append stline|nurbsline|arcline <layer> <inipoint> <endpoint>
<geometrical_data>
Instead the NURBS parameters is possible to create a curve that interpolates a list of points (also tangents at start
and end can be specified)
GiD_Geometry -v2 create line <num> | append nurbsline <layer> <inipoint> <endpoint> {-interpolate {p1_x
p1_y p1_z ... pn_x pn_y pn_z} ?-tangents {t0_x t0_y t0_z} {t1_x t1_y t1_z}?}
GiD_Geometry create line <num>|append stline <layer> <inipoint> <endpoint>
GiD_Geometry create point <num>|append <layer> <point_x> <point_y> <point_z>

delete: to erase model entities


GiD_Geometry delete point|line|surface|volume <args> with <args>: num numa:numb numa: layer:layer_name

get: to obtain all the geometrical data to define a single entity


GiD_Geometry -v2 get point|line|surface|volume <args>
with <args>: num ?line_uv <line_index> | index_boundaries | has_holes | render_mesh | mesh?
line_uv <line_index> extra arguments must be only used in case of nurbs surfaces, to get the information of the
<line_index> curve (integer from 1 to the number of trimming curves) on the surface, defined in its uv space
parameter.

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)

has_holes: it return 0 if the surface doesn't has any hole, 1 else

-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)

GiD_Geometry get point <num>


will return:
<layer> <geometrical data>
<layer> is the layer name
<geometrical data> the coordinates x y z

GiD_Geometry get line <num>


Geometry 127

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)

GiD_Geometry get line <line_id> render_mesh


Will return the information of the render mesh of the line <line_id> as a list: {element_type element_num_nodes
coordinates connectivities ts}
element_type: line
element_num_nodes: 2
coordinates: objarray with 3*num_nodes items of float with x y z of the render mesh nodes.
connectivities: objarray with element_num_nodes*num_elements of int with the connectivities of the elements
(zero-based)
ts: optional objarray with num_nodes items of float with t space parameters (from 0.0 to 1.0) of each node. (it
is optional, the array could have zero length)

GiD_Geometry get surface <num>


will return:
<type> <layer> <trimmed> {l1 ... ln} {o1 ... on} <geometrical data>

<type> can be: nurbssurface planarsurface coonsurface meshsurface


<layer> is the layer name
<trimmed> 1 if the surface valid part is a trim of a bigger underlying shape, 0 else
{li...} objarray of integer identifiers of the surface lines (outer and inner boundaries)
{o1 ... on} orientation of the lines for the surface (0==natural orientation, along tangent, 1== opposite
direction)
Note: turning left of a line with orientation 0 must points inside the surface.
<geometrical data> depends of each entity type
planarsurface: nothing
coonsurface: nothing
nurbssurface <du> <dv> <nu> <nv> {x y z ... x y z} {w ... w} {ku ... ku} {kv ... kv}
<du> <dv>degree in u, v direction
<nu> <nv>number of control points in each direction
{xi yi zi} control points coordinates. (objarray of 3*nu*nv double values)
Geometry 128

<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)

GiD_Geometry get surface <surface_id> line_uv <line_index>


will return the information of the curve in uv space of the surface <surface_id>, with similar format as
GiD_Geometry get line <num> in case of a nurbs curve.

GiD_Geometry get surface <surface_id> has_holes


Return a boolean 1 or 0 indicating if the surface is trimmed with inner holes.

GiD_Geometry get surface <surface_id> index_boundaries


Return an objarray of int of num_holes+1 items with the index in the list of boundary curves where each loop
starts (the first is the outer loop and then the inner loops)

GiD_Geometry get surface <surface_id> ?-force? render_mesh


Will return the information of the render mesh of the surface <surface_id> as a list: {element_type
element_num_nodes coordinates connectivities normals uvs}
use -force flag to create the render mesh if it was not created.
element_type: triangle or quadrilateral
element_num_nodes: 3 or 4
coordinates: objarray with 3*num_nodes items of float with x y z of the render mesh nodes.
connectivities: objarray with element_num_nodes*num_elements of int with the connectivities of the elements
(starting by zero)
normals: optional objarray with 3*num_nodes items of float with x y z of the render mesh normals. (it is
optional, the array could have zero length)
uvs: optional objarray with 2*num_nodes items of float with u v space parameters of each node. (it is
optional, the array could have zero length)

GiD_Geometry get volume <num>


will return:
<type> <layer> {s1 sn} {o1 ... on}
<type> can be: volume or contactvolume
<layer> is the layer name
{si} identifier of surfaces bounding the volume (including holes. the first must be the outer boundary)
{oi} are its orientation for the volume ( 0 along to the surface normal, 1 opposite)
Note: the normal of a surface with orientation 0 points inside the volume

GiD_Geometry get volume <volume_id> has_holes


Return a boolean 1 or 0 indicating if the volume has inner holes.

GiD_Geometry get volume <volume_id> index_boundaries


Return an objarray of int of num_holes+1 items with the index in the list of boundary surfaces where each
shell starts (the first is the outer shell and then the inner shells)

GiD_Geometry get point|line|surface|volume <id> mesh


Will return the information of the mesh of the geometric entity <id> as a list: {element_type
element_num_nodes node_ids coordinates element_ids connectivities ?radius_and_normals?}
element_type: string
element_num_nodes: integer with the amount of nodes of an element (all mesh elements are of same type)
node_ids: objarray of integers with num_nodes items, where num_nodes is the amount of nodes of the
elements of this mesh (node id one-based)
coordinates: objarray with 3*num_nodes items of double with x y z of the mesh nodes.
element_ids: objarray of integers with num_elements items (element id one-based)
connectivities: objarray with element_num_nodes*num_elements of int with the connectivities of the elements
(one-based)
Geometry 129

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).

list: to get a list of entity identifiers of a range or inside some layer


GiD_Geometry list ?<filter_flags>? point|line|surface|volume ?<args> ?
<filter_flags> could be: ?-unrendered? ?-higherentity <num_higher>? ?-material <id_material>? ?-layer
<layer_name>? ?-plane {a b c d r}?
-unrendered flag is only valid for surface
-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)
-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
-entity_type <types_allowed> to list only the entities of a type contained in <types_allowed>, that must be a list
of allowed types ("STLINE | ARCLINE |POLYLINE | NURBLINE | NURBSURFACE PLSURFACE COONSURFACE
MESHSURFACE CONTACTSURFACE VOLUME CONTACTVOLUME")

<args>: <num>|<num_min>:<num_max>

<num_max> could be 'end' to mean the last index


if <args> is not provided it is considered as 1:end, and then all ids are returned

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}}

Get the list of points of the layer named 'Layer0':


GiD_Geometry list -layer Layer0 point

Get the list of surfaces that not belong to any volume:


GiD_Geometry list -higherentity 0 surface 1:end

Get the list of problematic surfaces that couldn't be rendered:


GiD_Geometry list -unrendered surface 1:end

Get the list of lines of type nurbline or arcline


GiD_Geometry list -entity_type {nurbline arcline} line

8.4.3 Mesh data

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

GiD_MeshData size points|lines|surfaces|volumes <size> <ids>


To assign desired mesh size to geometrical entities
<size>: double, the desired mesh size.
<ids>: objarray of integers with the ids of the geometrical entities to be meshed with this size

GiD_MeshData size_by_cordal_error <min_size> <max_size> <cordal_error>


To assign sizes to the whole model, based on a cordal error (distance from the approximated mesh to shape of the
geometry). The values calculated cannot be outside the range [min_size, max_size]

GiD_MeshData size_background_mesh <filename>


To assign the mesh sizes using an auxiliary file with 'background mesh format' (a mesh covering the domain with desired
sizes on nodes or elements)

GiD_MeshData size_correct <max_size>


To modify the current assigned sizes to be 'more feasible' (some assigned sizes can be decreased to avoid strong spatial
Mesh data 130

change of sizes)

GiD_MeshData unstructured lines|surfaces|volumes <ids>


To set entities to be meshed unstructuredly (with assigned or general size)

GiD_MeshData mesher surfaces|volumes default|rfast|rsurf|advancingfront|tetgen|octree <ids>


To set entities with the kind of meshing algorithm to be used to mesh them unstructured

GiD_MeshData structured lines|surfaces|volumes ?<ids_surfaces_or_volumes>?


num_divisions|num_divisions_by_size|weights <num_divisions>|<size>|{<w1> <w2>} <ids_lines>
To set entities to be meshed structuredly, setting the number of divisions in some of its lines.
<ids_surfaces_or_volumes>: objarray of integers (only in case of surfaces or volumes)
num_divisions <num_divisions>: integer amount of mesh divisions to be assigned to the lines
num_divisions_by_size <size>: an alternative double value, it is an approximated size that will be converted to an integer
number of divisions base on each line length.
weights {<weight_start> <weight_end>}: to set a not uniform size, assigning weights (double value from -1.0 to 1.0) to
start and end of the lines.
<ids_lines>: objarray of integers with the ids of the lines to be assigned the number of divisions.
GiD_MeshData structured lines num_divisions <num_divisions> <ids_lines>
GiD_MeshData structured lines num_divisions_by_size <size> <ids_lines>
GiD_MeshData structured lines weights {<weight_start> <weight_end>} <ids_lines>
GiD_MeshData structured surfaces|volumes <ids_surfaces_or_volumes>
num_divisions|num_divisions_by_size <num_divisions>|<size> <ids_lines>

GiD_MeshData semi_structured <num_divisions>|master_surfaces|structured_directions <ids>


GiD_MeshData semi_structured <num_divisions> <ids_volumes>
To set volumes to be meshed semi-structuredly, setting the amount of divisions in the structured direction.
GiD_MeshData semi_structured master_surfaces <ids_surfaces>
To expliciltly set the surfaces that will be meshed first and then extruded to the opposite tap. Before use this command
the volumes must be set as semi-structured
GiD_MeshData semi_structured structured_directions <ids_lines>
To expliciltly set direction that define the extrusion direction. Before use this command the volumes must be set as
semi-structured.

GiD_MeshData element_type surfaces|volumes <element_type>|default <ids>


To set the type of element to be generated (default to restore its initial value)

GiD_MeshData mesh_criteria default_all|to_be_meshed|to_be_duplicated|force_points|skip


<value|force_points_data> points|lines|surfaces|volumes <ids>
To set some mesh criteria to entities: (0=default, 1=no, 2=yes)
default_all points|lines|surfaces|volumes <ids>
to_be_meshed 0|1|2 points|lines|surfaces|volumes <ids>
to_be_duplicated 0|1|2 lines|surfaces <ids>
force_points surfaces|volumes <ids_to_force> points <ids>
skip 0|1|2 point|lines <ids>

GiD_MeshData reset
To reset all meshing information data assigned to the model

GiD_MeshData boundary_layer assign|unassign lines|surfaces|all <parent_ids> {<num_layers>


<size_first_layer>} <ids>
To assign or unassign boundary layer mesh data
GiD_MeshData boundary_layer assign lines|surfaces <parent_ids> {<num_layers>
<size_first_layer>} <ids>
To assign the boundary layer mesh data of a selection of lines (2D) or surfaces (3D).
<parent_ids>: objarray of integer ids of the parent entities (surfaces 2D, volumes 3D)
<num_layers>: integer, the desired amount of boundary layers
<size_first_layer>: double, the depth size of the first layer
<ids>: objarray of integer ids of the entities (lines 2D, surfaces 3D)
Mesh data 131

GiD_MeshData boundary_layer unassign lines|surfaces <ids>


To unassign the boundary layer mesh data of a selection of lines (2D) or surfaces (3D)
GiD_MeshData boundary_layer unassign all
To unassign the boundary layer mesh data of the whole model

8.4.4 Mesh

8.4.4.1 Preprocess mesh

GiD_Mesh create|delete|edit|get|list
To create, delete, modify, list or know information about mesh nodes or elements of the preprocess:

create: to create a new node or element


GiD_Mesh create node <num>|append <x y z>
<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.
<x y z> are the node coordinates. If the z coordinate is missing, it is set to z=0.0.

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

delete: to delete one or more nodes or elements


GiD_Mesh delete node|element <num_1 ... num_n>
<num> is the identifier (integer > 0) for the node or element to be deleted. It is possible to use a list of multiple ids.

edit: to modify a node or element


GiD_Mesh edit node <num> <x y z>
GiD_Mesh edit element <num> <elemtype> <nnode> <N1 ... Nnnode> <radius> <nx> <ny> <nz>
?<matname>?
Same syntax as create

get: to get the information of a node or element


GiD_Mesh get node <num> ?coordinates?
It return the list: <node_layer> <x> <y> <z>
with the coordinates word only the <x> <y> <z> coordinates are returned

GiD_Mesh get element <num|from_face|from_edge> ?face|face_linear|num_faces|edge_linear|num_edges|n


ormal|tangent|center|connectivities?<face_id>|<edge_id>??
<num> is the identifier (integer > 0) for the element to be asked
face optional, instead of the element nodes it returns the nodes of the face, first the linear corner nodes and then
the quadratic nodes
face_linear optional, instead of the element nodes it returns only the linear corner nodes, also is the element is
quadratic
num_faces returns the amount of faces of the element (for surface elements its edges act as faces)
<face_id> is the local face index from 1 to the number of faces of the element. If <face_id> is missing then a list
with all faces is returned
edge_linear optional, instead of the element nodes it returns only the linear edge nodes, also is the element is
quadratic
<edge_id> is the local edge index from 1 to the number of edges of the element. If <edge_id> is missing then a
list with all edges is returned
Preprocess mesh 132

num_edges returns the amount of edges of the element

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>

If from_face is specified then the command has this syntax


GiD_Mesh get element from_face <face_nodes> ?-ordered?
it find and return the list of element ids that have a face with these nodes
<face_nodes> is the list of integer ids of the face nodes {<face_node_1> ... <face_node_n>} (only corner lineal
nodes must be specified in the list)
if -ordered is specified then only faces with the same orientation of the nodes will be taken into account (else the
ordenation of the face nodes doesn't matter)

If from_edge is specified then the command has this syntax


GiD_Mesh get element from_edge <edge_nodes>
it find and return the list of element ids that have an edge with these nodes
<edge_nodes> is the list of integer ids of the edge nodes {<edge_node_1> <edge_node_2>} (only corner lineal
nodes must be specified in the list)

Note: get element from_face or from_edge could be an expensive operation because the whole mesh is traversed to find
them.

GiD_Mesh get nodesdistance <num1> <num2>


returns the distance between two mesh nodes, specified by its numbers

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.4.2 Cartesian grid

This command is only valid for preprocess

GiD_Cartesian get|set ngridpoints|boxsize|corner|dimension|coordinates|iscartesian|auto_calculated


<values>
To get and set cartesian grid properties
ngridpoints: the number of values of the grid axis on each direction x, y,z (3 integers)
boxsize: the size of the box of the grid on each direction (3 reals)
corner: the location of the lower-left corner of the grid box (3 reals)
Cartesian grid 133

dimension: the dimension of the grid: 2 for 2D or 3 for 3D


coordinates: the list of grid coordinates on each direction (nx+ny+nz reals)
iscartesian: (valid only for get) return 1 if current mesh is cartesian, 0 else.
auto_calculated GEOMETRY|MESH|GEOMETRY_AND_MESH <mesh_size>: (valid only for set) to fill in the
GiD-calculated automatic values, based on the current geometry and/or mesh and the general mesh size to be
used.

8.4.4.3 Postprocess mesh

GiD_MeshPost create <meshname> <elemtype> <elementnnodes> ?-zero_based_array? <node_ids>


<nodes> <element_ids> <elements> ?<radius+?normals?>? ?<r g b a>?
To create a postprocess mesh.
This command create all mesh nodes and elements in a single step (unlike GiD_Mesh that create each node or element one
by one)

<meshname>: the name of the mesh


<elemtype>: must be one of "point | line | triangle | quadrilateral | tetrahedra | hexahedra | prism | pyramid |
sphere | circle"
<elementnnodes>: is the number of nodes an element has. All elements of the mesh must have the same
number of nodes.
-zero_based_array: optional flag. By default node and element indexes start from 1, but setting this flag indexes
must start from 0.
<node_ids>: list of node indentifiers. If it is an empty list them numeration is implicitly increasing.
<nodes>: a list of real numbers with the thee coordinates of each node {x0 y0 z0 ... xnn-1 ynn-1 znn-1}
<element_ids>: list of element indentifiers. If it is an empty list them numeration is implicitly increasing.
<elements>: a list of integers with the <elementnnodes> nodes of each element: the id of each node is the
location on the vector of nodes, starting from 0
<radius+normals>:
<radius>:only for spheres. Is a list of reals with the radius or each sphere {r0 ... rne-1}
<normals>:only for circles. Is a list of reals with the radius and normal to the plane or each circle
{r0 nx0 ny0 nz0 ... rne-1 nxne-1 nyne-1 nzne-1}
<r g b a>: optional color components, to set the mesh color. r g b a are the red, green, blue and alpha
transparency components of the color, must be real numbers from 0.0 to 1.0. If the color is not specified, an
automatic color will be set.

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

GiD_Tools geometry classify_connected_parts <entity_type> <entity_ids> ?<forced_separator_ids>?

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

<entity_type>: line | surface | volume


<entity_ids> objarray of integers with the entity identifiers (ids start from 1, not 0)
<forced_separator_ids> is an optional list of ids of entities of lower level that act as barrier and prevent consider be
connected
entities of lower level means for <entity_type> line -> point , surface -> line, volume -> surface
Geometry 134

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

GiD_Tools geometry mass_properties <volume_id>


To calculate the mass properties of volume, gravity center and inertia tensor of a volume

<volume_id> Is the of integer id of the volume to be computed

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

Ixx Ixy Ixz


Ixy Iyy Iyz
Ixz Iyz Izz

Note: this command is similar to GiD_Info listmassproperties, but this command is not computing inertias

8.4.5.2 Mesh

mass_properties

GiD_Tools mesh mass_properties <tetrahedra_ids> | -boundary_elements <triangle_ids>

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

Ixx Ixy Ixz


Ixy Iyy Iyz
Ixz Iyz Izz

Note: this command is similar to GiD_Info listmassproperties, but this command is not computing inertias

intersectvolumeslines

GiD_Tools mesh intersectvolumeslines <group_lines>


Specialized command that calculate the intersections of the line elements that belong to the group named <group_lines>
with the current mesh of hexahedra.

8.4.6 Layers

8.4.6.1 Definition

GiD_Layers create|delete|edit|get|list|window|exists|is_forbidden_name

GiD_Layers create <layer>


To create a new layer. <layer> must be the full name (e.g. if a layer B has as parent A then must use as fullname
A//B)
GiD_Layers delete <layer>
To delete a layer
GiD_Layers edit name|color|opaque|visible|frozen|parent|state|to_use <layer> <value>
To modify layer properties:
name: change its name
color: set the color to draw its entities (with format #rrggbbaa)
opaque: opaque or transparent (0 or 1)
visible: set visibility of its entities (0 or 1)
Definition 135

frozen: set frozen to disable select its entities (0 or 1)


parent: to change the parent of a layer
state: to change the layer state (normal, disabled or hidden). hidden layers are not listed or visible in
windows.
to_use: in this case <value> must not be providen, and <layer> is the one to be set as current 'layer to
use' (where new entities will be created)
GiD_Layers get color|opaque|visible|frozen|parent|state|num_entities|num_conditions|id|back|to_us
e<layer>
To obtain the current value of some property:
num_entities: the total number of geometric or mesh entities that belong to the layer
num_conditions: the total number of conditions applied to the layer
id: the numeric identifier of the layer
back: return 1 if the layer has entities in its 'back' layer (entities in back are not drawn until they are sent
again to front)
to_use: in this case <layer> must not be providen, it is returned the current 'layer to use' (where new
entities will be created)
GiD_Layers list ?<parent>? ?descendants?
To get the list of fullnames of the current layers.
If a parent is specified, then only relative names of child layers will be listed. Root parent could be specified with an
empty string ""
If desdendants is specified return a list of all descendants (childs, childs of childs, ...)
GiD_Layers window open|close|update
Show or hide the layers window or update its content
GiD_Layers exists <layer>
Return 1 if layer exists, 0 else
GiD_Layers is_forbidden_name <layer>
Return 1 if layer name has forbidden syntax

8.4.6.2 Entities

GiD_EntitiesLayers assign|get|entity_layer
To handle the entities that belong to layers

GiD_EntitiesLayers assign|assign_back_layer|assign_front_layer|get <layer> ?-also_lower_entities?


<over> <selection>
To add or know entities of a layer
GiD_EntitiesLayers assign <layer> ?-also_lower_entities? ?-also_higher_entities? <over>
<selection>
To assing the selection of entities of kind over to the layer
<layer> is the full name of the layer
<-also_lower_entities> is an optional flag, to select also all lower entities of the selected ones (e.g. curves and
points of the selected surfaces)
<-also_higher_entities> is an optional flag, to select also all higher entities of the selected ones (e.g. volumes
of the selected surfaces)
<over> could be points, lines, surfaces, volumes, nodes, elements, all_geometry, all_mesh
<selection> is a list of integer entity id's starting from 1.
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

GiD_EntitiesLayers assign_back_layer ?-also_lower_entities? ?-also_higher_entities? <over>


<selection>
To send the selection of entities of kind over to the back (hidden part) of its layer
<-also_lower_entities> is an optional flag, to select also all lower entities of the selected ones (e.g. curves and
points of the selected surfaces)
<-also_higher_entities> is an optional flag, to select also all higher entities of the selected ones (e.g. volumes
of the selected surfaces)
<over> could be points, lines, surfaces, volumes, nodes, elements, all_geometry, all_mesh
<selection> is a list of integer entity id's starting from 1.
Entities 136

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

GiD_EntitiesLayers assign_front_layer ?-also_lower_entities? ?-also_higher_entities?


geometry|mesh all_entities|layer_entities|<over> <layer>|<selection>
To send the entities of <layer> again to the front (visible part) of its layer
<-also_lower_entities> is an optional flag, to select also all lower entities of the selected ones (e.g. curves and
points of the selected surfaces)
<-also_higher_entities> is an optional flag, to select also all higher entities of the selected ones (e.g. volumes
of the selected surfaces)
geometry|mesh specify wich layer entities must be sent to front: geometry or mesh entities
all_entities: will send all entities of the geometry or mesh. In this case <layer> must not be specified
layer_entities <layer>: will send to front only the geometry or mesh entities of this layer.
<over> <selection>: will send the selection of entities of type <over> (points, lines, surfaces, volumes, nodes
or elements)

GiD_EntitiesLayers get <layer> <over> ?-count? ?-element_type <types_allowed>?


To get the list of entities of kind <over> that belong to <layer>.
If <over> is all_geometry then is obtained a list with 4 sublists: point id's, line id's, surface id's and volume
id's
If <over> is all_mesh then is obtained a list with 2 sublists: node id's and element 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.

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_EntitiesLayers entity_layer <over> <id>


To get the layer to which the entity <id> of type <over> belongs
<over> could be points, lines, surfaces, volumes, nodes, elements
<id> is the entity number, starting from 1.

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

GiD_Groups create <group>


To create a new group. <group> must be the full name (e.g. if a group B has as parent A then must use as
fullname A//B)
GiD_Groups clone <source_group> <destination_group>
create a new cloned group, with the same entities that its source group
GiD_Groups delete <group>
To delete a group
GiD_Groups edit name|color|opaque|visible|allowed_types|allowed_element_types|parent|state
<group> <value>
To modify group properties:
name: change its name
color: set the color to draw its entities (with format #rrggbbaa)
opaque: opaque (1) or transparent (0)
visible: set visibility of its entities. (Visible = 1, Hidden = 0)
allowed_types: set the list type of geometric or mesh entities allowed to be in the group, must be a list
with some of {points lines surfaces volumes nodes elements faces}
allowed_element_types: set the list type of mesh elements allowed to be in the group, must be a list with
some of {linear triangle quadrilateral, ....}, by default all element types are allowed
parent: to change the parent of a group
state: to change the groups state (normal, disabled or hidden). hidden groups are not listed or visible in
Definition 137

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.

GiD_EntitiesGroups assign|unassign|get <group> ?-also_lower_entities? <over> <selection>


To add, remove or know entities of a group
GiD_EntitiesGroups assign <group> ?-also_lower_entities? <over> <selection>
To assing the selection of entities of kind over to the group
<group> is the full name of the group
<-also_lower_entities> is an optional flag, to select also all lower entities of the selected ones (e.g. curves and
points of the selected surfaces)
<over> could be points, lines, surfaces, volumes, nodes, elements, faces, all_geometry, all_mesh
<selection> is a list of integer entity id's starting from 1.
In case of faces it is a list with 2 items, the first is the list of element id's and the second the list of face id's
(the local number of the face on the element: a number from 1 to nfaces of the element)
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 3 items with the list of ids of nodes, elements and faces, and for
faces there are two subitems {element_ids face_ids}
GiD_EntitiesGroups unassign <group> ?-also_lower_entities? ?-element_type <types_allowed>?
<over> ?<selection>?
To unassign the selection of entities of kind over of the group.
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 <selection> is missing, then all entities of kind <over> are unassigned of <group>
GiD_EntitiesGroups unassign all_geometry|all_mesh|all
all_geometry:To unassign all groups of all geometric entities
all_mesh: To unassign all groups of all mesh entities
all: To unassign all groups of all entities
GiD_EntitiesGroups get <group> <over> ?-count? ?-element_type <types_allowed>? ?-visible?
To get the list of entities of kind <over> that belong to <group>.
If <over> is faces then is obtained a list with 2 sublists: element id's and face id's
If <over> is all_geometry then is obtained a list with 4 sublists: point id's, line id's, surface id's and volume
id's
Entities 138

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_EntitiesGroups entity_groups <over> <id>


To get the list of groups to which the entity <id> of type <over> belongs
<over> could be points, lines, surfaces, volumes, nodes, elements, faces
<id> is the entity number, starting from 1. In case of faces it is a list with tho items: {<element_id> <face_id>},
with <face_id> starting from 1

8.4.8 Data (problemtype classic)

GiD-Tcl special commands to manage books, materials, conditions, intervals, general data or local axes:

8.4.8.1 Books

GiD_Book material|condition create|set|exists


To create or know if a book of materials or conditions exists, or to set its current book.

Books are like a container to visually separe materials or conditions in submenus and different windows

GiD_Book material|condition create <book>


To create a new book named <book> in the collection of books of materials or conditions

GiD_Book material|condition set <book> <name>


To set as <book> as current book of a material or condition named <name>

GiD_Book material|condition exists <book>


To check if the book <book> exists in the collection of books of materials or conditions

8.4.8.2 CreateData

GiD-Tcl special commands to create and delete materials and conditions:

GiD_CreateData create|delete material|material_base|condition ...


To create or delete materials or conditions:

GiD_CreateData create material <basename> <name> <values>


To create a material with the same question fields as a base material but different values:
<basename> this only applies to the create material operation, and is the base material from which the new
material is derived;
<name> is the name of material itself;
<values> is a list of all field values for the new material.

GiD_CreateData delete material|material_base <name>


To delete a material

GiD_CreateData create material_base <name> {{question_1 ... question_n} ?{value_1 value_n}?}


To create a base material: (define the fields of a new material to be used to derive new materials from it)
<name> is the name of material;
<questions> and <values> are lists of all questions and values for the new material. If values are missing empty
values are used.

GiD_CreateData create condition <name> <over_geometry> <over_mesh> {{question_1 ... question_n}


?{value_1 value_n}?}
To create a condition:
<over_geometry> must be ovpnt|ovline|ovsurf|ovvol|ovlayer|ovgroup
CreateData 139

<over_mesh> must be ovnode|ovbodyelem|ovfaceelem

GiD_CreateData delete condition <name>


To delete a condition:

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

GiD_AssignData material|condition <name> <over> ?<values>? <entities>


To assign materials or conditions over entities:
<name> is the name of the material or condition;
<over> must be: points, lines, surfaces, volumes, layers, groups, nodes, elements, body_elements, or face_elements
(elements is equivalent to body_elements). Layers and groups is valid for conditions defined over them, but not for
materials.
<newvalues> is only required for conditions. If it is set to "" then the default values are used;
<entities> a list of entities (it is valid to use ranges as a:b ,can use "all" to select everything, "end" to specify the last
entity, layer:<layername> to select the entities in this layer) ; if <over> is face_elements then you must specify a list
of "entitynumface" instead just "entity".

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

GiD_UnAssignData material|condition <name> <over> <entities> ?wherefield <fieldname> <fieldvalue>?


To unassign materials or conditions of some entities:
<name> is the name of the material or condition; Can use "*" to match all materials
<over> must be: points, lines, surfaces, volumes, layers, nodes, elements, body_elements, or face_elements
(elements is equivalent to body_elements);
It is possible to use all_geometry|all_mesh||all to unassign of all entities of geometry or mesh or both. Then <entities
selection> must not be provided.
<entities> a list of entities (it is valid to use ranges as a:b ,can use "all" to select everything, "end" to specify the last
entity, layer:<layername> to select the entities in this layer) ; if <over> is face_elements then you must specify a list
of "entitynumface" instead just "entity".
wherefield <fieldname> <fieldvalue> To unassign this condition olny for the entities where the field named
'fieldname' has the value 'fieldvalue'

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

GiD_ModifyData ?-book? material|condition|intvdata|gendata|localaxes ?<name>? <values>


To change all field values of materials, interval data or general data:
<name> is the material name or interval number;
<values> is a list of all the new field values for the material, interval data or general data.
if -book is specified then this value is the new book name, and could be applied only to material or condition

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

GiD_ModifyData localaxes <condition_name> ?geometry|mesh? <entity_ids...> <entiy_euler_angles...>


To change the 3 euler angles of the local axis of a condition <condition_name> attached to entities of geometry or mesh.
ModifyData 140

<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

GiD_AccessValue ?-index? set|get ?-default? material|condition|intvdata|gendata ?<name>? <question>


?<attribute>? <value>
To get or set some field values of materials, interval data or general data:
if -index is specified then the material of condition number will be expected instead of its name
if -default is specified then the get option returns the default value instead of the current value
(the default value is value set in the problemtype file)
<name> is the material, condition name or interval number (not necessary for gendata);
<question> is a field name;
<attribute> is the attribute name to be changed (STATE, HELP, etc.) instead of the field value;
<value> is the new field or attribute value.

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

GiD_IntervalData <mode> ?<number>? ?copyconditions?


To create, delete or set interval data;
<mode> must be 'create', 'delete' or 'set';
<number> is the interval number (integer >=1).
Create returns the number of the newly created interval and can optionally use 'copyconditions' to copy to the new
interval the conditions of the current one.
For create mode, if <number> is supplied the new interval is inserted in this location, else is append to end.
For set mode, if <number> is not supplied, the current interval number is returned.
Example:
set current [GiD_IntervalData set]
GiD_IntervalData set 2
set newnum [GiD_IntervalData create]
set newnum [GiD_IntervalData create copyconditions]
set newnum [GiD_IntervalData create $i_insert copyconditions]

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

0 if it does not match with any axes;


<n> if the user-defined number <n> (n>0) local axes match.

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

GiD_Units edit|get magnitude_units|magnitudes|model_unit_length|system ?<value>?

To allow get or modify units and magnitudes.


Note: units doesn't exists without load a problemtype that define them

GiD_Units get magnitude_units <magnitude>


Returns the list of allowed units for the <magnitude> (of the current unit system)
<magnitude> must be one of the values returned by [GiD_Units get magnitudes]

GiD_Units get magnitudes


Returns the list of defined magnitudes

GiD_Units get system


To return the current units system string

e.g.
GiD_Units get system
-> SI

GiD_Units edit system <value>


To set the current units system

e.g.
GiD_Units edit system imperial

GiD_Units get model_unit_length


To return the current geometry length unit string.
This unit declare the length unit of the coordinates of the geometry or mesh

e.g.
GiD_Units get model_unit_length
-> m

GiD_Units edit model_unit_length <value>


To set the current geometry length unit.
<value> must be one of the values returned by [GiD_Units get magnitude_units <length_magnitude>]
Where <length_magnitude> must be the length magnitude name. This name depends on the problemtype units definition
(L, LENGTH, or others)

e.g.
GiD_Units edit model_unit_length mm

8.4.9 Results

GiD_Result create|delete|exists|get|get_nodes|gauss_point|result_ranges_table ?-array? <data>


To create, delete or get postprocess results:
GiD_Result create ?-array? {Result header} ?{Unit <unit_name>}? ?{componentNames name1 ...}?
{entity_id scalar|vector|matrix_values} {...} {...} : these creation parameters are the same as for the
postprocess results format (see Result -pag. 71- of Results format: ModelName.post.res -pag. 66-) where each line
is passed as Tcl list argument of this command;
Optionally the names of the result's components could be specified, with the componentNames item, and the unit
Results 142

label of the result with the Unit item

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}}}

GiD_Result delete {Result_name result_analysis step_value} : deletes one result;

Examples:
GiD_Result delete {"Res Nodal 1" "Load analysis" 4}

GiD_Result exists {Result_name result_analysis step_value} : return 1 if the result exists.

GiD_Result get ?-max|-min|-compmax|-compmin|-info? ?-sets <set_names_list>? ?-selection


<sorted_ids>? ?-array? {Result_name result_analysis step_value} : retrieves the results value list of the
specified result.
-array flag: the values are returned more efficiently grouping the information in arrays, else values are grouped as
a list with one item by entity
-sets <set_names_list>: only the results of nodes/elements (depending on the result) of the sets belonging to
<set_names_list> are returned
-selection <sorted_ids>: only the results of nodes/elements (depending on the result) with id belonging to
<sorted_ids> are returned
<sorted_ids> must be an intarray (list of integer ids) of increasing ids of nodes/elements to be returned.
if one of the -max, -min, -compmax, -compmin, or -info flags was specified instead of the full results value only the
minimum/maximum value of the result, every minimum/maximum of the components of the result, or the header
information of the result is retrieved, respectively;

Eamples: (case of a scalar result defined on triangles with 3 gauss points)

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}

GiD_Result get_nodes: returns a list of nodes and their coordinates.


GiD_Result gauss_point create|get|names|delete <name> <elemtype> <npoint> ?-nodes_included?
<coordinates> ?<mesh_name>?
create <name> <elemtype> <npoint> ?-nodes_included? <coordinates> ?<mesh_name>?
Define a new kind of gauss point where element results could be related.
<name> is the gauss point name. Internal Gauss points are implicitly defined, and its key names
(GP_LINE_1,GP_TRIANGLE_1,...) are reserved words and can't be used to create new gauss points or be
deleted. (seeGauss Points -pag. 66-)
Results 143

<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}

GiD_Result result_ranges_table create|get|names|delete <name> {<min1> <max1> <label1> ...


<minn> <maxn> <labeln> }
create <name> {<label1> <min1> <max1> ... <labeln> <minn> <maxn>}
Define a new kind of result ranges table to map ranges of result values to labels.
<name> is the result ranges table name.
<mini> <maxi> <labeli>: is the label to show for result values from min to max
get <name>
Return the information of this result ranges table
names
Return a list with the names of all result ranges tables defined
delete <name>

-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)

GiD_Sets get color|visible|type|num_entities|id <set_name>


To obtain the current value of some property:
type: set type. could be 0==unknown, 1==mesh, 2==set, 3==cut
num_entities: the total number of mesh elements that belong to the set
id: the numeric identifier of the set

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

named 'objarray'. (for more information see scripts\objarray\objarray.pdf)

Example:
set count_elements_set [GiD_EntitiesSets get Layer0 elements -count]
set nodes_ids_one_set [GiD_EntitiesSets get Layer0 nodes]

GiD_EntitiesSets entity_sets nodes|elements <id>


To get the set that contain the element <id> or the list of set that contain a node <id> (the sets that contain
elements with the node as vertex)

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

To create, delete or get postprocess graphs:


All commands accept an optional parameter <graphset_name>, else the current graphset is assumed.

clear?<graphset_name>?: delete all graphs in GiD;


create <graph_name> <label_x> <label_y> <x_values> <y_values> <x_unit> <y_unit>
?<graphset_name>?: creates the graph "graph_name" with the provided information, causing an error if the graph
already exists: for instance the graph of the picture was created with

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

To create, delete or get postprocess graphs sets:


A graphset is a container of graphs sharing the same x, y axes

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();

For GiD-Tcl must use:

GiD_OpenGL draw -begin lines


GiD_OpenGL draw -vertex [list $x1 $y1 $z1]
GiD_OpenGL draw -vertex [list $x2 $y2 $z2]
GiD_OpenGL draw -end

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]

unregister <handle> Unregister a procedure previously registered with register.

Example:
GiD_OpenGL unregister $id

registercondition <tclfunc> <condition> Register a Tcl procedure to be invoked automatically when redrawing
OpenGL 146

the specified condition.


The tcl funcion must have this prototype:
proc xxx { condition use entity_id values } {
...
return 1
}
The supplied parameters are:
condition :the condition name, defined in the .cnd file of the problemtype
use: GEOMETRYUSE, MESHUSE or POSTUSE
entity_id: the integer number that identity the entity where the condition is applied. The kind of entity is known
because it is declared in the
definition of the condition in the .cnd, depending if the current state is geometry or mesh
values: a list of the field's values applied to this entity. The amount of values must match the amount of fields of
the condition definition.

The return value of this procedure is important:


return 0: then the standard representation of the condition is also invoked after the procedure
return 1: the stardard representation of the condition is avoided.

unregistercondition <condition> Unregister a procedure previously registered with registercondition.

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"

drawentity ?-mode normal|filled? point|line|surface|volume|node|element|dimension <id list> To


draw an internal GiD preprocess entity.

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.

font push <font_name font_size>|pop|measure <text>|current|metrics


?-ascent|-descent|-linespace|-fixed?
push sets the current OpenGL font, pop restores the previous one
OpenGL 147

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

pgfont pushfont <font_type>|popfont|print <text>|dimensions <text>|foreground <red> <green>


<blue> <alpha>|background <red> <green> <blue> <alpha>
Similar to font but using pgfonts
font types: defaultfont, axisfont, legendfont, labelfont, graphfont, asianfont, tkdrawoglfont, pmfont

List of supported OpenGL functions:


accum alphafunc begin bindtexture blendfunc call calllist clear clearaccum clearcolor cleardepth
clearstencil clipplane color colormask colormaterial copypixels cullface deletelists deletetextures
depthfunc depthmask dfactorBlendTable disable drawbuffer drawpixels edgeflag enable end endlist
evalcoord1 evalcoord2 evalmesh1 evalmesh2 finish flush fog frontface frustum genlists gentextures
getstring hint hintModeTable initnames light lightmodel linestipple linewidth loadidentity
loadmatrix loadname lookat map1 map2 mapgrid1 mapgrid2 material matrixmode modeColorMatTable
multmatrix newlist newListTable normal opStencilTable opStencilTable ortho perspective pickmatrix
pixeltransfer pixelzoom pointsize polygonmode popattrib popmatrix popname pushattrib pushmatrix
pushname rasterpos readbuffer readpixels rect rendermode rotate scale scissor selectbuffer
shademodel stencilfunc stencilmask stencilop texcoord texenv texgen teximage1d teximage2d
texparameter translate vertex viewport

List of special non OpenGL standard functions:


getselection

List of supported OpenGL constants:


accum accumbuffer accumbufferbit add alphatest always allattrib allattribbits ambient
ambientanddiffuse autonormal aux0 aux1 aux2 aux3 back backleft backright blend bluebias bluescale
ccw clamp clipplane0 clipplane1 clipplane2 clipplane3 clipplane4 clipplane5 colorbuffer
colorbufferbit colorindex colormaterial compile compileandexecute constantattenuation cullface
current currentbit cw decal decr depthbuffer depthbufferbit depthtest diffuse dither dstalpha
dstcolor enable enablebit emission equal eval evalbit exp exp2 extensions eyelinear eyeplane
feedback fill flat fog fogbit fogcolor fogdensity fogend fogmode fogstart front frontandback
frontleft frontright gequal greater greenbias greenscale hint hintbit incr invert keep left lequal
less light0 light1 light2 light3 light4 light5 light6 light7 lighting lightingbit lightmodelambient
lightmodellocalviewer lightmodeltwoside line linebit linear linearattenuation lineloop lines
linesmooth linestipple linestrip list listbit load map1color4 map1normal map1texturecoord1
map1texturecoord2 map1texturecoord3 map1texturecoord4 map1vertex3 map1vertex4 map2color4 map2normal
map2texturecoord1 map2texturecoord2 map2texturecoord3 map2texturecoord4 map2vertex3 map2vertex4
modelview modulate mult nearest never none normalize notequal objectlinear objectplane one
oneminusdstalpha oneminusdstcolor oneminussrcalpha oneminussrccolor packalignment packlsbfirst
packrowlength packskippixels packskiprows packswapbytes pixelmode pixelmodebit point pointbit points
polygon polygonbit polygonoffsetfill polygonstipple polygonstipplebit position projection q
quadraticattenuation quads quadstrip r redbias redscale render renderer repeat replace return right
s scissor scissorbit select shininess smooth specular spheremap spotcutoff spotdirecion spotexponent
srcalpha srcalphasaturate srccolor stenciltest stencilbuffer stencilbufferbit t texture texture1d
texture2d texturebit texturebordercolor textureenv textureenvcolor textureenvmode texturegenmode
texturegens texturegent texturemagfilter textureminfilter texturewraps texturewrapt transform
transformbit triangles trianglefan trianglestrip unpackalignment unpacklsbfirst unpackrowlength
unpackskippixels unpackskiprows unpackswapbytes vendor version viewport viewportbit zero

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.

A raster is defined with a Tcl list of the following data:


<ncols> <nrows> <xllcenter> <yllcenter> <xcellsize> <ycellsize> <nodata_value> <values>
ncols, nrows are the number of columns and rows of values (representing values on center of cells)
xllcenter,yllcenter are the x,y coordinates of the lower-left corner
Raster 149

GIS::GetRasterFromNodes { {cellsize 0.0} }


It returns a raster from the current mesh nodes. If cellsize is not specified an automatic value is used

GIS::SubsampleRaster { raster increment show_advance_bar }


It returns a new raster subsampling the input raster jumping columns and row by increment
show_advance_bar must be 1 to show and advancing bar during the process

GIS::ImportRaster_Geometry { raster show_advance_bar }


It creates geometrical surfaces (and its lines and points) from the raster

GIS::ImportRaster_Mesh { raster show_advance_bar }


It creates mesh quadrilaterals (and its nodes) from the raster

GIS::SaveRaster_ArcInfoASCII { raster filename }


It saves the raster in the file named filename with ArcInfo grid ASCII format

GDAL::ReadRaster { filename show_advance_bar }


It return a raster with from the file named filename.
The format could be some raster geospatial data format allowed by the GDAL (Geospatial Data Abstraction Library).
Some of them are: ArcInfo, geotiff, png, jpg, and much more.

8.4.15 Other

GiD_Set ?-meshing_parameters_model? ?-default|-array_names? <varname> ?<value>?


This command is used to set or get GiD variables. GiD variables can be found through the Right buttons menu under the
option Utilities -> Variables:
<varname> is the name of the variable;
<value> if this is omitted, the current variable value is returned (analogous with 'GiD_Info variables
<varname>').
-default return the default value of the variable (<value> its not accepted)
-array_names return a list with the subnames of the array, or an empty list if is not an array
-meshing_parameters_model to use the copy of the variable used in meshing the current model instead of the
general preference variable

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.

GiD_ModifiedFileFlag set|get ?<value>?


There is a GiD internal flag to indicate that the model has changed, and must be saved before exit.
With this command it is possible to set or get this flag value:
<value> is only required for set: must be 0 (false), or 1 (true).

Example:
GiD_ModifiedFileFlag set 1
GiD_ModifiedFileFlag get

GiD_MustRemeshFlag set|get ?<value>?


There is a GiD internal flag to indicate that the geometry, conditions, etc. have changed, and that the mesh must be
re-generated before calculations are performed.
With this command it is possible to set or get this flag value:
<value> is only required for set: must be 0 (false), or 1 (true).
Other 150

Example:
GiD_MustRemeshFlag set 1
GiD_MustRemeshFlag get

GiD_Redraw
To force a redraw

GiD_BackgroundImage get|set show|filename|location <values>


This command allow to get and set the background image properties
Valid set values are:
show: 1 or 0
filename:
the full filename of some valid GiD image format to be used as background image
or "", to release the current image
location:
'fill' to fill the whole screen,
or a list (objarray) with six floating values for a real size image, to set the origin and x',y' local axes: ox oy ix iy jx jy
They are 3 points (in 2D space, z=0.0) that represent:
o=origin lower-left point
i=end point of the local x' axis
j=end point of the local y' axis (the size ratio of the image could change)

Note: 'GiD_BackgroundImage set location' must be called after 'GiD_BackgroundImage set filename'

GiD_RegisterExtensionProc <.extension> PRE|POST|PREPOST <procedure>


To register a Tcl procedure to be automatically called when dropping a file with this extension
Example:
GiD_RegisterExtensionProc ".h5" PRE Amelet::ReadPre

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]
}

GiD_Thumbnail get | get_pixels | get_vectorial | get_statistics_mean


Returns the image data of an downscaled view of the current graphical window.

get ?<width> <height>?


The image is a downscaled from the current size to width x height. The parameters widht and height are optional and by
default the view is scaled to 192x144. The result of this command can be directly used by the Tk image command, like
this:

Example:
label .l -image [image create photo -data [GiD_Thumbnail get]]

get_pixels ?-quality <quality>? ?RGB|BGR|RGBA|BGRA|GREY|png|jpeg|raw?


It returns a list {width height data} of the current image in a direct way, binary and without modifications.
It allow to specify the kind and order of the data for Red, Green, Blue colors and for Alpha transparency factor.
If png format is specified that data is get as RBG and with png (portable network graphics format)

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

GiD_GetWorldCoord screen_x screen_y


Given the screen coordinates ( screen_x, screen_y) returns a list with six coordinates:
{ x y z nx ny nz }
being
(x,y,z) the coordinates mapped into the world (model) of the screen coordinates,
(nx,ny,nz) the normal vector components of the world (model) pointing to the user.

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]

GiD_GetUserSettingsFilename ?-create_folders? ?-ignore_alternative_configuration_file?


To get the file name where the user settings are stored.
If -create_folders flag is provided, then all intermediate folders are created if doesn't exists
If -ignore_alternative_configuration_file flag is provided, then alternative_file provided by -c or -c command line argument
is ignored.

8.5 HTML help support

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:

HelpDirs {html-version "GiD Help" "intro/intro.html"} \


{html-customization "GiD Customization"} \
{html-faq "Frequently Asked Questions"} \
{html-tutorials "GiD Tutorials" "tutorials_toc.html"} \
{html_whatsnew "What's New"}

8.5.2 Structure of the help content

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

\__ en - English content


\__ es - Spanish content

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:

<UL> <LI> ... </UL> (default)


<DT> <DL> ... </DT>

The first is the one generated by texinfo.

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:

<DIR> <LI> ... </DIR> (default)


<UL> <LI> ... </UL> (only one level of <UL>)

The first is the one generated by texinfo.

For instance:

IndexPage html-version/gid_18.html html-faq/faq_11.html

8.6 Managing menus

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-).
).

Note: Menus and option menus are identified by their names.


Note: It is not necessary to restore the menus when leaving the problem type, GiD does this automatically.

The Tcl functions are:

GiDMenu::Create { menu_name_untranslated prepost {pos -1} {translationfunc _} }


Creates a new menu. New menus are inserted between the Calculate and Help menus.
menu_name_untranslated: text of the new menu (English).
prepost can have these values:
"PRE" to create the menu only in GiD Preprocess.
"POST" to create the menu only in GiD Postprocess.
Managing menus 154

"PREPOST" to create the menu in both Pre- and Postprocess.


pos: optional, index where the new menu will be inserted (by default it is inserted before the 'Help' menu)
translationfunc: optional, must be _ for GiD strings (default), or = for problemtype strings

GiDMenu::Delete { menu_name_untranslated prepost {translationfunc _} }


Deletes a menu.
menu_name_untranslated: text of the menu to be deleted (English).
prepost can have these values:
"PRE" to delete the menu only in GiD Preprocess.
"POST" to delete the menu only in GiD Postprocess.
"PREPOST" to delete the menu in both Pre- and Postprocess.
translationfunc: optional, must be _ for GiD strings (default), or = for problemtype strings

GiDMenu::InsertOption { menu_name_untranslated option_name_untranslated position prepost command


{acceler ""} {icon ""} {ins_repl "replace"} {translationfunc _} }
Creates a new option for a given menu in a given position (positions start at 0, the word 'end' can be used for the last
one).
menu_name_untranslated: text of the menu into which you wish to insert the new option (English), e.g "Utilities"
option_name_untranslated: name of the new option (English) you want to insert.
The option name, is a menu sublevels sublevels list, like [list "List" "Points"]
If you wish to insert a separator line in the menu, put "---" as the option_name.
position: position in the menu where the option is to be inserted. Note that positions start at 0, and separator lines
also count.
prepost: this argument can have the following values:
"PRE" to insert the option into GiD Preprocess menus.
"POST" to insert the option into GiD Postprocess menus.
"PREPOST" to insert the option into both Pre- and Postprocess menus.
command: is the command called when the menu option is selected.
acceler: optional, key accelerator, like "Control-s"
icon: optional, name of a 16x16 pixels icon to show in the menu
ins_repl: optional, if the argument is:
replace: (default) the new option replaces the option in the given position
insert: the new option is inserted before the given position.
insertafter: the new option is inserted after the given position.
translationfunc: optional, must be _ for GiD strings (default), or = for problemtype strings

GiDMenu::RemoveOption {menu_name_untranslated option_name_untranslated prepost {translationfunc


_}}
Removes an option from a given menu.
menu_name_untranslated: name of the menu (English) which contains the option you want to remove. e.g
"Utilities"
option_name_untranslated: name of the option (English) you want to remove. The option name, is a menu
sublevels list, like [list "List" "Points"]
prepost: this argument can have the following values:
"PRE" to insert the option into GiD Preprocess menus.
"POST" to insert the option into GiD Postprocess menus.
"PREPOST" to insert the option into both Pre- and Postprocess menus.
translationfunc: optional, must be _ for GiD strings (default), or = for problemtype strings

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::ModifyOption { menu_name_untranslated option_name_untranslated prepost


new_option_name {new_command -default-} {new_acceler -default-} {new_icon -default-}
{translationfunc _} }
Edit an existent option from a given menu
some parameters can be '-default-' to keep the current value for the command, accelerator, etc
Managing menus 155

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 and GiD_UnRegisterPluginAddedMenuProc


This commands can be used to specify a callback procedure name to be called to do some change to the original
menus

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.

GiD_RegisterExtensionProc and GiD_UnRegisterExtensionProc


This tcl command must be used to register a procedure that is able to handle when using 'drag and drop' of a file on
the GiD window.
It is possible to specify the extension (or a list of extensions) of the files to be handled, the mode PRE or POST where it
will be handled, and the name of the callback procedure to be called.

GiD_RegisterExtensionProc <list of extensions> <prepost> <procname>


GiD_UnRegisterExtensionProc <list of extensions> <prepost>

<extension> is the file extension, preceded by a dot


<prepost> could be PRE or POST
The procedure prototype to be registered must expect a single parameter, the dropped file name, something like this.
proc <procname> { filename } {
... do something ...
}

Example:
GiD_RegisterExtensionProc ".gif .png" PRE MyImageProcedure

EXAMPLE: creating and modifying menus


In this example we create a new menu called "New Menu" and we modify the GiD Help menu:

The code to make these changes would be:

GiDMenu::Create "New Menu" "PRE" -1 =


GiDMenu::InsertOption "New Menu" [list "Option 1"] 0 PRE "Command_1" "" "" replace =
GiDMenu::InsertOption "New Menu" [list "Option 2"] 1 PRE "Command_2" "" "" replace =
GiDMenu::InsertOption "New Menu" [list "---"] 2 PRE "" "" "" replace =
GiDMenu::InsertOption "New Menu" [list "Option 3"] 3 PRE "Command_3" "" "" replace =

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::RemoveOption "Help" [list "Customization Help"] PRE _


GiDMenu::RemoveOption "Help" [list "What is new"] PRE _
GiDMenu::RemoveOption "Help" [list "FAQ"] PRE _

GiDMenu::UpdateMenus

8.7 Custom data windows

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.

The prototype of a TKWIDGET procedure is as follow:

proc TKWidgetProc {event args} {


switch $event {
INIT {
...
}
TkWidget 157

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"

TKWIDGET: GidUtils::TkwidgetEntryConfigure {-width 20}

and then define the Tcl procedure ready to get the first extra argument 'configure_options' before 'events':

proc GidUtils::TkwidgetEntryConfigure { configure_options event args } {


...
}

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 procedure should return:


an empty string "" meaning that every thing was OK;
a two-list element {ERROR-TYPE Description} where ERROR-TYPE could be ERROR or WARNING. ERROR means that
something is wrong and the action should be aborted. If ERROR-TYPE is the WARNING then the action is not aborted
but Description is shown as a message. In any case, if Description is not empty a message is displayed.

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

Predefined TKWIDGET procedures:


There are some useful features that have been implemented in tcl procedures provided by default in GiD, inside the
dev_kit.tcl file,
specially to replace the standard entry of a question by some specialized widget.

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.

8.7.2 Data windows behavior

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.

The syntax of the procedure is as follows:

GiD_DataBehaviour data_class name ?cmd? proplist

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}

GiD_ShowBook is a procedure to hide/show a book from the menus

GiD_ShowBook class book show


where
class must be: gendata materials conditions or intvdata
book is the name of the book to be show or hidden
show must be 0 or 1
After change the book properties is necessary to call to GiDMenu::UpdateMenus

Example:
GiD_ShowBook materials tables 0
GiDMenu::UpdateMenus

8.8 Interaction with themes

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

charged, after that, user could change colors by going to preferences)

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

See source code of gid_themes package inside the scripts folder.

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.

8.8.2 Asking for images

Use in your module the same image as GiD use


In order to use an image that GiD use, you must use the tcl function gid_themes::GetImage, to see a complet list of
images available you can take a look for example to the folder:
(GiD Folder)\themes\GiD_classic\images\large_size(24andmore)\

proc gid_themes::GetImage { filename IconCategory }


IconCategory could be: "small_icons", "large_icons", "menu", "toolbar"
There is another IconCategory, "generic", that is the category used when the parameter is omitted. Using this category the
image is retrieved from root image folder (Example: (GiD Folder)\themes\GiD_classic\images\ ), but the use of this
category its not recommended, since images from root folders are not guaranteed on future versions.

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

Use in your module your own images


If your module needs other images from ones supplied by GiD
You can use:
gid_themes::GetImageModule to get the appropriate image, from inside the module folder, depending on current
theme.
gid_themes::GetImage { full_path_filename } , image will be equal regardless of current theme. This is the 'old sytle',
with the module images stored as module developer want, without follow the previously recommended folder layout.

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

8.8.3 Forcing themes use

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.

8.8.4 Creating new themes

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.

For creating a new theme you must know.

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.

There are two possible plugin mechanisms:


Tcl plug-in

9.1 Tcl plug-in

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.

See chapter about 'C Programming for Tcl' of


"Practical Programming in Tcl and Tk" by Brent Welch, Ken Jones, and Jeff Hobbs at http://www.beedub.com/book

9.2 GiD dynamic library plug-in

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

9.2.3 Developing the plug-in

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.

Functions to be defined by the plug-in


Following functions should be defined and implemented by the plug-in:
extern "C" GID_DLL_EXPORT int GiD_PostImportFile( const char *filename) ) {
... ;
return 0; // 1 - on error
}
extern "C" GID_DLL_EXPORT const char *GiD_PostImportGetLibName( void) {
return "Wavefront Objects import";
}
extern "C" GID_DLL_EXPORT const char *GiD_PostImportGetFileExtensions( void) {
return "{{Wavefront Objects} {.obj}} {{All files} {*}}";
}
extern "C" GID_DLL_EXPORT const char *GiD_PostImportGetDescription( void) {
return "Wavefront OBJ import plugin for GiD";
}
extern "C" GID_DLL_EXPORT const char *GiD_PostImportGetErrorStr( void) {
return _G_err_str; // if error, returns the error string
}

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.

9.2.4 Functions provided by GiD

Inside the GiD_PostImportFile function, following functions can be called to pass information to GiD:

extern "C" int GiD_NewPostProcess( void);

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);

extern "C" int GiD_SetVertexPointer( int id,


_t_gidBasicType basic_type,
_t_gidVertexListType list_type,
int num_components,
int num_vertices,
unsigned int offset_next_element,const void *pointer);

extern "C" int GiD_SetElementPointer( int id,


_t_gidBasicType basic_type,
_t_gidElementListType list_type,
_t_gidElementType element_type,
int num_elements,
unsigned int offset_next_element,
const void *pointer,
unsigned int offset_float_data,
const void *float_ptr);

extern "C" int GiD_NewResult( const char *analysis_name, double step_value,


const char *result_name, int mesh_id);

extern "C" int GiD_SetResultPointer( int id,


_t_gidBasicType basic_type,
_t_gidResultListType list_type,
_t_gidResultType result_type,
_t_gidResultLocation result_location,
int num_results,
unsigned int offset_next_element,
const void *pointer);

extern "C" int GiD_EndResult( int id);

extern "C" int GiD_EndMesh( int id);

extern "C" Tcl_Interp *GiD_GetTclInterpreter();

Here is the description for each provided function:


173

10 APPENDIX A (PRACTICAL EXAMPLES)


To learn how to configure GiD for a particular type of analysis, you can find some practical examples:

By following the tutorial of the chapter Defining a problem type of the GiD user manual.
By studing and modifing some existing Problem Types

Problem types included in GiD by default as example in $GID/problemtypes/Examples:


cmas2d: This is the problem type created in the tutorial, which finds the distance of each element relative to the
center of masses of a two-dimensional surface. It uses the following files: .cnd, .mat, .prb, .bas, .tcl and .bat.
There is a help file inside directory cmas2d.gid called cmas2d.html
cmas2d_customlib: The same problem type, but implemented using the 'CustomLib library'.
cmas2d_customlib_wizard: The same problem type, but implemented using the GiD Smart Wizard package, to
generate a wizard GUI
complex_example: uses some basic Tcl/Tk interaction (in complex_example.tcl) with GiD to:
add a new menu in GiD's menu bar;
create an icon bar for the problem type, with their own images;
using conditions to evaluate user defined formulae at the nodes of the domain: look into
complex_example.cnd and complex_example.bas .

Other problemtypes can be downloaded from the Data->Problem type->Internet retrievemenu:


Kratos: Multiphysics FEM open source C++ code.
RamSeries: This is a problem type which performs the structural analysis of either beams or shells or a combination of
both using the Finite Element Method. This problem type uses the latest features offered by GiD . The .exe file for
Windows systems is also included in a limited version.
Tdyn: Multiphysics solver (including CFD, heat transfer, species advection, pde solver and free surface problems).
CompassFEM is a suite that includes both Tdyn and RamSeries codes
NASTRAN: Static and dynamic interface for the NASTRAN commercial analysis program (not included)

For the full version without limitations check http://www.compassis.com.


175

11 APPENDIX B (classic problemtype system)


From version 13 of GiD, a new system of problem types has been developed, which offers several advantages compared
with the old (classic) system: it organizes better the data, provides with a more intuitive and user-friendly GUI, enable
more sofisticated integration tools, etc... From this version on, this 'classic' system of problemtypes is considered
deprecated, however, it is still supported by GiD.

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

11.1 PROBLEMTYPE 'CLASSIC'

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

Directory name: problem_type_name.gid


Directory location: c:\a\b\c\GiD_directory\problemtypes

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 ...

Tcl extension files


problem_type_name.tcl Extensions to GiD written in the Tcl/Tk programming language

Command execution files


problem_type_name.bat Operating system shell that executes the analysis process

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.

11.1.1 CONFIGURATION FILES

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.

11.1.1.1 Conditions file (.cnd)

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

The format of the file is as follows:

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'

Automatic alternative axes:


They are calculated like the automatic case and then swap x and y axes:
x''= y'
y''= - x'
z''= z'

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

Main curvature axes:


They are calculated for surfaces finding on a point the directions where the curvatures are maximum and minimum, but
these directions are not always well defined.
e.g. in a planar point the curvature is zero in all directions, all directions could be seen as main directions, and in a sphere
the curvature is constant=1/Radius and it happen the same.

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.

Self Calculated #FUNC# fields:


Another type of field that can be included inside a condition is a #FUNC# to do some calculation,
where the key #FUNC#, means that the value of this field will be calculated just when the mesh is generated. It can be
considered as a function that evaluates when meshing.

Valid variables for a #FUNC# field are:


NumEntity: to track the numerical id of the geometric source entity
x y z : to use the coordinates of the node or entity center where the condition is applied
Cond(num_field,REAL): to use the value of other fields of this condition (REAL or INT declare that must be considered
as a real or a integer number)
Valid mathematical operations are the same as the used for the *Operation template command.

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.

QUESTION: X_press#FUNC#(Cond(3,REAL)*(x-Cond(1,REAL))/ (Cond(2,REAL)-Cond(1,REAL)))


VALUE: 0

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).

11.1.1.1.1 Example: Creating the conditions file

Here is an example of how to create a conditions file, explained step by step:

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

Conditions window in GiD Preprocessing

11.1.1.2 Problem and intervals data file (.prb)

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.

The format of the file is as follows:

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).

11.1.1.2.1 Example: Creating the PRB data file

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.

2 Start the file with the line:


PROBLEM DATA
Example: Creating the PRB data file 181

3 Then add the following lines:


QUESTION: Unit_System#CB#(SI,CGS,User)
VALUE: SI
QUESTION: Title
VALUE: Default_title

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.

4 To end the file, add the following line:


END PROBLEM DATA

5 The whole file is as follows:


PROBLEM DATA
QUESTION: Unit_System#CB#(SI,CGS,User)
VALUE: SI
QUESTION: Title
VALUE: Default_title
END PROBLEM DATA

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.

Problem Data window in GiD Preprocessing

11.1.1.3 Materials file (.mat)

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

alphanumeric, integers or real numbers, depending on their type.

Note: There are other options available to expand the capabilities of the Materials window (see Special fields).

11.1.1.3.1 Example: Creating the materials file

Here is an example of how to create a materials file, explained step by step:

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.

Materials window in GiD Preprocessing

11.1.1.4 Special fields


Special fields 183

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 declaration of the table requires two lines of text:

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.

VALUE: #N# number_of_values value_1 ... value_m

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

Options corresponding to books

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

Data window with an image

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
...

Data property with units

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

brings the property to the enabled state.


4 <Pi> is the name of the property to be modified.
5 <NVi> is the new value of <Pi>. A special value is #CURRENT#, which refers to the current value of <Pi>.
Here is an example:
...
TITLE: General
QUESTION: Type_of_Analysis:#CB#(FILLING,SOLIDIFICATION)
VALUE: SOLIDIFICATION
DEPENDENCIES: (FILLING,TITLESTATE,Filling-Strategy,normal,RESTORE,
Filling_Analysis,GRAVITY,HIDE,Solidification_Analysis,#CURRENT#)
DEPENDENCIES: (SOLIDIFICATION,TITLESTATE,Filling-Strategy,hidden,HIDE,
Filling_Analysis,#CURRENT#,RESTORE,Solidification_Analysis,#CURRENT#)
TITLE: Filling-Strategy
QUESTION: Filling_Analysis:#CB#(GRAVITY,LOW-PRESSURE,FLOW-RATE)
VALUE: GRAVITY
QUESTION: Solidification_Analysis:#CB#(THERMAL,THERMO-MECHANICAL)
VALUE: THERMAL
...

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

TKWIDGET: TkWidget -pag. 156-


The Tkwidged special field mechanism allow to customize with Tcl scripting language condition or material fields.
some Tcl procedures are predefined in dev_kit.tcl to be used for common cases, like show current layers, materials, pick a
point or node, or select a filename.
Layer field:
Declare in the tkwidget field to use the Tcl procedureGidUtils::TkwidgetGetLayername, e.g:
...
QUESTION: your_question
VALUE: your_layername
TKWIDGET: GidUtils::TkwidgetGetLayername

Material field:
Declare in the tkwidget field to use the Tcl GidUtils::TkwidgetGetMaterialname e.g:
...
QUESTION: your_question
VALUE: your_materialname
TKWIDGET: GidUtils::TkwidgetGetMaterialname

Pick point or node field


Declare in the tkwidget field to use the Tcl procedure GidUtils::TkwidgetPickPointOrNode , e.g.
...
QUESTION: your_question
VALUE: your_node_id
TKWIDGET: GidUtils::TkwidgetPickPointOrNode

Select filename field


Declare in the tkwidget field to use the Tcl procedure GidUtils::TkwidgetGetFilenameButton , e.g.
...
QUESTION: your_question
VALUE: your_filename
TKWIDGET: GidUtils::TkwidgetGetFilenameButton

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

Text widget instead of entry widget


To replace the standard single-line entry widget with a multi-line text widget.
...
QUESTION: your_question
VALUE: your_value
TKWIDGET: GidUtils::TkwidgetText

Configure the entry field widget


procedure to change some configuration of the ttk::entry widget. GidUtils::TkwidgetEntry
CONFIGURE {-<option> <value>}
...
QUESTION: your_question
VALUE: your_value
TKWIDGET: GidUtils::TkwidgetEntry CONFIGURE {-width 20}

11.1.1.5 Unit System file (.uni)

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:

USER DEFINED: ENABLED


(or DISABLED)

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:

USE BASE SYSTEMS: DISABLED


(or ENABLED)

With the command HIDDEN: 'magnitude', 'magnitude' certain magnitudes will not be displyed in the Problem units window.

HIDDEN: strength, pressure

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

corresponds to the user-defined system.

Data unit window

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.

Hide some units depending on unit system:

The tcl procedure Units::SetUnitsDisallowed allow to specify a list of units to be disallowed (not used in graphical windows)

proc Units::SetUnitsDisallowed { basic_units_to_disallow }

example

proc GiD_Event_InitProblemtype { dir } {


My_On_AfterChangeModelUnitSystem [GiD_Units get system]
}

proc GiD_Event_AfterChangeModelUnitSystem { old_unit_system new_unit_system } {


My_On_AfterChangeModelUnitSystem $new_unit_system
}

proc My_On_AfterChangeModelUnitSystem { new_unit_system } {


if { $new_unit_system == "IMPERIAL" } {
Units::SetUnitsDisallowed {m cm mm Mm km kg ton kton N kp kN MN Nm kNm MNm Pa kPa MPa GPa}
} elseif { [string range $new_unit_system 0 8] == "INTERNATIONAL" } {
Units::SetUnitsDisallowed {in Mi miles ft lb lbf kip lbfft lbfin psi ksi Gal}
} else {
W "unexpected unit system $new_unit_system"
}
}

11.1.1.6 Conditions symbols file (.sim)

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.

11.1.2 Template files

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.

11.1.2.1 Commands used in the .bas file

List of bas commands: (all these commands must be prefixed by a character *)

Add

Break

Clock Cond CondElemFace CondHasLocalAxes CondName CondNumEntities CondNumFields


Commands used in the .bas file 191

ElemsCenter ElemsConec ElemsLayerName ElemsLayerNum ElemsMat ElemsMatProp ElemsNnode ElemsNnodeCurt


ElemsNNodeFace ElemsNNodeFaceCurt ElemsNormal ElemsNum ElemsRadius ElemsType ElemsTypeName Else ElseIf End
Endif

FaceElemsNum FaceIndex FactorUnit FileId For Format


GenData GlobalNodes GroupColorRGB GroupFullName GroupName GroupNum GroupNumEntities GroupParentName
GroupParentNum

If Include IntFormat IntvData IsQuadratic


LayerColorRGB LayerName LayerNum LayerNumEntities LocalAxesDef LocalAxesDefCenter LocalAxesNum LocalNodes Loop
LoopVar

MaterialLocalNum MatNum MatProp MessageBox

Ndime Nelem Nintervals NLocalAxes Nmats Nnode NodesCoord NodesLayerName NodesLayerNum NodesNum Npoin

Operation

RealFormat Remove

Set SetFormatForceWidth SetFormatStandard

Tcl Time

Units

WarningBox

11.1.2.1.1 Single value return commands

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:

*set var i_material=3


*MaterialLocalNum(*i_material)
*MaterialLocalNum(Steel)

*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

*CondHasLocalAxes. returns 1 if the condition has a local axis field, 0 else

*CondNumEntities. You must have previously selected a condition (see *set cond). This returns the number of
entities that have a condition assigned over them.

*ElemsNum: This returns the element's number.


*NodesNum: This returns the node's number.
*MatNum: This returns the material's number.
*ElemsMat: This returns the number of the material assigned to the element.

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)

*LayerNum: This returns the layer's number.


*LayerName: This returns the layer's name.
*LayerColorRGB: This returns the layer's color in RGB (three integer numbers between 0 and 256). If parameter (1),
(2) or (3) is specified, the command returns only the value of one color. RED is 1, GREEN is 2 and BLUE is 3.

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.

*GroupNum: This returns the group's index number.


*GroupFullName: This returns the full group's name, including parents separed by //. e.g: a//b//c
*GroupName: This returns only the tail group's name. e.g: c (if group's doesn't has parent then is the same as the
full name)
*GroupColorRGB: This returns the group's color in RGB (three integer numbers between 0 and 256). If parameter
(1), (2) or (3) is specified, the command returns only the value of one color. RED is 1, GREEN is 2 and BLUE is 3.
*GroupParentName: This returns the name of the parent of the current group
*GroupParentNum: This returns the index of the parent of the current group

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.

The valid C-functions that can be used are:


+,-,*,/,%,(,),=,<,>,!,&,|, numbers and variables
Single value return commands 194

sin
cos
tan
asin
acos
atan
atan2
exp
fabs
abs
pow
sqrt
log
log10
max
min
strcmp
strcasecmp

The following are valid examples of operations:

*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.

Note: Commands inside *operation do not need * at the beginning.

*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.

*Time. This returns the number of seconds elapsed since midnight.

*Clock. This returns the number of clock ticks (aprox. milliseconds) of elapsed processor time.

Example:

*set var t0=clock


*loop nodes
*nodescoord
*end nodes
*set var t1=clock
ellapsed time=*operation((t1-t0)/1000.0) seconds

*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.

11.1.2.1.2 Multiple values return commands

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.

Example: using *NodesCoord inside a loop of nodes

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).

The contents of the project_name.dat file could be something like this:

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.

Inside a loop of elements:


*NodesCoord(4) writes the coordinates of the 4th node of the actual element of the loop.
*NodesCoord(5,1) writes the x coordinate of the 5th node of the actual element of the loop.
*NodesCoord(5,2) writes the y coordinate of the 5th node of the actual element of the loop.
*NodesCoord(5,3) writes the z coordinate of the 5th node of the actual element of the loop.

*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:

Triangle: 1-2 2-3 3-1


Quadrilateral: 1-2 2-3 3-4 4-1
Tetrahedra: 1-2-3 2-4-3 3-4-1 4-2-1
Hexahedra: 1-2-3-4 1-4-8-5 1-5-6-2 2-6-7-3 3-7-8-4 5-8-7-6
Prism: 1-2-3 1-4-5-2 2-5-6-3 3-6-4-1 4-5-6
Pyramid: 1-2-3-4 1-5-2 2-5-3 3-5-4 4-5-1

*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

Rotation of a vector expressed in terms of euler angles.

How to calculate X[3] Y[3] Z[3] orthonormal vector axes from three euler angles angles[3]

X[0]= cosC*cosA - sinC*cosB*sinA


X[1]= -sinC*cosA - cosC*cosB*sinA
X[2]= sinB*sinA

Y[0]= cosC*sinA + sinC*cosB*cosA


Y[1]= -sinC*sinA + cosC*cosB*cosA
Y[2]= -sinB*cosA

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

if(Z[2]<1.0-EPSILON && Z[2]>-1.0+EPSILON){


double senb=sqrt(1.0-Z[2]*Z[2]);
angles[1]=acos(Z[2]);
angles[2]=acos(Z[1]/senb);
if(Z[0]/senb<0.0) angles[2]=M_2PI-angles[2];
angles[0]=acos(-Y[2]/senb);
if(X[2]/senb<0.0) angles[0]=M_2PI-angles[0];
} else {
angles[1]=acos(Z[2]);
angles[0]=0.0;
angles[2]=acos(X[0]);
if(-X[1]<0.0) angles[2]=M_2PI-angles[2];
}

*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

*LocalAxesDefCenter(1) *LocalAxesDefCenter(2) *LocalAxesDefCenter(3)

11.1.2.1.3 Specific commands

*\ 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.

After the command *loop:


- If the variable is nodes, elems or faces, you can include one of the modifiers: *all,
*OnlyInCond,*OnlyInLayer or *OnlyInGroup. The first one signifies that the iteration is going to be performed
over all the entities.
The *OnlyInCond modifier implies that the iteration will only take place over the entities that satisfy the relevant
condition. This condition must have been previously defined with *set cond.
*OnlyInLayer implies that the iteration will only take place over the entities that are in the specified layer; layers
must be specified with the command *set Layer.
*OnlyInGroup implies that the iteration will only take place over the entities that are in the specified group;
group must be specified inside a loop groups with the command *set Group *GroupName *nodes|elems|faces, or
*set Group <name> , with <name> the full name of the group.
By default, it is assumed that the iteration will affect all the entities.

- 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.

The following are valid examples of the use of the conditionals:

*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

*set. This command has the following purposes:


*set cond: To set a condition.
*set Layer "layer name" *nodes|elems: To set a layer.
*set Group "group name" *nodes|elems|faces: To set a group. (inside a *loop groups can use *GroupName as
"group name" ,to get the name of the group of the current loop)
Specific commands 201

*set elems: To indicate the elements.


*set var: To indicate the variables to use.

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.

*Set Layer "layer name" *elems|nodes


*Add Layer "layer name"
*Remove Layer "layer name"
This command sets a group of nodes. In the following loops over nodes/elements with the modifier *OnlyInLayer, the
iterations will only take place over the nodes/elements of that group.

Example 1:

*set Layer example_layer_1 *elems


*loop elems *OnlyInLayer
Nº:*ElemsNum Name of Layer:*ElemsLayerName Nº of Layer :*ElemsLayerNum
*end elems

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:

*Set Cond Line-Constraints *nodes

In this case, when two lines share one endpoint, instead of two nodes in the list, only one is written.

A typical situation where you would use *CanRepeat might be:

*Set Cond Line-Pressure *elems *CanRepeat

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:

*Set Cond Volu-Cstrt *nodes *or(1,int) *or(2,int)


*Add Cond Surf-Cstrt *nodes *or(1,int) *or(2,int)
*Add Cond Line-Cstrt *nodes *or(1,int) *or(2,int)
*Add Cond Poin-Cstrt *nodes *or(1,int) *or(2,int)

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:

*Set Cond Dummy *elems


*Set elems(All)
*Remove elems(Linear)

To indicate that all dummy elements apart from the linear ones will be considered, as well as:

*Set Cond Dummy *elems


*Set elems(Hexahedra)
*Add elems(Tetrahedra)
*Add elems(Quadrilateral)
*Add elems(Triangle)

The format for *set var differs from the syntax for the other two *set commands. Its syntax is as follows:

*Set var varname = expression


where varname is any name and expression is any arithmetical expression, number or command, where the latter
must be written without * and must be defined as Int or Real.
A Tcl procedure can also be called, but it must return a numerical result.The following are valid examples for these
assignments:

*Set var ko1=cond(1,real)


*Set var ko2=2
*Set var S1=CondNumEntities
*Set var p1=elemsnum()
*Set var b=operation(p1*2)
*tcl(proc MultiplyByTwo { x } { return [expr {$x*2}] })*\
*Set var a=tcl(MultiplyByTwo *p1)

*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 common flags are:


- To left align the result
+ To prefix the numerical output with a sign (+ or -)
# To force the real output value to contain a decimal point.

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.

The following are valid examples of the use of format:

*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.

*SetFormatStandard changes to the default state, with truncation disabled.


Specific commands 204

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.

In the .bas file:

*set var num=1


*tcl(WriteSurfaceInfo *num)
*set var num2=tcl(MultiplyByTwo *num)

In the .tcl file:

proc WriteSurfaceInfo { num } {


return [GiD_Info list_entities surfaces $num]
}

proc MultiplyByTwo { x } {
return [expr {$x*2}]
}

11.1.2.2 General description

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

Window created in the cmas2d.tcl example file

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:

proc InitGIDProject {dir}

proc InitGIDProject {dir } {


set materials [GiD_Info materials]
set conditions [GiD_Info conditions ovpnt]
CreateWindow $dir $materials $conditions
}
This is the main procedure. It is executed when the problem type is selected. It calls the CreateWindow procedure.

proc CreateWindow {dir mat cond}

proc CreateWindow {dir mat cond} {


if { [GidUtils::AreWindowsDisabled] } {
return
}
set w .gid.win_example
InitWindow $w [= "CMAS2D.TCL - Example tcl file"] ExampleCMAS "" "" 1
if { ![winfo exists $w] } return ;# windows disabled || usemorewindows == 0
ttk::frame $w.top
ttk::label $w.top.title_text -text [= "TCL window example for CMAS2D problem type"]
ttk::frame $w.information -relief ridge
ttk::label $w.information.path -text [= "Problem Type path: %s" $dir]
ttk::label $w.information.materials -text [= "Available materials: %s" $mat]
ttk::label $w.information.conditions -text [= "Available conditions: %s" $cond]
ttk::frame $w.bottom
ttk::button $w.bottom.start -text [= "Continue"] -command "destroy $w"
ttk::button $w.bottom.random -text [= "Random surface"] -command "CreateRandomSurface $w"
grid $w.top.title_text -sticky ew
grid $w.top -sticky new
grid $w.information.path -sticky w -padx 6 -pady 6
grid $w.information.materials -sticky w -padx 6 -pady 6
grid $w.information.conditions -sticky w -padx 6 -pady 6
grid $w.information -sticky nsew
grid $w.bottom.start $w.bottom.random -padx 6
grid $w.bottom -sticky sew -padx 6 -pady 6
if { $::tcl_version >= 8.5 } { grid anchor $w.bottom center }
grid rowconfigure $w 1 -weight 1
grid columnconfigure $w 0 -weight 1
}

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.

proc CreateRandomSurface {w}

proc CreateRandomSurface {w} {


set ret [tk_dialogRAM $w.dialog [= "Warning"] \
[= "Warning: this will create a nurbs surface in your current project"] "" 1 [= "Ok"] [=
Detailed example 216

"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.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy