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

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:

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:

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