mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-13 02:47:48 +00:00
Fix error when trying to select type if type is not set
This commit is contained in:
@@ -136,13 +136,13 @@ class SelectType(bpy.types.Operator):
|
||||
|
||||
def execute(self, context):
|
||||
self.file = IfcStore.get_file()
|
||||
related_object = bpy.data.objects.get(self.related_object) if self.related_object else context.active_object
|
||||
related_object = bpy.data.objects.get(self.related_object, context.active_object)
|
||||
oprops = related_object.BIMObjectProperties
|
||||
obj = IfcStore.get_element(
|
||||
ifcopenshell.util.element.get_type(self.file.by_id(oprops.ifc_definition_id)).GlobalId
|
||||
)
|
||||
context.view_layer.objects.active = obj
|
||||
obj.select_set(True)
|
||||
element_type = ifcopenshell.util.element.get_type(self.file.by_id(oprops.ifc_definition_id))
|
||||
if element_type is not None:
|
||||
obj = IfcStore.get_element(element_type.GlobalId)
|
||||
context.view_layer.objects.active = obj
|
||||
obj.select_set(True)
|
||||
return {"FINISHED"}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user