List of all GiD conditions/materials in project

Moderator: GiD Team

awa5114
Posts: 43
Joined: Thu Jan 26, 2017 5:10 pm

List of all GiD conditions/materials in project

Postby awa5114 » Fri Jul 20, 2018 2:48 pm

I would like to ask if it is possible to automatically extract all the used conditions and materials for a specific project using tcl or other programmatic method. Currently I have to click through every single condition and display it for every project I have and this is not fun.
User avatar
escolano
Posts: 1568
Joined: Thu Sep 18, 2014 3:31 pm

Re: List of all GiD conditions/materials in project

Postby escolano » Fri Jul 20, 2018 5:41 pm

Without any programming, you can see for example all 'classic' conditions applied to geometry or mesh (depending on current view mode) from the conditions window.
button: Entities->All conditions
or graphically with the button: Draw->All conditions->Exclude local axes (how are drawn could be customized)

and about materials
Draw->All materials (only the assigned materials are drawn and shown in the legend)

With Tcl programming you can do much more,
you can ask the information of conditions for example with "GiD_Info conditions"
e.g.
proc my_test_conditions { } {
foreach over_geometry {ovpnt ovline ovsurf ovvol ovlayer ovgroup} {
foreach condition_name [GiD_Info conditions $over_geometry] {
set $num_entities [GiD_Info conditions $condition_name geometry -count]
if { $num_entities } {
W "condition $condition_name assigned to $num_entities geometry entities"
}
}
}
return 0
}

and about materials, you can for example know the material number of entities with GiD_Info list_entities, GID_Info Mesh ...
e.g.
set data [GiD_Info Mesh Elements Triangle -array]
with -array flag the information is reordered more efficiently in vectors, the last vector store the index of its material (0 for none)
set material_ids [lindex [lindex [GiD_Info Mesh Elements Triangle -array] 0] 3]
this can be something like this, with a material id by triangle element:
0 1 0 0 0 0 5 5 0 0 0 0 0 0 5 0 0 0 0 0 0 0 0 1 0 1 0 0 0 0 0 0 0 0 1 1 1 1 1 0 1 0 0 0 0 0 0 0 0 0 0 5 5 5 5 5 0
you can easily know the ids of materials used by some triangle with this
set material_ids_used [objarray sort -unique $material_ids]
0 1 5

Return to “Customization”

Who is online

Users browsing this forum: No registered users and 1 guest