Minor fix

This commit is contained in:
Dion Moult
2022-10-04 20:16:25 +11:00
parent be805a3e96
commit 1f56b36bfa
2 changed files with 12 additions and 8 deletions
@@ -31,15 +31,19 @@ class Usecase:
def execute(self):
self.settings["unit_scale"] = ifcopenshell.util.unit.calculate_unit_scale(self.file)
is_2d = len(self.settings["axis"][0]) == 2
points = [self.convert_si_to_unit(p) for p in self.settings["axis"]]
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))
if is_2d:
curve = self.file.createIfcIndexedPolyCurve(self.file.createIfcCartesianPointList2D(points), None, False)
else:
curve = self.file.createIfcIndexedPolyCurve(self.file.createIfcCartesianPointList3D(points), None, False)
return self.file.createIfcShapeRepresentation(
self.settings["context"],
self.settings["context"].ContextIdentifier,
"Curve2D" if len(self.settings["axis"][0]) == 2 else "Curve3D",
"Curve2D" if is_2d else "Curve3D",
[curve],
)
@@ -47,16 +47,16 @@ class Usecase:
length = self.convert_si_to_unit(self.settings["length"])
thickness = self.convert_si_to_unit(self.settings["thickness"])
points = (
(0.0, 0.0, 0.0),
(0.0, thickness, 0.0),
(length, thickness, 0.0),
(length, 0.0, 0.0),
(0.0, 0.0, 0.0),
(0.0, 0.0),
(0.0, thickness),
(length, thickness),
(length, 0.0),
(0.0, 0.0),
)
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))
curve = self.file.createIfcIndexedPolyCurve(self.file.createIfcCartesianPointList2D(points), None, False)
extrusion = self.file.createIfcExtrudedAreaSolid(
self.file.createIfcArbitraryClosedProfileDef("AREA", None, curve),
self.file.createIfcAxis2Placement3D(