From e14a3a99c089e36ff7680d013d121ea61647769e Mon Sep 17 00:00:00 2001 From: Dion Moult Date: Thu, 4 Feb 2021 14:50:46 +1100 Subject: [PATCH] Fix bug where spatial objects with representations didn't import correctly. --- src/ifcblenderexport/blenderbim/bim/import_ifc.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/ifcblenderexport/blenderbim/bim/import_ifc.py b/src/ifcblenderexport/blenderbim/bim/import_ifc.py index 73a7136e0e..4a19ac92bb 100644 --- a/src/ifcblenderexport/blenderbim/bim/import_ifc.py +++ b/src/ifcblenderexport/blenderbim/bim/import_ifc.py @@ -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