From 36cb625c4e3c8e163d0cb26ff019c85a189d820c Mon Sep 17 00:00:00 2001 From: Ryan Schultz Date: Sat, 15 Nov 2025 07:52:07 -0600 Subject: [PATCH] Fix #7353: Fix section annotations squashed in section views Add target view detection to generate_section_reference_points() to create appropriate geometry for each view type. Plan views get horizontal lines (clip_segment), section/elevation views get vertical lines (elevate_segment). --- src/bonsai/bonsai/tool/drawing.py | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/src/bonsai/bonsai/tool/drawing.py b/src/bonsai/bonsai/tool/drawing.py index 3a19be6ae5..73c1c2c442 100644 --- a/src/bonsai/bonsai/tool/drawing.py +++ b/src/bonsai/bonsai/tool/drawing.py @@ -1732,11 +1732,22 @@ class Drawing(bonsai.core.tool.Drawing): im = camera.matrix_world.inverted() v1, v2 = [im @ Vector((m @ np.append(v, 1.0))[:3]) for v in [v1, v2]] + target_view = cls.get_drawing_target_view(drawing) bounds = helper.ortho_view_frame(camera.data) - if not (points := helper.clip_segment(bounds, [v1, v2])): + + if target_view in ("PLAN_VIEW", "REFLECTED_PLAN_VIEW"): + # For plan views, clip to XY bounds and set Z=0 + if not (points := helper.clip_segment(bounds, [v1, v2])): + return + for v in points: + v.z = 0 + elif target_view in ("ELEVATION_VIEW", "SECTION_VIEW"): + # For section/elevation views, elevate the segment vertically + if not (points := helper.elevate_segment(bounds, [v1, v2])): + return + else: return - for v in points: - v.z = 0 + return points @classmethod