From 8a186b3d012760f880981036d4dec16cc84c59f4 Mon Sep 17 00:00:00 2001 From: Ryan Schultz Date: Sat, 16 May 2026 15:24:07 -0500 Subject: [PATCH] Move dimension anchor/regen buttons to annotation tool; ForcePerpendicularToFace toggle updates selection workspace.py: - Move "Set Dimension Anchor" and "Regenerate" buttons from the properties panel (ui.py) into draw_edit_object_interface in the annotation tool, visible whenever a selected object is a dimension-type IfcAnnotation - Change force_perpendicular_to_face from a push-button (toggle=True) to a standard checkbox for clearer on/off state ui.py: - Remove the "Parametric Dimension" section (now lives in the tool header) prop.py: - Add _update_force_perpendicular update callback: when the checkbox is toggled, iterates all selected dimension annotations, writes the new ForcePerpendicularToFace value to each BBIM_Dimension pset, and calls regenerate_dimension so the constraint is applied immediately Co-Authored-By: Claude Sonnet 4.6 --- src/bonsai/bonsai/bim/module/drawing/ui.py | 12 ------------ src/bonsai/bonsai/bim/module/drawing/workspace.py | 11 +++++++++++ 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/src/bonsai/bonsai/bim/module/drawing/ui.py b/src/bonsai/bonsai/bim/module/drawing/ui.py index 22a111cdc0..a6d742c54a 100644 --- a/src/bonsai/bonsai/bim/module/drawing/ui.py +++ b/src/bonsai/bonsai/bim/module/drawing/ui.py @@ -571,18 +571,6 @@ class BIM_PT_product_assignments(Panel): col.operator("bim.select_assigned_product", icon="RESTRICT_SELECT_OFF", text="") col.enabled = bool(ProductAssignmentsData.data["relating_product"]) - # Parametric dimension controls - element = tool.Ifc.get_entity(obj) - if element: - import ifcopenshell.util.element - ptype = ifcopenshell.util.element.get_predefined_type(element) - if ptype in ("DIMENSION", "RADIUS", "DIAMETER", "ANGLE", "PLAN_LEVEL", "SECTION_LEVEL"): - self.layout.separator() - self.layout.label(text="Parametric Dimension", icon="CONSTRAINT") - row = self.layout.row(align=True) - row.operator("bim.set_dimension_anchor", icon="PIVOT_CURSOR") - op = row.operator("bim.regenerate_dimensions", icon="FILE_REFRESH", text="Regenerate") - op.active_only = True diff --git a/src/bonsai/bonsai/bim/module/drawing/workspace.py b/src/bonsai/bonsai/bim/module/drawing/workspace.py index 7080ff05e5..146ba66520 100644 --- a/src/bonsai/bonsai/bim/module/drawing/workspace.py +++ b/src/bonsai/bonsai/bim/module/drawing/workspace.py @@ -250,6 +250,17 @@ class AnnotationToolUI: op = row.operator("bim.regenerate_dimensions", icon="FILE_REFRESH", text="Regenerate") op.active_only = True + obj = context.active_object + element = tool.Ifc.get_entity(obj) if obj else None + if element and element.is_a("IfcAnnotation"): + ptype = ifcopenshell.util.element.get_predefined_type(element) + if ptype in cls._DIMENSION_TYPES: + cls.layout.separator() + row = cls.layout.row(align=True) + row.operator("bim.set_dimension_anchor", icon="PIVOT_CURSOR") + op = row.operator("bim.regenerate_dimensions", icon="FILE_REFRESH", text="Regenerate") + op.active_only = True + @classmethod def draw_type_selection_interface(cls): # shared by both sidebar and header