See #4240. Fix bug where 2D arbitrary profiles were invalid IFC (used 3D point lists not 2D)

This commit is contained in:
Dion Moult
2024-01-21 16:06:46 +11:00
parent 36cf458498
commit 0ee07fb8cc
2 changed files with 12 additions and 2 deletions
@@ -58,7 +58,12 @@ class Usecase:
if self.file.schema == "IFC2X3":
curve = self.file.createIfcPolyline([self.file.createIfcCartesianPoint(p) for p in points])
else:
curve = self.file.createIfcIndexedPolyCurve(self.file.createIfcCartesianPointList3D(points))
dimensions = len(points[0])
if dimensions == 2:
ifc_points = self.file.createIfcCartesianPointList2D(points)
elif dimensions == 3:
ifc_points = self.file.createIfcCartesianPointList3D(points)
curve = self.file.createIfcIndexedPolyCurve(ifc_points)
return self.file.createIfcArbitraryClosedProfileDef("AREA", self.settings["name"], curve)
def convert_si_to_unit(self, co):
@@ -74,7 +74,12 @@ class Usecase:
outer_curve = self.file.createIfcIndexedPolyCurve(self.file.createIfcCartesianPointList3D(outer_points))
inner_curves = []
for inner_point in inner_points:
inner_curves.append(self.file.createIfcIndexedPolyCurve(self.file.createIfcCartesianPointList3D(inner_point)))
dimensions = len(inner_point[0])
if dimensions == 2:
ifc_points = self.file.createIfcCartesianPointList2D(inner_point)
elif dimensions == 3:
ifc_points = self.file.createIfcCartesianPointList3D(inner_point)
inner_curves.append(self.file.createIfcIndexedPolyCurve(ifc_points))
return self.file.createIfcArbitraryProfileDefWithVoids("AREA", self.settings["name"], outer_curve, inner_curves)
def convert_si_to_unit(self, co):