Tabbing now works consistently on all elements including those with usage

This means that seeing the extrusion type graphically is now possible,
adding booleans is now through a consistent interface. It's still
possible to immediately edit the axis via Alt-E and profile via Shift-E.
This helps consoliate code too.
This commit is contained in:
Dion Moult
2025-01-29 21:38:01 +11:00
parent a9abf1e993
commit 5d3dc84556
4 changed files with 17 additions and 14 deletions
@@ -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"):
@@ -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)
@@ -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()
@@ -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")