diff --git a/src/bonsai/bonsai/bim/handler.py b/src/bonsai/bonsai/bim/handler.py index c7114373bf..f1ee116e75 100644 --- a/src/bonsai/bonsai/bim/handler.py +++ b/src/bonsai/bonsai/bim/handler.py @@ -336,5 +336,3 @@ def load_post(scene): WallAxisDecorator.install(bpy.context) if model_props.show_slab_direction: SlabDirectionDecorator.install(bpy.context) - - diff --git a/src/bonsai/bonsai/bim/module/debug/operator.py b/src/bonsai/bonsai/bim/module/debug/operator.py index 6c7ddc2570..b75fb007cb 100644 --- a/src/bonsai/bonsai/bim/module/debug/operator.py +++ b/src/bonsai/bonsai/bim/module/debug/operator.py @@ -714,7 +714,7 @@ class MergeIdenticalObjects(bpy.types.Operator, tool.Ifc.Operator): plural_object_type = f"{object_type.lower()}s" if merged_data: for element_type, element_names in merged_data.items(): - names = ", ". join([n or "Unnamed" for n in element_names]) + names = ", ".join([n or "Unnamed" for n in element_names]) print(f"- {element_type}: {names}") merged = sum(len(v) for v in merged_data.values()) diff --git a/src/bonsai/bonsai/bim/module/geometry/operator.py b/src/bonsai/bonsai/bim/module/geometry/operator.py index 5089c3969f..1bb1c79fdf 100644 --- a/src/bonsai/bonsai/bim/module/geometry/operator.py +++ b/src/bonsai/bonsai/bim/module/geometry/operator.py @@ -3052,7 +3052,6 @@ class OverrideMove(bpy.types.Operator): obj.select_set(True) self.new_active_obj = obj - # Get aggregates props = context.scene.BIMAggregateProperties not_editing_objs = [o.obj for o in props.not_editing_objects] @@ -3063,7 +3062,7 @@ class OverrideMove(bpy.types.Operator): obj.select_set(False) continue if obj == props.editing_aggregate: - continue + continue element = tool.Ifc.get_entity(obj) if not element or not element.is_a("IfcElement"): continue @@ -3072,7 +3071,7 @@ class OverrideMove(bpy.types.Operator): aggregates_to_move.append(tool.Ifc.get_object(element)) continue if not parts and props.in_aggregate_mode: - continue + continue aggregate = ifcopenshell.util.element.get_aggregate(element) if aggregate: aggregates_to_move.append(tool.Ifc.get_object(aggregate)) @@ -3098,7 +3097,7 @@ class OverrideMove(bpy.types.Operator): obj.select_set(False) continue if obj == props.editing_nest: - continue + continue element = tool.Ifc.get_entity(obj) if not element or not element.is_a("IfcElement"): continue @@ -3107,7 +3106,7 @@ class OverrideMove(bpy.types.Operator): nests_to_move.append(tool.Ifc.get_object(element)) continue if not components and props.in_nest_mode: - continue + continue nest = ifcopenshell.util.element.get_nest(element) if nest: nests_to_move.append(tool.Ifc.get_object(nest)) diff --git a/src/bonsai/bonsai/bim/module/nest/decorator.py b/src/bonsai/bonsai/bim/module/nest/decorator.py index 3dd85bf09b..e096ca24f3 100644 --- a/src/bonsai/bonsai/bim/module/nest/decorator.py +++ b/src/bonsai/bonsai/bim/module/nest/decorator.py @@ -33,6 +33,7 @@ def transparent_color(color, alpha=0.1): color[3] = alpha return color + def create_bounding_box(objs): # Initialize the bounding box coordinates min_x, min_y, min_z = float("inf"), float("inf"), float("inf") @@ -77,6 +78,7 @@ def create_bounding_box(objs): return indices, edges + class NestDecorator: is_installed = False handlers = [] @@ -206,7 +208,7 @@ class NestDecorator: else: self.draw_batch("POINTS", [location], color) # if context.scene.BIMNestProperties.in_aggregate_mode: - # return + # return components = ifcopenshell.util.element.get_components(tool.Ifc.get_entity(nest)) components_objs = [tool.Ifc.get_object(p) for p in components] components_objs.append(nest) @@ -227,12 +229,8 @@ class NestModeDecorator: if cls.is_installed: cls.uninstall() handler = cls() - cls.handlers.append( - SpaceView3D.draw_handler_add(handler.draw_nest_name, (context,), "WINDOW", "POST_PIXEL") - ) - cls.handlers.append( - SpaceView3D.draw_handler_add(handler.draw_nest_empty, (context,), "WINDOW", "POST_VIEW") - ) + cls.handlers.append(SpaceView3D.draw_handler_add(handler.draw_nest_name, (context,), "WINDOW", "POST_PIXEL")) + cls.handlers.append(SpaceView3D.draw_handler_add(handler.draw_nest_empty, (context,), "WINDOW", "POST_VIEW")) cls.is_installed = True @classmethod diff --git a/src/bonsai/bonsai/bim/module/nest/prop.py b/src/bonsai/bonsai/bim/module/nest/prop.py index 7fbe30278a..67fed8fe2d 100644 --- a/src/bonsai/bonsai/bim/module/nest/prop.py +++ b/src/bonsai/bonsai/bim/module/nest/prop.py @@ -49,6 +49,7 @@ class BIMObjectNestProperties(PropertyGroup): is_editing: BoolProperty(name="Is Editing") relating_object: PointerProperty(name="Nest Host", type=bpy.types.Object, update=update_relating_object) + def update_nest_decorator(self, context): if self.nest_decorator: NestDecorator.install(bpy.context) diff --git a/src/bonsai/bonsai/core/nest.py b/src/bonsai/bonsai/core/nest.py index 94dcca9516..45eb660a9d 100644 --- a/src/bonsai/bonsai/core/nest.py +++ b/src/bonsai/bonsai/core/nest.py @@ -24,6 +24,7 @@ if TYPE_CHECKING: import ifcopenshell import bonsai.tool as tool + def enable_editing_nest(nest, obj=None): nest.enable_editing(obj) diff --git a/src/ifcopenshell-python/ifcopenshell/api/geometry/validate_type.py b/src/ifcopenshell-python/ifcopenshell/api/geometry/validate_type.py index 6be8686732..ef3c9a0bbf 100644 --- a/src/ifcopenshell-python/ifcopenshell/api/geometry/validate_type.py +++ b/src/ifcopenshell-python/ifcopenshell/api/geometry/validate_type.py @@ -45,6 +45,7 @@ def validate_type( :return: True if the representation type was set and it is a valid combination, or False otherwise. """ + def is_operand(item): return ( item.is_a("IfcBooleanResult") diff --git a/src/ifcopenshell-python/test/api/geometry/test_remove_boolean.py b/src/ifcopenshell-python/test/api/geometry/test_remove_boolean.py index c77e8a080a..5b98fc0de0 100644 --- a/src/ifcopenshell-python/test/api/geometry/test_remove_boolean.py +++ b/src/ifcopenshell-python/test/api/geometry/test_remove_boolean.py @@ -39,7 +39,6 @@ class TestRemoveBoolean(test.bootstrap.IFC4): assert set(rep.Items) == {first, second} assert not self.file.by_type("IfcBooleanResult") - def test_removing_a_top_level_nested_boolean(self): ifcopenshell.api.root.create_entity(self.file, ifc_class="IfcProject") model = ifcopenshell.api.context.add_context(self.file, context_type="Model")