|
| 1 | + |
| 2 | +proc ::CDEM::xml::BulkGroup {args} { |
| 3 | + |
| 4 | + |
| 5 | + if {![Kratos::IsModelEmpty]} { |
| 6 | + set entity surfaces |
| 7 | + if {$::Model::SpatialDimension eq "3D"} { |
| 8 | + set entity volumes |
| 9 | + } |
| 10 | + set txt "Bulk grouping of all the current $entity is about to be executed" |
| 11 | + set retval [tk_messageBox -default ok -icon question -message $txt -type okcancel] |
| 12 | + if { $retval == "cancel" } { return } |
| 13 | + } |
| 14 | + |
| 15 | + CreateAndAssignBondedGroups |
| 16 | + |
| 17 | + GiD_Process 'Redraw |
| 18 | + GidUtils::UpdateWindow GROUPS |
| 19 | + GidUtils::UpdateWindow LAYER |
| 20 | + GiD_Process 'Zoom Frame |
| 21 | + |
| 22 | + spdAux::RequestRefresh |
| 23 | +} |
| 24 | + |
| 25 | +proc ::CDEM::xml::CreateAndAssignBondedGroups { } { |
| 26 | + |
| 27 | + # Prepare the variables |
| 28 | + set entity surface |
| 29 | + set condition_id "DEM-Cohesive2D" |
| 30 | + if {$::Model::SpatialDimension eq "3D"} { |
| 31 | + set entity volume |
| 32 | + set condition_id "DEM-Cohesive" |
| 33 | + } |
| 34 | + set group_base Bonded_domain_groups |
| 35 | + # Locate the condition |
| 36 | + set DEMConditions [spdAux::getRoute "DEMConditions"] |
| 37 | + set cohesive_cond "$DEMConditions/condition\[@n='$condition_id'\]" |
| 38 | + |
| 39 | + # Clear previous assignations |
| 40 | + if {[GiD_Groups exists $group_base]} {GiD_Groups delete $group_base} |
| 41 | + gid_groups_conds::delete "$cohesive_cond/group" |
| 42 | + |
| 43 | + # Get the list of entities (surfaces/volumes) |
| 44 | + set entity_list [GiD_Geometry -v2 list $entity] |
| 45 | + # Foreach entity, create subgroup and assign it to the condition |
| 46 | + set entity_list_length [objarray length $entity_list] |
| 47 | + for {set i 0} {$i < $entity_list_length} {incr i} { |
| 48 | + # Get the entity id |
| 49 | + set entity_id [objarray get $entity_list $i] |
| 50 | + # Create the subgroup |
| 51 | + set group_id "$group_base//SG$entity_id" |
| 52 | + GiD_Groups create $group_id |
| 53 | + # Assign entity to subgroup |
| 54 | + GiD_EntitiesGroups assign $group_id $entity $entity_id |
| 55 | + # Assign the subgroup to the tree condition |
| 56 | + set cohesive_group [customlib::AddConditionGroupOnXPath $cohesive_cond $group_id] |
| 57 | + } |
| 58 | +} |
0 commit comments