Versions Compared

Key

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

...

Example: cmas2d_customlib

Let's see out our example: the cmas2d_customlib problemtype. You can see it's files on the example's problemtype folder (<GiD>\problemtypes\Examples\cmas2d_customlib.gid)
Inside it's folder, we can find the following files:

...


It's time to load the problemtype. Go to Data->Problemtype->Examples->cmas2d_customlib. The first you can see is a window like this:


This window helps you to generate a random 4 sided surface. For this example let's click Random surface and get an auto-generated surface. You can click continue and create your own surface. This is the surface I'll work with:

Image Modified


After this, let's open the properties tree. Go to Data->Data tree.

...

First we need to do in this function is to call some initialization procedures:


To open the file for writtingwriting:
customlib::InitWriteFile $filename


To initialize the material's database, indicating wich which 'conditions' have materials assigned.
customlib::InitMaterials [list "Shells"] active

...


It is time to write the point weights. To get the number of nodes where we are applying the weights, we need to specify which is the condition we are writtingwriting, and call GetNumberOfNodes:
set condition_list [list "Point_Weight"]
set number_of_conditions [customlib::GetNumberOfNodes $condition_list]


And foreach node with a Point_Weight condition asignedassigned, we need to print the node id and the asigned assigned weight.
set condition_list [list "Point_Weight"]
set condition_formats [list {"%1d" "node" "id"} {"%13.5e" "property" "Weight"}]
customlib::WriteNodes $condition_list $condition_formats


Finally, all we need to do is to close the writting writing file
customlib::EndWriteFile


To test this on your example, you just need to Save your model (ctrl + s), Mesh it (ctrl + g), and calculate (F5). You can see the result of the writting writing process opening the file {modelname}.dat on the model folder.

...