mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-20 15:08:51 +00:00
Make adding openings more discoverable
1) It's back as Shift-O hotkey in BIM tool - https://i.imgur.com/XfmfqNY.png 2) It's always visible in Voids UI - https://i.imgur.com/rO6nOSw.png
This commit is contained in:
@@ -960,6 +960,13 @@ class EditObjectUI:
|
|||||||
op_text = "Add Void" if ui_context != "TOOL_HEADER" else ""
|
op_text = "Add Void" if ui_context != "TOOL_HEADER" else ""
|
||||||
op_icon = custom_icon_previews["ADD_VOID"].icon_id
|
op_icon = custom_icon_previews["ADD_VOID"].icon_id
|
||||||
row = cls.layout.row(align=True) if ui_context != "TOOL_HEADER" else row
|
row = cls.layout.row(align=True) if ui_context != "TOOL_HEADER" else row
|
||||||
|
op = row.operator("bim.add_element", text=op_text, icon_value=op_icon)
|
||||||
|
op.ifc_product = "IfcFeatureElement"
|
||||||
|
op.ifc_class = "IfcOpeningElement"
|
||||||
|
op.skip_dialog = True
|
||||||
|
if ui_context != "TOOL_HEADER":
|
||||||
|
row.label(text="", icon="EVENT_SHIFT")
|
||||||
|
row.label(text="", icon="EVENT_O")
|
||||||
|
|
||||||
if AuthoringData.data["is_voidable_element"]:
|
if AuthoringData.data["is_voidable_element"]:
|
||||||
if AuthoringData.data["has_visible_openings"]:
|
if AuthoringData.data["has_visible_openings"]:
|
||||||
@@ -1342,8 +1349,12 @@ class Hotkey(bpy.types.Operator, tool.Ifc.Operator):
|
|||||||
bpy.ops.bim.add_boundary()
|
bpy.ops.bim.add_boundary()
|
||||||
|
|
||||||
def hotkey_S_O(self):
|
def hotkey_S_O(self):
|
||||||
if len(bpy.context.selected_objects) == 2:
|
if len(bpy.context.selected_objects) > 1:
|
||||||
bpy.ops.bim.add_opening()
|
bpy.ops.bim.add_opening()
|
||||||
|
else:
|
||||||
|
bpy.ops.bim.add_element(
|
||||||
|
"INVOKE_DEFAULT", ifc_product="IfcFeatureElement", ifc_class="IfcOpeningElement", skip_dialog=True
|
||||||
|
)
|
||||||
|
|
||||||
def hotkey_S_L(self):
|
def hotkey_S_L(self):
|
||||||
if AuthoringData.data["active_class"] in ("IfcOpeningElement",):
|
if AuthoringData.data["active_class"] in ("IfcOpeningElement",):
|
||||||
|
|||||||
@@ -360,6 +360,7 @@ class AddElement(bpy.types.Operator, tool.Ifc.Operator):
|
|||||||
is_specific_tool: bpy.props.BoolProperty(default=False, options={"SKIP_SAVE"})
|
is_specific_tool: bpy.props.BoolProperty(default=False, options={"SKIP_SAVE"})
|
||||||
ifc_product: bpy.props.StringProperty(options={"SKIP_SAVE"})
|
ifc_product: bpy.props.StringProperty(options={"SKIP_SAVE"})
|
||||||
ifc_class: bpy.props.StringProperty(options={"SKIP_SAVE"})
|
ifc_class: bpy.props.StringProperty(options={"SKIP_SAVE"})
|
||||||
|
skip_dialog: bpy.props.BoolProperty(default=False, options={"SKIP_SAVE"})
|
||||||
|
|
||||||
def invoke(self, context, event):
|
def invoke(self, context, event):
|
||||||
return IfcStore.execute_ifc_operator(self, context, event, method="INVOKE")
|
return IfcStore.execute_ifc_operator(self, context, event, method="INVOKE")
|
||||||
@@ -380,6 +381,8 @@ class AddElement(bpy.types.Operator, tool.Ifc.Operator):
|
|||||||
props.ifc_product = self.ifc_product
|
props.ifc_product = self.ifc_product
|
||||||
if self.ifc_class:
|
if self.ifc_class:
|
||||||
props.ifc_class = self.ifc_class
|
props.ifc_class = self.ifc_class
|
||||||
|
if self.skip_dialog:
|
||||||
|
return self.execute(context)
|
||||||
return context.window_manager.invoke_props_dialog(self)
|
return context.window_manager.invoke_props_dialog(self)
|
||||||
|
|
||||||
def _execute(self, context):
|
def _execute(self, context):
|
||||||
|
|||||||
@@ -190,6 +190,7 @@ class BIMRootProperties(PropertyGroup):
|
|||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
contexts: str
|
contexts: str
|
||||||
|
name: str
|
||||||
description: str
|
description: str
|
||||||
ifc_product: str
|
ifc_product: str
|
||||||
ifc_class: str
|
ifc_class: str
|
||||||
|
|||||||
@@ -32,14 +32,16 @@ class AddOpening(bpy.types.Operator, tool.Ifc.Operator):
|
|||||||
bl_label = "Apply Opening"
|
bl_label = "Apply Opening"
|
||||||
bl_options = {"REGISTER", "UNDO"}
|
bl_options = {"REGISTER", "UNDO"}
|
||||||
bl_description = (
|
bl_description = (
|
||||||
"Apply an Opening object on an Element. "
|
"Apply opening objects to an Element.\n\n"
|
||||||
"The Element and the Opening to be applied should be selected. The order of selection is not important"
|
"The Element and the openings to be applied should be selected. The order of selection is not important.\n"
|
||||||
|
"Opening can be just a Blender mesh object."
|
||||||
)
|
)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def poll(cls, context):
|
def poll(cls, context):
|
||||||
if len(context.selected_objects) < 2:
|
if len(context.selected_objects) < 2:
|
||||||
cls.poll_message_set("Select openings and a target element")
|
cls.poll_message_set("Select openings and a target element")
|
||||||
|
return False
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def _execute(self, context):
|
def _execute(self, context):
|
||||||
|
|||||||
@@ -52,9 +52,8 @@ class BIM_PT_voids(Panel):
|
|||||||
if not VoidsData.is_loaded:
|
if not VoidsData.is_loaded:
|
||||||
VoidsData.load()
|
VoidsData.load()
|
||||||
|
|
||||||
if len(context.selected_objects) >= 2:
|
row = self.layout.row(align=True)
|
||||||
row = self.layout.row(align=True)
|
op = row.operator("bim.add_opening", icon="ADD", text="Add Opening")
|
||||||
op = row.operator("bim.add_opening", icon="ADD", text="Add Opening")
|
|
||||||
|
|
||||||
if VoidsData.data["active_opening"]:
|
if VoidsData.data["active_opening"]:
|
||||||
row = self.layout.row()
|
row = self.layout.row()
|
||||||
|
|||||||
Reference in New Issue
Block a user