...
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 14.0<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:
After this, let's open the properties tree. Go to Data->Data tree.
...
- Write '25' in the Weight field
- Click on 'select' button and select one (or more) point.
- Press ESC to stop selecting. A group name will be generated.
- Click OK
Then we find 'Properties', a folder or 'container', that contains 'Shells' and 'Materials'. It's code is:
...
There is a 'container', another 'condition' called Shells, and a special 'value' called material. In this section, we want to assign a material from the database to a surface (see 'ov' field on the condition). NOTE: As you can see, there is an include to a file. The customLib library allows splitting the spd in different slices. You can find the materials database on that file in the problemtype folder.
By 'double clicking' on Shells, we get a window like this:
- Select a material from the list.
- Select the surface
- Press ESC
- Click OK
Your tree should look like this:
Writing the calculation files
...
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.
...