Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

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 writing

  • 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 assigning it a MID (Material Identifier) for further queries.

...

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, a material must be defined in the condition.

...

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


Example:

Code Block
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

...

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

...

Writes the coordinates of the nodes of the model.

2D example:

Code Block
customlib::WriteCoordinates "%5d %14.5e %14.5e%.0s\n"
Output:
1 6.89301E-002 8.61382E-003
2 7.49755E-002 1.26044E-002
3 7.44487E-002 3.68638E-003


3D example:

Code Block
customlib::WriteCoordinates "%5d %14.5e %14.5e %14.5e\n"

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:

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


Example:

Code Block
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'.
Utility to print the list of materials, and their properties defined in parameters.


Example:

Code Block
set parameters [list {"%4d" "material" "MID"} {"%13.5e" "material" "Density"}]

...


customlib::WriteMaterials $parameters used

Output:

1 7.85000e+003
2 2.65000e+003