diff --git a/src/bonsai/bonsai/bim/import_ifc.py b/src/bonsai/bonsai/bim/import_ifc.py index 5c36163207..903f0ca6a3 100644 --- a/src/bonsai/bonsai/bim/import_ifc.py +++ b/src/bonsai/bonsai/bim/import_ifc.py @@ -1092,7 +1092,10 @@ class IfcImporter: verts=verts, load_indexed_maps=self.ifc_import_settings.load_indexed_maps, ) - return tool.Loader.slice_layerset_mesh(element, mesh) + # E.g. `create_mesh` is also used for IfcRelSpaceBoundary. + if element.is_a("IfcObjectDefinition"): + return tool.Loader.slice_layerset_mesh(element, mesh) + return mesh except: self.ifc_import_settings.logger.error("Could not create mesh for %s", element) import traceback diff --git a/src/bonsai/bonsai/bim/module/boundary/operator.py b/src/bonsai/bonsai/bim/module/boundary/operator.py index 820112bf9c..14d9987d8a 100644 --- a/src/bonsai/bonsai/bim/module/boundary/operator.py +++ b/src/bonsai/bonsai/bim/module/boundary/operator.py @@ -72,13 +72,16 @@ class Loader: # ConnectionGeometry is optional in IFC schema for some reasons. if not boundary.ConnectionGeometry: return None + assert self.ifc_importer + assert self.operator surface = boundary.ConnectionGeometry.SurfaceOnRelatingElement # Workaround for invalid geometry provided by Revit. See https://github.com/Autodesk/revit-ifc/issues/270 if surface.is_a("IfcCurveBoundedPlane") and not getattr(surface, "InnerBoundaries", None): surface.InnerBoundaries = () try: shape = ifcopenshell.geom.create_shape(self.settings, surface) - mesh = self.ifc_importer.create_mesh(None, shape) + mesh = self.ifc_importer.create_mesh(boundary, shape) + assert mesh tool.Loader.link_mesh(shape, mesh) except RuntimeError: # Fallback solution for invalid geometry provided by Revit. (InnerBoundaries cuting OuterBoundary)