From 8647f9c3574968f369c577597c1ef9a73d898124 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bruno=20Perdig=C3=A3o?= Date: Mon, 13 Oct 2025 17:43:28 -0300 Subject: [PATCH] Polyline tool - avoids rounding angle when distance is too big. --- src/bonsai/bonsai/tool/polyline.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/bonsai/bonsai/tool/polyline.py b/src/bonsai/bonsai/tool/polyline.py index e4132c62d2..04806660a1 100644 --- a/src/bonsai/bonsai/tool/polyline.py +++ b/src/bonsai/bonsai/tool/polyline.py @@ -172,23 +172,24 @@ class Polyline(bonsai.core.tool.Polyline): angle = tool.Cad.angle_3_vectors( second_to_last_point, last_point, mouse_vector, new_angle=None, degrees=True ) + angle_round_threshold = 1000 # Avoids rounding when distance is too big # Round angle to the nearest 0.05 - angle = round(angle / 0.05) * 0.05 - + angle = round(angle / 0.05) * 0.05 if distance < angle_round_threshold else angle + orientation_angle = tool.Cad.angle_3_vectors( world_second_to_last_point, last_point, mouse_vector, new_angle=None, degrees=True ) # Round angle to the nearest 0.05 - orientation_angle = round(orientation_angle / 0.05) * 0.05 + orientation_angle = round(orientation_angle / 0.05) * 0.05 if distance < angle_round_threshold else angle if distance == 0: angle = 0 orientation_angle = 0 if input_ui: if should_round: - angle = 5 * round(angle / 5) + angle = 5 * round(angle / 5) if distance < angle_round_threshold else angle factor = tool.Snap.get_increment_snap_value(context) distance = factor * round(distance / factor) input_ui.set_value("X", mouse_vector.x)