Skip to content

Commit e63f083

Browse files
committed
Fix bug where IFC2X3 files cannot have coordinates reset properly
1 parent a376ec1 commit e63f083

2 files changed

Lines changed: 12 additions & 2 deletions

File tree

src/ifcblenderexport/blenderbim/bim/import_ifc.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -529,7 +529,12 @@ def reset_absolute_coordinates(self):
529529
# 12D can have some funky coordinates out of any sensible range. This
530530
# method will not work all the time, but will catch most issues.
531531
offset_point = None
532-
for point_list in self.file.by_type('IfcCartesianPointList3D'):
532+
try:
533+
point_lists = self.file.by_type('IfcCartesianPointList3D')
534+
except:
535+
# IFC2X3 does not have IfcCartesianPointList3D
536+
point_lists = []
537+
for point_list in point_lists:
533538
coord_list = [None] * len(point_list.CoordList)
534539
for i, point in enumerate(point_list.CoordList):
535540
if len(point) == 2 or not self.is_point_far_away(point):

src/ifcpatch/recipes/ResetAbsoluteCoordinates.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,12 @@ def patch(self):
88
# 12D can have some funky coordinates out of any sensible range. This
99
# method will not work all the time, but will catch most issues.
1010
offset_point = None
11-
for point_list in self.file.by_type('IfcCartesianPointList3D'):
11+
try:
12+
point_lists = self.file.by_type('IfcCartesianPointList3D')
13+
except:
14+
# IFC2X3 does not have IfcCartesianPointList3D
15+
point_lists = []
16+
for point_list in point_lists:
1217
coord_list = [None] * len(point_list.CoordList)
1318
for i, point in enumerate(point_list.CoordList):
1419
if len(point) == 2 or not self.is_point_far_away(point):

0 commit comments

Comments
 (0)