diff --git a/src/bonsai/bonsai/bim/import_ifc.py b/src/bonsai/bonsai/bim/import_ifc.py index bb57ec47a5..4a0dcc4dfc 100644 --- a/src/bonsai/bonsai/bim/import_ifc.py +++ b/src/bonsai/bonsai/bim/import_ifc.py @@ -811,6 +811,8 @@ class IfcImporter: obj = bpy.data.objects.new(tool.Loader.get_name(element), mesh) self.link_element(element, obj) + if getattr(element, "HasOpenings", None): + tool.Geometry.lock_scale(obj) if shape: # We use numpy here because Blender mathutils.Matrix is not accurate enough diff --git a/src/bonsai/bonsai/bim/module/void/operator.py b/src/bonsai/bonsai/bim/module/void/operator.py index b9b3534104..498448562a 100644 --- a/src/bonsai/bonsai/bim/module/void/operator.py +++ b/src/bonsai/bonsai/bim/module/void/operator.py @@ -130,6 +130,7 @@ class AddOpening(bpy.types.Operator, tool.Ifc.Operator): # therefore bim.update_representaiton wouldn't work either way. should_sync_changes_first=False, ) + tool.Geometry.lock_scale(voided_obj) if not has_visible_openings: tool.Ifc.unlink(element=element2) @@ -173,6 +174,8 @@ class RemoveOpening(bpy.types.Operator, tool.Ifc.Operator): is_global=True, should_sync_changes_first=False, ) + if building_obj and not getattr(element, "HasOpenings", None): + tool.Geometry.unlock_scale(building_obj) tool.Geometry.clear_cache(element) return {"FINISHED"} diff --git a/src/bonsai/bonsai/tool/geometry.py b/src/bonsai/bonsai/tool/geometry.py index 0e40bf3238..aee9f154fd 100644 --- a/src/bonsai/bonsai/tool/geometry.py +++ b/src/bonsai/bonsai/tool/geometry.py @@ -136,6 +136,14 @@ class Geometry(bonsai.core.tool.Geometry): obj.lock_rotations_4d = False obj.lock_scale = (False, False, False) + @classmethod + def lock_scale(cls, obj: bpy.types.Object) -> None: + obj.lock_scale = (True, True, True) + + @classmethod + def unlock_scale(cls, obj: bpy.types.Object) -> None: + obj.lock_scale = (False, False, False) + @classmethod def delete_ifc_item(cls, obj: bpy.types.Object) -> None: props = bpy.context.scene.BIMGeometryProperties