Conveniently preselect object representation template if an object is selected

This commit is contained in:
Dion Moult
2024-10-08 12:16:32 +11:00
parent af3fb78e1b
commit f66d1bed73
2 changed files with 6 additions and 1 deletions
@@ -181,7 +181,7 @@ class AddOccurrence(bpy.types.Operator, PolylineOperator):
context.workspace.status_text_set(text=None)
PolylineDecorator.uninstall()
context.scene.BIMPolylineProperties.product_preview.clear()
tool.Snap.clear_polyline()
tool.Polyline.clear_polyline()
tool.Blender.update_viewport()
return {"FINISHED"}
@@ -336,6 +336,11 @@ class AddElement(bpy.types.Operator, tool.Ifc.Operator):
return IfcStore.execute_ifc_operator(self, context, is_invoke=True)
def _invoke(self, context, event):
# For convenience, preselect OBJ representation template if applicable
if (obj := context.active_object) and obj.type == "MESH":
props = context.scene.BIMRootProperties
props.representation_template = "OBJ"
props.representation_obj = obj
return context.window_manager.invoke_props_dialog(self)
def _execute(self, context):