GiD - The personal pre and post processor

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
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
*LayerName *LayerColorRGB
*Operation(LayerColorRGB(1)/255.0) *Operation(LayerColorRGB(2)/255.0) *Operation(LayerColorRGB(3)/255.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
    • 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.

COPYRIGHT © 2022 · GID · CIMNE