From fb34af9162d015a5f3170d13c52a867126204016 Mon Sep 17 00:00:00 2001 From: Dion Moult Date: Sat, 19 Apr 2025 15:30:46 +1000 Subject: [PATCH] Fix #6575. Regression in moving aggregates. --- .../bonsai/bim/module/geometry/operator.py | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/src/bonsai/bonsai/bim/module/geometry/operator.py b/src/bonsai/bonsai/bim/module/geometry/operator.py index 2e83e7678d..3b61caf4a3 100644 --- a/src/bonsai/bonsai/bim/module/geometry/operator.py +++ b/src/bonsai/bonsai/bim/module/geometry/operator.py @@ -3071,20 +3071,21 @@ class OverrideMove(bpy.types.Operator): element = tool.Ifc.get_entity(obj) if not element or not element.is_a("IfcElement"): continue - parts = ifcopenshell.util.element.get_parts(element) - if parts: + + if parts := ifcopenshell.util.element.get_parts(element): aggregates_to_move.append(tool.Ifc.get_object(element)) aggregates_to_move.extend(list(tool.Aggregate.get_parts_recursively(element))) continue # Controls the aggregate level it should consider to move - aggregates = tool.Aggregate.get_aggregates_recursively(element) - aggregate = aggregates[-1] - if props.in_aggregate_mode: - current_aggregate_index = aggregates.index(tool.Ifc.get_entity(props.editing_aggregate)) - aggregate = aggregates[current_aggregate_index - 1] - if tool.Ifc.get_entity(props.editing_aggregate) == aggregates[0]: - aggregate = aggregates[0] + aggregate = None + if aggregates := tool.Aggregate.get_aggregates_recursively(element): + aggregate = aggregates[-1] + if props.in_aggregate_mode: + current_aggregate_index = aggregates.index(tool.Ifc.get_entity(props.editing_aggregate)) + aggregate = aggregates[current_aggregate_index - 1] + if tool.Ifc.get_entity(props.editing_aggregate) == aggregates[0]: + aggregate = aggregates[0] if not parts and props.in_aggregate_mode and aggregate == tool.Ifc.get_entity(props.editing_aggregate): continue