From 9f1ffe63811a2ca85bcf2b2fe8791893789f1145 Mon Sep 17 00:00:00 2001 From: Dion Moult Date: Mon, 10 Mar 2025 18:08:43 +1100 Subject: [PATCH] Minor fix where you shouldn't be able to add an element without an IFC project --- src/bonsai/bonsai/bim/module/root/operator.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/bonsai/bonsai/bim/module/root/operator.py b/src/bonsai/bonsai/bim/module/root/operator.py index 0e583e76cd..d141e7075e 100644 --- a/src/bonsai/bonsai/bim/module/root/operator.py +++ b/src/bonsai/bonsai/bim/module/root/operator.py @@ -626,10 +626,14 @@ class AddElement(bpy.types.Operator, tool.Ifc.Operator): class LaunchAddElement(bpy.types.Operator, tool.Ifc.Operator): bl_idname = "bim.launch_add_element" - bl_label = "Add Element" + bl_label = "Launch Add Element" bl_options = {"REGISTER", "UNDO"} bl_description = "Add an IFC physical product, construction type, and more" + @classmethod + def poll(cls, context): + return tool.Ifc.get() + def execute(self, context): # This stub operator is needed because operators from menu skip the invoke call bpy.ops.bim.add_element("INVOKE_DEFAULT")