GiD - The personal pre and post processor

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 Length, 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_unit L] [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\n"
  • 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
  • Constraints

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

  • Basic data

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 finally we get the current value with get_domnode_attribute

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

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

Alternatives

In this section, we will write the coordinates, connectivites, and conditions assuming that the input can be different, such as the one in Matfem . In some codes, like matfem, the input file into the solver is not written in a text file, but in a "code like file". The coordinates section in the matfem solver is a matlab array, with a single comma splitting x and y (x, y) and a semicolon splitting a node from another (x1, y1; x2, y2; ...)

  • Write coordinates:
    Example:


    Code:

 

  • Write elements:
    Example:


    Code:

 

  • Conditions
    Example:


    Code:
    spd

tcl

 

COPYRIGHT © 2022 · GID · CIMNE