From 5309b4614cc44172ea3cd3059db24587c3135801 Mon Sep 17 00:00:00 2001 From: Ryan Schultz Date: Sun, 14 Jun 2026 15:09:27 -0500 Subject: [PATCH] Fix DrawParametricDimension: always regenerate from anchors after RMB regenerate_dimension was only called when ForcePerpendicularToFace was set, so normal two-anchor dimensions were left at raw polyline cursor positions after placement. The depsgraph handler would later correct them when the user happened to select a referenced IFC element, making accurate placement appear to require a manual selection step. Remove the _force_perpendicular guard so the anchor-based regeneration always runs at the end of _create_dimension_from_polyline. --- .../bonsai/bim/module/drawing/operator.py | 41 ++++++++++--------- 1 file changed, 21 insertions(+), 20 deletions(-) diff --git a/src/bonsai/bonsai/bim/module/drawing/operator.py b/src/bonsai/bonsai/bim/module/drawing/operator.py index d6ab2700a3..b76ae00982 100644 --- a/src/bonsai/bonsai/bim/module/drawing/operator.py +++ b/src/bonsai/bonsai/bim/module/drawing/operator.py @@ -6242,26 +6242,27 @@ class DrawParametricDimension(bpy.types.Operator, PolylineOperator, tool.Ifc.Ope pset_props["ForcePerpendicularToFace"] = True ifcopenshell.api.run("pset.edit_pset", file, pset=pset_entity, properties=pset_props) - if self._force_perpendicular: - placement_override: dict = {} - for a in anchors: - guid = a.get("guid") - if not guid: - continue - try: - elem = file.by_guid(guid) - elem_obj = tool.Ifc.get_object(elem) - if elem_obj: - placement_override[elem.id()] = np.array(elem_obj.matrix_world) - except Exception: - pass - resolved_pts = drawing_api.regenerate_dimension( - file, annotation, - shape_cache=getattr(self, "_shape_cache", None), - placement_override=placement_override, - ) - if resolved_pts: - _update_blender_curve(annotation, resolved_pts) + # Always regenerate from anchor data so the curve reflects the true IFC + # face positions rather than the raw cursor positions from the polyline. + placement_override: dict = {} + for a in anchors: + guid = a.get("guid") + if not guid: + continue + try: + elem = file.by_guid(guid) + elem_obj = tool.Ifc.get_object(elem) + if elem_obj: + placement_override[elem.id()] = np.array(elem_obj.matrix_world) + except Exception: + pass + resolved_pts = drawing_api.regenerate_dimension( + file, annotation, + shape_cache=getattr(self, "_shape_cache", None), + placement_override=placement_override, + ) + if resolved_pts: + _update_blender_curve(annotation, resolved_pts) from bonsai.bim.module.drawing import handler as _drawing_handler _drawing_handler.invalidate_dim_index()