Fix bug where spatial objects with representations didn't import correctly.

This commit is contained in:
Dion Moult
2021-02-04 14:50:46 +11:00
parent 96260cdb39
commit e14a3a99c0
@@ -1266,7 +1266,15 @@ class IfcImporter:
if element.is_a("IfcProject"):
return
elif element.GlobalId in self.spatial_structure_elements:
return
if not obj.data:
return
# Since spatial structure elements are generated as empties, we'll replace it with the representation
spatial_obj = self.spatial_structure_elements[element.GlobalId]["blender_obj"]
spatial_collection = self.spatial_structure_elements[element.GlobalId]["blender"]
spatial_name = spatial_obj.name
spatial_collection.objects.link(obj)
bpy.data.objects.remove(spatial_obj)
obj.name = spatial_name
elif (
hasattr(element, "ContainedInStructure")
and element.ContainedInStructure