...
Let's open the cmas2d_customlib.tcl file and see how are we processing the event of GiD that is called when the user wants to calculate, AfterWriteCalcFileGIDProject. After a few check of the environment, 'Cmas2d::WriteCalculationFile $filename' is called (It is defined in the end of the same file).
$filename is the content of variable filename, in TCL to define a variable you must use "set ret -cancel-" and to use it "$ret"
First we need to do in this function is to call some initialization procedures:
...
To initialize the material's database, indicating wich 'conditions' have materials assigned.
customlib::InitMaterials [list "Shells"] active
Then we write some headers and to write the number of elements and nodes, we call some GiD_Info Functions:
customlib::WriteString "[GiD_Info Mesh NumElements] [GiD_Info Mesh NumNodes]"
...