From 86cc2bf39abd0417bb33a6e4942a007616cb1247 Mon Sep 17 00:00:00 2001 From: Andrej730 Date: Thu, 2 May 2024 16:48:52 +0500 Subject: [PATCH] fix bug using "trace outlines" for reprsentation in ifc2x3 Mentioned in #4593 The error message was (it was trying to access curves from the original mesh instead of dummy curve object): ``` Error: Python: Traceback (most recent call last): File "\blenderbim\bim\module\geometry\operator.py", line 46, in execute IfcStore.execute_ifc_operator(self, context) File "\blenderbim\bim\ifc.py", line 349, in execute_ifc_operator result = getattr(operator, "_execute")(context) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "\blenderbim\bim\module\geometry\operator.py", line 169, in _execute core.add_representation( File "\blenderbim\core\geometry.py", line 52, in add_representation representation = ifc.run( ^^^^^^^^ File "\blenderbim\tool\ifc.py", line 34, in run return ifcopenshell.api.run(command, IfcStore.get_file(), **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "\blenderbim\libs\site\packages\ifcopenshell\api\__init__.py", line 172, in run result = usecase_class(ifc_file, **settings).execute() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "\blenderbim\libs\site\packages\ifcopenshell\api\geometry\add_representation.py", line 73, in execute return self.create_plan_representation() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "\blenderbim\libs\site\packages\ifcopenshell\api\geometry\add_representation.py", line 170, in create_plan_representation return self.create_annotation2d_representation() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "\blenderbim\libs\site\packages\ifcopenshell\api\geometry\add_representation.py", line 833, in create_annotation2d_representation items = [self.file.createIfcGeometricCurveSet(self.create_curves(is_2d=True))] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "\blenderbim\libs\site\packages\ifcopenshell\api\geometry\add_representation.py", line 492, in create_curves curves = self.create_curves_from_curve_ifc2x3(is_2d=is_2d, curve_object_data=dummy.data) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "\blenderbim\libs\site\packages\ifcopenshell\api\geometry\add_representation.py", line 575, in create_curves_from_curve_ifc2x3 for spline in self.settings["geometry"].splines: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ AttributeError: 'Mesh' object has no attribute 'splines' ``` --- .../ifcopenshell/api/geometry/add_representation.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ifcopenshell-python/ifcopenshell/api/geometry/add_representation.py b/src/ifcopenshell-python/ifcopenshell/api/geometry/add_representation.py index 2bd501cb49..155bfb2bea 100644 --- a/src/ifcopenshell-python/ifcopenshell/api/geometry/add_representation.py +++ b/src/ifcopenshell-python/ifcopenshell/api/geometry/add_representation.py @@ -572,7 +572,7 @@ class Usecase: curve_object_data = self.settings["geometry"] dim = (lambda v: v.xy) if is_2d else (lambda v: v.xyz) results = [] - for spline in self.settings["geometry"].splines: + for spline in curve_object_data.splines: points = spline.bezier_points[:] + spline.points[:] if spline.use_cyclic_u: points.append(points[0])