@@ -60,20 +60,32 @@ def _execute(self, context):
6060 for obj in selected_objs :
6161 joiner .unjoin (obj )
6262 return {"FINISHED" }
63- if not context .active_object :
64- return {"FINISHED" }
63+
64+ if not context .active_object or not context .active_object .BIMObjectProperties .ifc_definition_id :
65+ self .report ({"ERROR" }, f"No active object selected" )
66+ return {"CANCELLED" }
67+
6568 for obj in selected_objs :
6669 tool .Geometry .clear_scale (obj )
70+
71+ if not selected_objs :
72+ self .report ({"ERROR" }, f"No IFC objects selected" )
73+ return {"CANCELLED" }
74+
6775 if len (selected_objs ) == 1 :
6876 joiner .join_E (context .active_object , context .scene .cursor .location )
6977 return {"FINISHED" }
70- if len (selected_objs ) == 2 :
71- if self .join_type == "L" :
72- joiner .join_L ([o for o in selected_objs if o != context .active_object ][0 ], context .active_object )
73- elif self .join_type == "V" :
74- joiner .join_V ([o for o in selected_objs if o != context .active_object ][0 ], context .active_object )
75- if len (selected_objs ) < 2 :
76- return {"FINISHED" }
78+
79+ if self .join_type in ("L" , "V" ):
80+ if len (selected_objs ) == 2 :
81+ another_selected_object = next (o for o in selected_objs if o != context .active_object )
82+ if self .join_type == "L" :
83+ joiner .join_L (another_selected_object , context .active_object )
84+ elif self .join_type == "V" :
85+ joiner .join_V (another_selected_object , context .active_object )
86+ self .report ({"ERROR" }, f"It requires 2 selected objects to do join of type { self .join_type } " )
87+ return {"CANCELLED" }
88+
7789 if self .join_type == "T" :
7890 elements = [tool .Ifc .get_entity (o ) for o in context .selected_objects ]
7991 layer2_elements = []
0 commit comments