From 190d9f8e3f1a3ac6942586f32e7456f81c250516 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bruno=20Perdig=C3=A3o?= Date: Tue, 19 Aug 2025 23:00:24 -0300 Subject: [PATCH 1/4] Fix issue with IfcPolyline in `get_polyline_coords` --- src/ifcopenshell-python/ifcopenshell/util/shape_builder.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ifcopenshell-python/ifcopenshell/util/shape_builder.py b/src/ifcopenshell-python/ifcopenshell/util/shape_builder.py index 31750774cc..26f5146319 100644 --- a/src/ifcopenshell-python/ifcopenshell/util/shape_builder.py +++ b/src/ifcopenshell-python/ifcopenshell/util/shape_builder.py @@ -1146,7 +1146,7 @@ class ShapeBuilder: if polyline.is_a("IfcIndexedPolyCurve"): coords = np.array(polyline.Points.CoordList) elif polyline.is_a("IfcPolyline"): - coords = np.array(p.Coordinates for p in polyline.Points) + coords = np.array(tuple(p.Coordinates for p in polyline.Points)) else: raise Exception(f"Unsupported polyline type: {polyline.is_a()}") return coords From 915c38947d0adc6f181f01df16b7c9d26273e7a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bruno=20Perdig=C3=A3o?= Date: Tue, 19 Aug 2025 23:03:40 -0300 Subject: [PATCH 2/4] See #6963. Fix issue with changing extrusion angle in IFC2X3 files. --- src/bonsai/bonsai/bim/module/model/wall.py | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/src/bonsai/bonsai/bim/module/model/wall.py b/src/bonsai/bonsai/bim/module/model/wall.py index a55982c4c0..d850670439 100644 --- a/src/bonsai/bonsai/bim/module/model/wall.py +++ b/src/bonsai/bonsai/bim/module/model/wall.py @@ -441,6 +441,7 @@ class ChangeExtrusionXAngle(bpy.types.Operator, tool.Ifc.Operator): x_angle = 0 if tool.Cad.is_x(self.x_angle, pi, tolerance=0.001) else self.x_angle unit_scale = ifcopenshell.util.unit.calculate_unit_scale(tool.Ifc.get()) selected_objs = tool.Model.get_selected_mesh_ifc_objects() + shape_builder = ifcopenshell.util.shape_builder.ShapeBuilder(tool.Ifc.get()) for obj in selected_objs: element = tool.Ifc.get_entity(obj) @@ -466,16 +467,11 @@ class ChangeExtrusionXAngle(bpy.types.Operator, tool.Ifc.Operator): existing_x_angle = obj.rotation_euler.x existing_x_angle = 0 if tool.Cad.is_x(existing_x_angle, 0, tolerance=0.001) else existing_x_angle existing_x_angle = 0 if tool.Cad.is_x(existing_x_angle, pi, tolerance=0.001) else existing_x_angle - # Reset the transformation and returns to the original points with 0 degrees - extrusion.SweptArea.OuterCurve.Points.CoordList = [ - (p[0], p[1] * abs(cos(existing_x_angle))) - for p in extrusion.SweptArea.OuterCurve.Points.CoordList - ] - # Apply the transformation for the new x_angle - extrusion.SweptArea.OuterCurve.Points.CoordList = [ - (p[0], p[1] * abs(1 / cos(x_angle))) for p in extrusion.SweptArea.OuterCurve.Points.CoordList - ] + coord_list = shape_builder.get_polyline_coords(extrusion.SweptArea.OuterCurve) + coord_list = [(p[0], p[1] * abs(cos(existing_x_angle))) for p in coord_list] # Reset the transformation and returns to the original points with 0 degrees + coord_list = [(p[0], p[1] * abs(1 / cos(x_angle))) for p in coord_list] # Apply the transformation for the new x_angle + shape_builder.set_polyline_coords(extrusion.SweptArea.OuterCurve, coord_list) # The extrusion direction calculated previously default to the positive direction # Here we set the extrusion direction to negative if that's the case From cb551e1248d4ce6597b6157a7c1ed465207e4daa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bruno=20Perdig=C3=A3o?= Date: Tue, 19 Aug 2025 23:08:43 -0300 Subject: [PATCH 3/4] Fix issue with creating walls from slabs in IFC2X3 files. Related to #6963 --- src/bonsai/bonsai/bim/module/model/wall.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/bonsai/bonsai/bim/module/model/wall.py b/src/bonsai/bonsai/bim/module/model/wall.py index d850670439..3394aa2b05 100644 --- a/src/bonsai/bonsai/bim/module/model/wall.py +++ b/src/bonsai/bonsai/bim/module/model/wall.py @@ -891,7 +891,8 @@ class DumbWallGenerator: elevation = self.container_obj.location.z representation = ifcopenshell.util.representation.get_representation(slab, "Model", "Body", "MODEL_VIEW") extrusion = tool.Model.get_extrusion(representation) - polyline_points = extrusion.SweptArea.OuterCurve.Points.CoordList + builder = ifcopenshell.util.shape_builder.ShapeBuilder(tool.Ifc.get()) + polyline_points = builder.get_polyline_coords(extrusion.SweptArea.OuterCurve) polyline_points = [[(v * self.unit_scale) for v in p] for p in polyline_points] polyline_points = [slab_obj.matrix_world @ Vector((p[0], p[1], elevation)) for p in polyline_points] if not tool.Cad.is_counter_clockwise_order(polyline_points[0], polyline_points[1], polyline_points[2]): From 8903d6a85c2ea045ee02c7ee3579e4909a8c54ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bruno=20Perdig=C3=A3o?= Date: Mon, 25 Aug 2025 20:42:02 -0300 Subject: [PATCH 4/4] Change variable name for consistency. Related to #6963 --- src/bonsai/bonsai/bim/module/model/wall.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/bonsai/bonsai/bim/module/model/wall.py b/src/bonsai/bonsai/bim/module/model/wall.py index 3394aa2b05..067e37c0ae 100644 --- a/src/bonsai/bonsai/bim/module/model/wall.py +++ b/src/bonsai/bonsai/bim/module/model/wall.py @@ -441,7 +441,7 @@ class ChangeExtrusionXAngle(bpy.types.Operator, tool.Ifc.Operator): x_angle = 0 if tool.Cad.is_x(self.x_angle, pi, tolerance=0.001) else self.x_angle unit_scale = ifcopenshell.util.unit.calculate_unit_scale(tool.Ifc.get()) selected_objs = tool.Model.get_selected_mesh_ifc_objects() - shape_builder = ifcopenshell.util.shape_builder.ShapeBuilder(tool.Ifc.get()) + builder = ifcopenshell.util.shape_builder.ShapeBuilder(tool.Ifc.get()) for obj in selected_objs: element = tool.Ifc.get_entity(obj) @@ -468,10 +468,10 @@ class ChangeExtrusionXAngle(bpy.types.Operator, tool.Ifc.Operator): existing_x_angle = 0 if tool.Cad.is_x(existing_x_angle, 0, tolerance=0.001) else existing_x_angle existing_x_angle = 0 if tool.Cad.is_x(existing_x_angle, pi, tolerance=0.001) else existing_x_angle - coord_list = shape_builder.get_polyline_coords(extrusion.SweptArea.OuterCurve) + coord_list = builder.get_polyline_coords(extrusion.SweptArea.OuterCurve) coord_list = [(p[0], p[1] * abs(cos(existing_x_angle))) for p in coord_list] # Reset the transformation and returns to the original points with 0 degrees coord_list = [(p[0], p[1] * abs(1 / cos(x_angle))) for p in coord_list] # Apply the transformation for the new x_angle - shape_builder.set_polyline_coords(extrusion.SweptArea.OuterCurve, coord_list) + builder.set_polyline_coords(extrusion.SweptArea.OuterCurve, coord_list) # The extrusion direction calculated previously default to the positive direction # Here we set the extrusion direction to negative if that's the case