From f60a3423d052e8a86edfb206be6d2411ba57aa77 Mon Sep 17 00:00:00 2001 From: Gorgious56 Date: Wed, 24 Jun 2026 17:02:18 +0200 Subject: [PATCH] Fix: commit pending parametric draft before extrusion-edit EnableEditingExtrusionAxis and EnableEditingExtrusionProfile both import a mesh from the IFC representation into obj.data as their first real action. That mesh-import overwrites any in-memory parametric (gizmo) draft on the object, silently discarding the user's pending dimension edits. Concrete reproduction: drag a wall's length gizmo (draft pending), then click "Edit Axis" before validating the draft. The axis-edit imports the wall axis mesh; the in-flight draft vanishes; on cancel the wall snaps back to its pre-drag length. Both call sites now commit the active draft via tool.Parametric.commit_object_draft before the mesh import, gated on tool.Parametric.is_object_editing so the guard is a no-op when no draft is in flight. Generated with the assistance of an AI coding tool. --- src/bonsai/bonsai/bim/module/model/profile.py | 8 ++++++++ src/bonsai/bonsai/bim/module/model/slab.py | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/src/bonsai/bonsai/bim/module/model/profile.py b/src/bonsai/bonsai/bim/module/model/profile.py index d6fcb4c6fd..efbf41900d 100644 --- a/src/bonsai/bonsai/bim/module/model/profile.py +++ b/src/bonsai/bonsai/bim/module/model/profile.py @@ -1002,6 +1002,14 @@ class EnableEditingExtrusionAxis(bpy.types.Operator, tool.Ifc.Operator): def _execute(self, context): self.unit_scale = ifcopenshell.util.unit.calculate_unit_scale(tool.Ifc.get()) obj = context.active_object + + # Commit any in-progress parametric (gizmo) draft on this object + # before switching to axis-edit. Otherwise the in-memory draft + # state is overwritten when the axis mesh is imported below, + # silently discarding the user's pending dimension edits. + if feature := tool.Parametric.is_object_editing(obj): + tool.Parametric.commit_object_draft(obj, feature.finish_op) + element = tool.Ifc.get_entity(obj) axis = ifcopenshell.util.representation.get_representation(element, "Model", "Axis", "GRAPH_VIEW") diff --git a/src/bonsai/bonsai/bim/module/model/slab.py b/src/bonsai/bonsai/bim/module/model/slab.py index 9d7e88a23d..4f47740e6d 100644 --- a/src/bonsai/bonsai/bim/module/model/slab.py +++ b/src/bonsai/bonsai/bim/module/model/slab.py @@ -620,6 +620,14 @@ class EnableEditingExtrusionProfile(bpy.types.Operator, tool.Ifc.Operator): def _execute(self, context): self.unit_scale = ifcopenshell.util.unit.calculate_unit_scale(tool.Ifc.get()) obj = context.active_object + + # Commit any in-progress parametric (gizmo) draft on this object + # before switching to profile-edit. Otherwise the in-memory draft + # state is overwritten when the profile mesh is imported below, + # silently discarding the user's pending dimension edits. + if feature := tool.Parametric.is_object_editing(obj): + tool.Parametric.commit_object_draft(obj, feature.finish_op) + element = tool.Ifc.get_entity(obj) body = ifcopenshell.util.representation.get_representation(element, "Model", "Body", "MODEL_VIEW")