diff --git a/src/blenderbim/blenderbim/bim/import_ifc.py b/src/blenderbim/blenderbim/bim/import_ifc.py index ac0af83ad5..c776a8483b 100644 --- a/src/blenderbim/blenderbim/bim/import_ifc.py +++ b/src/blenderbim/blenderbim/bim/import_ifc.py @@ -526,6 +526,8 @@ class IfcImporter: if representation_id is None: representation_id = rep.id() rep = rep.Items[0].MappingSource.MappedRepresentation + if not rep: # Accommodate invalid files + return False else: if representation_id is None: representation_id = rep.id() diff --git a/src/blenderbim/blenderbim/tool/spatial.py b/src/blenderbim/blenderbim/tool/spatial.py index 290bfee1a5..b047fa9f4e 100644 --- a/src/blenderbim/blenderbim/tool/spatial.py +++ b/src/blenderbim/blenderbim/tool/spatial.py @@ -255,6 +255,8 @@ class Spatial(blenderbim.core.tool.Spatial): @classmethod def import_spatial_element(cls, element, level_index): + if not element.is_a("IfcProject") and not tool.Root.is_spatial_element(element): + return props = bpy.context.scene.BIMSpatialDecompositionProperties new = props.containers.add() new.ifc_class = element.is_a()