Catch Assign_Brick_Reference with no selections

This commit is contained in:
rileywong311
2023-08-20 12:56:55 -07:00
parent 328c38b640
commit a5eb5c869d
@@ -118,7 +118,15 @@ class AssignBrickReference(bpy.types.Operator, Operator):
bl_description = "Assign the selected Ifc entity to the selected Brick entity"
def _execute(self, context):
if not context.active_object:
self.report({'ERROR'}, f'No Ifc selected')
return
props = context.scene.BIMBrickProperties
try:
props.bricks[props.active_brick_index]
except:
self.report({'ERROR'}, f'No Brick selected')
return
core.assign_brick_reference(
tool.Ifc,
tool.Brick,