@@ -249,13 +249,6 @@ proc ::Structural::write::writeHinges { } {
249249 # format for writing ids
250250 set id_f [dict get $write::formats_dict ID]
251251
252- # Preprocess old_conditions. Each mesh linear element remembers the origin line in geometry
253- set match_dict [dict create]
254- foreach line [GiD_Info conditions relation_line_geo_mesh mesh] {
255- lassign $line E eid - geom_line
256- dict lappend match_dict $geom_line $eid
257- }
258-
259252 # Process groups assigned to Hinges
260253 if {$::Model::SpatialDimension eq " 3D" } {
261254 set xp1 " [ spdAux::getRoute [GetAttribute nodal_conditions_un] ]/condition\[ @n = 'CONDENSED_DOF_LIST'\] /group"
@@ -297,9 +290,20 @@ proc ::Structural::write::writeHinges { } {
297290
298291 # Write Left and Rigth end of each geometrical bar
299292 foreach geom_line [GiD_EntitiesGroups get $group lines] {
300- set linear_elements [dict get $match_dict $geom_line ]
301- set first [::tcl::mathfunc::min {*}$linear_elements ]
302- set end [::tcl::mathfunc::max {*}$linear_elements ]
293+ # ask the mesh for the linear elements of this line
294+ # check https://gidsimulation.atlassian.net/wiki/spaces/GCM/pages/2385543949/Geometry
295+ # set linear_elements [lindex [GiD_Geometry get line $geom_line mesh] 4]
296+ # set first [::tcl::mathfunc::min {*}$linear_elements]
297+ # set end [::tcl::mathfunc::max {*}$linear_elements]
298+
299+ lassign [lrange [GiD_Geometry get line $geom_line ] 2 3] first_point end_point
300+ set first [GiD_Geometry get point $first_point node]
301+ set end [GiD_Geometry get point $end_point node]
302+ if {$first eq " " || $end eq " " } {
303+ W " Error: Line $geom_line has no nodes. Please make sure the mesh is attached to the geometry."
304+ continue
305+ }
306+
303307 if {[llength $first_list ] > 0} {
304308 set value [join $first_list ,]
305309 write::WriteString [format " $id_f \[ %d\] (%s)" $first [llength $first_list ] $value ]
0 commit comments