diff --git a/src/bonsai/bonsai/bim/module/geometry/operator.py b/src/bonsai/bonsai/bim/module/geometry/operator.py index 732bc61a9f..ae412030d3 100644 --- a/src/bonsai/bonsai/bim/module/geometry/operator.py +++ b/src/bonsai/bonsai/bim/module/geometry/operator.py @@ -2728,14 +2728,13 @@ class OverrideModeSetObject(bpy.types.Operator, tool.Ifc.Operator): builder = ifcopenshell.util.shape_builder.ShapeBuilder(tool.Ifc.get()) builder.mirror(new_mirrored_repr, (1, 0), create_copy=False) new_items.append(new_mirrored_repr) - + old_items = mirrored_type.RepresentationMaps[map_index].MappedRepresentation.Items mirrored_type.RepresentationMaps[map_index].MappedRepresentation.Items = new_items for old_item in old_items: ifcopenshell.util.element.remove_deep2(tool.Ifc.get(), old_item) - - tool.Geometry.reload_representation(tool.Ifc.get_object(mirrored_type)) + tool.Geometry.reload_representation(tool.Ifc.get_object(mirrored_type)) def enable_edit_mode(self, context): if tool.Blender.toggle_edit_mode(context) == {"CANCELLED"}: diff --git a/src/bonsai/bonsai/bim/module/material/operator.py b/src/bonsai/bonsai/bim/module/material/operator.py index 4a5267afa6..22eeb1cf37 100644 --- a/src/bonsai/bonsai/bim/module/material/operator.py +++ b/src/bonsai/bonsai/bim/module/material/operator.py @@ -666,9 +666,9 @@ class EditAssignedMaterial(bpy.types.Operator, tool.Ifc.Operator): mirrored_type = tool.Blender.Modifier.has_mirrored_type(type_element) if not mirrored_type: return - - ifcopenshell.api.material.assign_material(tool.Ifc.get(), [ mirrored_type ], material.is_a(), material) - tool.Material.ensure_material_assigned([ mirrored_type ], material.is_a(), material) + + ifcopenshell.api.material.assign_material(tool.Ifc.get(), [mirrored_type], material.is_a(), material) + tool.Material.ensure_material_assigned([mirrored_type], material.is_a(), material) class EnableEditingMaterialSetItemProfile(bpy.types.Operator): diff --git a/src/bonsai/bonsai/bim/module/model/opening.py b/src/bonsai/bonsai/bim/module/model/opening.py index 2497f212bf..323a2a66ac 100644 --- a/src/bonsai/bonsai/bim/module/model/opening.py +++ b/src/bonsai/bonsai/bim/module/model/opening.py @@ -705,6 +705,7 @@ class FlipFill(bpy.types.Operator, tool.Ifc.Operator): tool.Geometry.reload_representation(filled_object) + return {"FINISHED"} diff --git a/src/bonsai/bonsai/bim/module/model/polyline.py b/src/bonsai/bonsai/bim/module/model/polyline.py index 0748f9dfa0..94d925b4ec 100644 --- a/src/bonsai/bonsai/bim/module/model/polyline.py +++ b/src/bonsai/bonsai/bim/module/model/polyline.py @@ -531,7 +531,7 @@ def get_generic_product_preview_data(context, relating_type): snap_obj = bpy.data.objects.get(snap_prop.snap_object) snap_element = tool.Ifc.get_entity(snap_obj) rot_mat = Quaternion() - if relating_type.is_a() in [ "IfcDoorType", "IfcWindowType" ] and snap_element and snap_element.is_a("IfcWall"): + if relating_type.is_a() in ["IfcDoorType", "IfcWindowType"] and snap_element and snap_element.is_a("IfcWall"): layers = tool.Model.get_material_layer_parameters(snap_element) axes = tool.Model.get_wall_axis(snap_obj, layers=layers) axis_base = axes["base"] diff --git a/src/bonsai/bonsai/bim/module/model/product.py b/src/bonsai/bonsai/bim/module/model/product.py index 73f048fe82..51f6542c55 100644 --- a/src/bonsai/bonsai/bim/module/model/product.py +++ b/src/bonsai/bonsai/bim/module/model/product.py @@ -679,6 +679,7 @@ class MirrorElements(bpy.types.Operator, tool.Ifc.Operator): obj.matrix_world = newmat + class TrueMirrorElements(bpy.types.Operator, tool.Ifc.Operator): bl_idname = "bim.mirror_geometry" bl_label = "Mirror Element Geometry" @@ -692,7 +693,7 @@ class TrueMirrorElements(bpy.types.Operator, tool.Ifc.Operator): def _execute(self, context): for obj in context.selected_objects: self.mirror_obj(context, obj) - return { "FINISHED" } + return {"FINISHED"} def mirror_obj(self, context: bpy.types.Context, obj: bpy.types.Object): element = tool.Ifc.get_entity(obj) @@ -739,7 +740,7 @@ class TrueMirrorElements(bpy.types.Operator, tool.Ifc.Operator): if element.is_a("IfcProduct"): if not element.Representation: return - + for representation in element.Representation.Representations: for item in representation.Items: builder = ifcopenshell.util.shape_builder.ShapeBuilder(tool.Ifc.get()) @@ -796,7 +797,7 @@ class TrueMirrorElements(bpy.types.Operator, tool.Ifc.Operator): inverted_type = tool.Blender.Modifier.has_mirrored_type(type_element) if not inverted_type: - old_to_new, _ = tool.Geometry.duplicate_ifc_objects([ tool.Ifc.get_object(type_element) ]) + old_to_new, _ = tool.Geometry.duplicate_ifc_objects([tool.Ifc.get_object(type_element)]) inverted_type = old_to_new[type_element][0] self.invert_representation(inverted_type) tool.Blender.Modifier.set_mirrored_type(inverted_type, type_element) diff --git a/src/bonsai/bonsai/tool/blender.py b/src/bonsai/bonsai/tool/blender.py index fbb98b9ae1..91505aeedd 100644 --- a/src/bonsai/bonsai/tool/blender.py +++ b/src/bonsai/bonsai/tool/blender.py @@ -1631,7 +1631,9 @@ class Blender(bonsai.core.tool.Blender): pset = tool.Pset.get_element_pset(element, "BBIM_MirroredType") if not pset: pset = ifcopenshell.api.pset.add_pset(tool.Ifc.get(), element, "BBIM_MirroredType") - ifcopenshell.api.pset.edit_pset(tool.Ifc.get(), pset, properties={"Data": json.dumps({"mirrored_type": mirrored_type.id()})}) + ifcopenshell.api.pset.edit_pset( + tool.Ifc.get(), pset, properties={"Data": json.dumps({"mirrored_type": mirrored_type.id()})} + ) @classmethod def is_slab(cls, element: entity_instance) -> bool: diff --git a/src/bonsai/bonsai/tool/root.py b/src/bonsai/bonsai/tool/root.py index fddff903aa..e7d612ba73 100644 --- a/src/bonsai/bonsai/tool/root.py +++ b/src/bonsai/bonsai/tool/root.py @@ -119,7 +119,7 @@ class Root(bonsai.core.tool.Root): new_styled_by = ifcopenshell.util.element.copy(tool.Ifc.get(), styled_by) new_styled_by.Item = copied_entities[styled_by.Item.id()] copied_entities[styled_by.id()] = new_styled_by - + elif dest.is_a("IfcTypeProduct"): if not source.RepresentationMaps: return copied_entities @@ -142,7 +142,7 @@ class Root(bonsai.core.tool.Root): exclude_callback=exclude_callback, copied_entities=copied_entities, ) - + for item in map.MappedRepresentation.Items: if item.StyledByItem: for styled_by in item.StyledByItem: