From 889a9e38917ea37488d50a92560ccfe886f85b1a Mon Sep 17 00:00:00 2001 From: Dion Moult Date: Sat, 8 Feb 2025 00:20:25 +1100 Subject: [PATCH] Tweak failing test to now allow assigning elements to scaled multi-user objects Previously this was not allowed, but I don't see why not --- src/bonsai/bonsai/bim/module/root/operator.py | 7 ++++++- src/bonsai/test/bim/feature/geometry.feature | 4 ++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/bonsai/bonsai/bim/module/root/operator.py b/src/bonsai/bonsai/bim/module/root/operator.py index 959082a72c..9727556115 100644 --- a/src/bonsai/bonsai/bim/module/root/operator.py +++ b/src/bonsai/bonsai/bim/module/root/operator.py @@ -212,7 +212,12 @@ class AssignClass(bpy.types.Operator, tool.Ifc.Operator): continue if self.should_add_representation and isinstance(obj.data, bpy.types.Mesh) and obj.data.polygons: - bpy.ops.object.transform_apply(location=False, rotation=False, scale=True, properties=False) + if obj.scale != (1, 1, 1): + if obj.data.users > 1: + bpy.ops.object.make_single_user( + object=True, obdata=True, material=False, animation=False, obdata_animation=False + ) + bpy.ops.object.transform_apply(location=False, rotation=False, scale=True, properties=False) if tool.Geometry.mesh_has_loose_geometry(obj.data): self.report( {"WARNING"}, diff --git a/src/bonsai/test/bim/feature/geometry.feature b/src/bonsai/test/bim/feature/geometry.feature index 6e12aa0d84..07264c6b7d 100644 --- a/src/bonsai/test/bim/feature/geometry.feature +++ b/src/bonsai/test/bim/feature/geometry.feature @@ -55,7 +55,7 @@ Scenario: Add representation - add a representation with a scale factor applied Then the object "IfcWall/Cube" has no scale And the object "IfcWall/Cube" dimensions are "4,4,4" -Scenario: Add representation - add a representation with a scale factor removed due to multiple users +Scenario: Add representation - add a representation with a scale factor still applied regardless of multiple users Given an empty IFC project And I add a cube And I press "object.duplicate_move_linked" @@ -65,7 +65,7 @@ Scenario: Add representation - add a representation with a scale factor removed And I set "scene.BIMRootProperties.ifc_class" to "IfcWall" And I press "bim.assign_class" Then the object "IfcWall/Cube" has no scale - And the object "IfcWall/Cube" dimensions are "2,2,2" + And the object "IfcWall/Cube" dimensions are "4,4,4" Scenario: Switch representation Given an empty IFC project