diff --git a/src/bonsai/bonsai/bim/module/geometry/data.py b/src/bonsai/bonsai/bim/module/geometry/data.py index 9c101c4c65..a719d27893 100644 --- a/src/bonsai/bonsai/bim/module/geometry/data.py +++ b/src/bonsai/bonsai/bim/module/geometry/data.py @@ -64,14 +64,8 @@ class ViewportData: if obj in bpy.context.scene.BIMProjectProperties.clipping_planes_objs: pass elif element: - if (usage := tool.Model.get_usage_type(element)) and usage in ("LAYER1", "LAYER2"): + if tool.Geometry.is_locked(element): pass - elif tool.Geometry.is_locked(element): - pass - elif usage == "PROFILE": - modes.append(edit_mode) - elif usage == "LAYER3": - modes.append(edit_mode) elif obj.data and tool.Geometry.is_profile_based(obj.data): modes.append(edit_mode) elif element.is_a("IfcRelSpaceBoundary"): diff --git a/src/bonsai/bonsai/bim/module/geometry/operator.py b/src/bonsai/bonsai/bim/module/geometry/operator.py index c2a65e68d5..cb50494ee0 100644 --- a/src/bonsai/bonsai/bim/module/geometry/operator.py +++ b/src/bonsai/bonsai/bim/module/geometry/operator.py @@ -1931,14 +1931,8 @@ class OverrideModeSetEdit(bpy.types.Operator, tool.Ifc.Operator): elif element: if not obj.data: self.report({"INFO"}, "No geometry to edit") - elif (usage := tool.Model.get_usage_type(element)) and usage in ("LAYER1", "LAYER2"): - self.report({"INFO"}, f"Parametric {usage} elements cannot be edited directly") elif tool.Geometry.is_locked(element): self.report({"ERROR"}, lock_error_message(obj.name)) - elif usage == "PROFILE": - bpy.ops.bim.hotkey(hotkey="A_E") - elif usage == "LAYER3": - bpy.ops.bim.hotkey(hotkey="S_E") elif obj.data and tool.Geometry.is_profile_based(obj.data): bpy.ops.bim.hotkey(hotkey="S_E") elif element.is_a("IfcRelSpaceBoundary"): @@ -1981,11 +1975,18 @@ class OverrideModeSetEdit(bpy.types.Operator, tool.Ifc.Operator): def enable_editing_representation_item(self, context: bpy.types.Context, obj: bpy.types.Object) -> None: item = tool.Ifc.get().by_id(obj.data.BIMMeshProperties.ifc_definition_id) + element = tool.Ifc.get_entity(context.scene.BIMGeometryProperties.representation_obj) if tool.Geometry.is_meshlike_item(item): tool.Geometry.dissolve_triangulated_edges(obj) tool.Blender.select_and_activate_single_object(context, obj) obj.data.BIMMeshProperties.mesh_checksum = tool.Geometry.get_mesh_checksum(obj.data) self.enable_edit_mode(context) + elif ( + item.is_a("IfcSweptAreaSolid") + and (usage := tool.Model.get_usage_type(element)) + and usage in ("LAYER1", "LAYER2") + ): + self.report({"INFO"}, f"Parametric {usage} elements cannot be edited directly") elif item.is_a("IfcSweptAreaSolid"): tool.Geometry.sync_item_positions() res = tool.Model.import_profile((profile := item.SweptArea), obj=obj) diff --git a/src/bonsai/bonsai/bim/module/model/data.py b/src/bonsai/bonsai/bim/module/model/data.py index 707d8cbed5..850ef2d31e 100644 --- a/src/bonsai/bonsai/bim/module/model/data.py +++ b/src/bonsai/bonsai/bim/module/model/data.py @@ -630,6 +630,7 @@ class ItemData: cls.data = {} cls.data["representation_identifier"] = cls.representation_identifier() cls.data["representation_type"] = cls.representation_type() + cls.data["representation_usage"] = cls.representation_usage() cls.data["profiles_enum"] = cls.profiles_enum() @classmethod @@ -644,6 +645,11 @@ class ItemData: rep = tool.Geometry.get_active_representation(props.representation_obj) return rep.RepresentationType + @classmethod + def representation_usage(cls): + props = bpy.context.scene.BIMGeometryProperties + return tool.Model.get_usage_type(tool.Ifc.get_entity(props.representation_obj)) + @classmethod def profiles_enum(cls) -> list[Union[tuple[str, str, str], None]]: ifc_file = tool.Ifc.get() diff --git a/src/bonsai/bonsai/bim/module/model/workspace.py b/src/bonsai/bonsai/bim/module/model/workspace.py index dfa0ab48b2..b7266193d2 100644 --- a/src/bonsai/bonsai/bim/module/model/workspace.py +++ b/src/bonsai/bonsai/bim/module/model/workspace.py @@ -309,7 +309,9 @@ class BIM_MT_add_representation_item(Menu): if not ItemData.is_loaded: ItemData.load() - if ItemData.data["representation_type"] in ("Tessellation", "Brep", "AdvancedBrep"): + if ItemData.data["representation_usage"]: + self.layout.operator("bim.add_half_space_solid_item", icon="ORIENTATION_NORMAL", text="Half Space Solid") + elif ItemData.data["representation_type"] in ("Tessellation", "Brep", "AdvancedBrep"): self.draw_meshlike() self.layout.separator() self.layout.operator("bim.add_half_space_solid_item", icon="ORIENTATION_NORMAL", text="Half Space Solid")