From 888cbf7a639df837954aa4cbe0c91d64a311e812 Mon Sep 17 00:00:00 2001 From: Ryan Schultz Date: Tue, 10 Mar 2026 19:01:26 -0500 Subject: [PATCH] Fix NoneType error and missing argument in mirror_geometry operator - Guard against `RepresentationMaps` being `None` for type products without geometry - Fix `assign_type()` call missing `tool.Model` argument Generated with the assistance of an AI coding tool. --- src/bonsai/bonsai/bim/module/model/product.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/bonsai/bonsai/bim/module/model/product.py b/src/bonsai/bonsai/bim/module/model/product.py index e12ced9b5d..2b6e6bbb4a 100644 --- a/src/bonsai/bonsai/bim/module/model/product.py +++ b/src/bonsai/bonsai/bim/module/model/product.py @@ -743,7 +743,7 @@ class TrueMirrorElements(bpy.types.Operator, tool.Ifc.Operator): builder = ifcopenshell.util.shape_builder.ShapeBuilder(tool.Ifc.get()) builder.mirror(item, (1, 0), create_copy=False) elif element.is_a("IfcTypeProduct"): - for representation_map in element.RepresentationMaps: + for representation_map in (element.RepresentationMaps or []): for item in representation_map.MappedRepresentation.Items: builder = ifcopenshell.util.shape_builder.ShapeBuilder(tool.Ifc.get()) builder.mirror(item, (1, 0), create_copy=False) @@ -801,7 +801,7 @@ class TrueMirrorElements(bpy.types.Operator, tool.Ifc.Operator): tool.Blender.Modifier.set_mirrored_type(type_element, inverted_type) inverted_type.Name = f"{inverted_type.Name}.Mirror" - bonsai.core.type.assign_type(tool.Ifc, tool.Type, element, inverted_type) + bonsai.core.type.assign_type(tool.Ifc, tool.Model, tool.Type, element, inverted_type) def generate_box(usecase_path: str, ifc_file: ifcopenshell.file, settings: dict[str, Any]) -> None: