Skip to content

Commit 394c686

Browse files
DEM patch to avoid GiD bug.
Fixes the sphere losing in part groups
1 parent 4f0ee5e commit 394c686

1 file changed

Lines changed: 30 additions & 0 deletions

File tree

kratos.gid/apps/DEM/start.tcl

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,36 @@ proc ::DEM::AfterMeshGeneration { fail } {
166166
# }
167167
}
168168

169+
proc ::DEM::AfterSaveModel { filespd } {
170+
171+
# GiD bug detected in versions prev to 15.0.1
172+
# Spheres disapear in groups after load. Fixing it by removing the limitation in the prj file.
173+
# GiD Team -> @jginternationa and @escolano
174+
# Fixed in any 15.1.X (developer) and 15.0.1 and later (official)
175+
if {[GidUtils::VersionCmp "15.0.0"] <= 0} {
176+
::DEM::PatchMissingSpheresInGroup $filespd
177+
}
178+
}
179+
180+
proc ::DEM::PatchMissingSpheresInGroup {filespd} {
181+
set prj_file [file join [file dirname $filespd] [file rootname $filespd].prj]
182+
if {[file exists $prj_file]} {
183+
dom parse [tDOM::xmlReadFile $prj_file] doc
184+
185+
set grlist [$doc getElementsByTagName group]
186+
foreach group $grlist {
187+
if {[$group hasAttribute allowed_element_types]} {
188+
$group removeAttribute allowed_element_types
189+
}
190+
if {[$group hasAttribute allowed_types]} {
191+
$group removeAttribute allowed_types
192+
}
193+
}
194+
set fp [open $prj_file w]
195+
puts $fp [$doc asXML]
196+
close $fp
197+
}
198+
}
169199

170200

171201
::DEM::Init

0 commit comments

Comments
 (0)