skip objects without placements importing containers

It seems that IFC doesn't specify that IfcRelAggregates.RelatedObjects should necessary have a placement. E.g. FreeCAD is using IfcGroups in RelatedObjects to store hierarchy in IFC.

Example - https://community.osarch.org/discussion/2144/object-information-spatial-container
This commit is contained in:
Andrej730
2024-05-08 12:55:59 +05:00
parent 67f4ed00d0
commit 875afd69d5
@@ -111,6 +111,9 @@ class Spatial(blenderbim.core.tool.Spatial):
for rel in parent.IsDecomposedBy or []:
related_objects = []
for element in rel.RelatedObjects:
# skip objects without placements
if not element.is_a("IfcProduct"):
continue
related_objects.append((element, ifcopenshell.util.placement.get_storey_elevation(element)))
related_objects = sorted(related_objects, key=lambda e: e[1])
for element, _ in related_objects: