From 6d0fdb32c6ef02d44bd9957a50f23c7bb86844dd Mon Sep 17 00:00:00 2001 From: Dion Moult Date: Sat, 17 Sep 2022 14:51:50 +1000 Subject: [PATCH] Fix #2416. --- .../api/geometry/add_sverchok_representation.py | 2 +- .../api/geometry/add_wall_representation.py | 10 ++++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/ifcopenshell-python/ifcopenshell/api/geometry/add_sverchok_representation.py b/src/ifcopenshell-python/ifcopenshell/api/geometry/add_sverchok_representation.py index d86b089057..bb0ff285a1 100644 --- a/src/ifcopenshell-python/ifcopenshell/api/geometry/add_sverchok_representation.py +++ b/src/ifcopenshell-python/ifcopenshell/api/geometry/add_sverchok_representation.py @@ -77,7 +77,7 @@ class Usecase: ) def convert_si_to_unit(self, co): - if isinstance(co, tuple): + if isinstance(co, (tuple, list)): return [self.convert_si_to_unit(o) for o in co] if self.settings["coordinate_offset"]: return (co / self.settings["unit_scale"]) + self.settings["coordinate_offset"] diff --git a/src/ifcopenshell-python/ifcopenshell/api/geometry/add_wall_representation.py b/src/ifcopenshell-python/ifcopenshell/api/geometry/add_wall_representation.py index f38c3cc294..7454d0037b 100644 --- a/src/ifcopenshell-python/ifcopenshell/api/geometry/add_wall_representation.py +++ b/src/ifcopenshell-python/ifcopenshell/api/geometry/add_wall_representation.py @@ -44,11 +44,13 @@ class Usecase: ) def create_item(self): + 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, self.settings["thickness"], 0.0), - (self.settings["length"], self.settings["thickness"], 0.0), - (self.settings["length"], 0.0, 0.0), + (0.0, thickness, 0.0), + (length, thickness, 0.0), + (length, 0.0, 0.0), (0.0, 0.0, 0.0), ) if self.file.schema == "IFC2X3": @@ -58,7 +60,7 @@ class Usecase: extrusion = self.file.createIfcExtrudedAreaSolid( self.file.createIfcArbitraryClosedProfileDef("AREA", None, curve), self.file.createIfcAxis2Placement3D( - self.file.createIfcCartesianPoint((0.0, self.settings["offset"], 0.0)), + self.file.createIfcCartesianPoint((0.0, self.convert_si_to_unit(self.settings["offset"]), 0.0)), self.file.createIfcDirection((0.0, 0.0, 1.0)), self.file.createIfcDirection((1.0, 0.0, 0.0)), ),