Fix #1647. Bug where auto spatial containment assignment failed when you were not in a container.

This commit is contained in:
Dion Moult
2021-08-14 14:40:45 +10:00
parent 3e2b66ef2f
commit 58921e200c
@@ -189,6 +189,11 @@ class AssignClass(bpy.types.Operator):
continue
spatial_obj = bpy.data.objects.get(collection.name)
if spatial_obj and spatial_obj.BIMObjectProperties.ifc_definition_id:
element = self.file.by_id(spatial_obj.BIMObjectProperties.ifc_definition_id)
if self.file.schema != "IFC2X3" and not element.is_a("IfcSpatialElement"):
continue
elif self.file.schema == "IFC2X3" and not element.is_a("IfcSpatialStructureElement"):
continue
bpy.ops.bim.assign_container(
relating_structure=spatial_obj.BIMObjectProperties.ifc_definition_id, related_element=obj.name
)