mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-21 13:43:40 +00:00
Preselect IFC class when adding elements for convenience.
This commit is contained in:
@@ -112,7 +112,9 @@ class LaunchTypeManager(bpy.types.Operator):
|
|||||||
row.menu("BIM_MT_type_manager_menu", text="", icon="PREFERENCES")
|
row.menu("BIM_MT_type_manager_menu", text="", icon="PREFERENCES")
|
||||||
|
|
||||||
row = self.layout.row(align=True)
|
row = self.layout.row(align=True)
|
||||||
row.operator("bim.launch_add_element", text=f"Create New {AuthoringData.data['ifc_element_type'] or 'Type'}", icon="ADD")
|
row.operator(
|
||||||
|
"bim.add_element", text=f"Create New {AuthoringData.data['ifc_element_type'] or 'Type'}", icon="ADD"
|
||||||
|
).ifc_class = (AuthoringData.data["ifc_element_type"] or "")
|
||||||
|
|
||||||
if AuthoringData.data["total_types"]:
|
if AuthoringData.data["total_types"]:
|
||||||
row = self.layout.row(align=True)
|
row = self.layout.row(align=True)
|
||||||
|
|||||||
@@ -341,16 +341,20 @@ class AddElement(bpy.types.Operator, tool.Ifc.Operator):
|
|||||||
bl_label = "Add Element"
|
bl_label = "Add Element"
|
||||||
bl_options = {"REGISTER", "UNDO"}
|
bl_options = {"REGISTER", "UNDO"}
|
||||||
bl_description = "Add an IFC physical product, construction type, and more"
|
bl_description = "Add an IFC physical product, construction type, and more"
|
||||||
|
ifc_class: bpy.props.StringProperty(options={"SKIP_SAVE"})
|
||||||
|
|
||||||
def invoke(self, context, event):
|
def invoke(self, context, event):
|
||||||
return IfcStore.execute_ifc_operator(self, context, is_invoke=True)
|
return IfcStore.execute_ifc_operator(self, context, is_invoke=True)
|
||||||
|
|
||||||
def _invoke(self, context, event):
|
def _invoke(self, context, event):
|
||||||
|
props = context.scene.BIMRootProperties
|
||||||
# For convenience, preselect OBJ representation template if applicable
|
# For convenience, preselect OBJ representation template if applicable
|
||||||
if (obj := context.active_object) and obj.type == "MESH":
|
if (obj := context.active_object) and obj.type == "MESH":
|
||||||
props = context.scene.BIMRootProperties
|
|
||||||
props.representation_template = "OBJ"
|
props.representation_template = "OBJ"
|
||||||
props.representation_obj = obj
|
props.representation_obj = obj
|
||||||
|
# For convenience, preselect IFC class
|
||||||
|
if self.ifc_class:
|
||||||
|
props.ifc_class = self.ifc_class
|
||||||
return context.window_manager.invoke_props_dialog(self)
|
return context.window_manager.invoke_props_dialog(self)
|
||||||
|
|
||||||
def _execute(self, context):
|
def _execute(self, context):
|
||||||
|
|||||||
Reference in New Issue
Block a user