From e7a725dca38c2636eb6beafa5508b6864004ad4a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bruno=20Perdig=C3=A3o?= Date: Tue, 15 Oct 2024 21:25:16 -0300 Subject: [PATCH] Fix #5562 --- src/bonsai/bonsai/tool/polyline.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/bonsai/bonsai/tool/polyline.py b/src/bonsai/bonsai/tool/polyline.py index 274ade12e0..897a99527c 100644 --- a/src/bonsai/bonsai/tool/polyline.py +++ b/src/bonsai/bonsai/tool/polyline.py @@ -18,6 +18,7 @@ import bpy import bmesh +import math import bonsai.core.tool import bonsai.tool as tool from bonsai.bim.module.drawing.helper import format_distance @@ -276,6 +277,13 @@ class Polyline(bonsai.core.tool.Polyline): rot_vector = tool.Cad.angle_3_vectors(second_to_last_point, last_point, snap_vector, angle, degrees=True) + # When the angle in 180 degrees it might create a rotation vector that is equal to + # when the angle is 0 degress, leading the insertion point to the opposite direction + # This prevents the issue by ensuring the the negative x direction + if round(angle, 4) == round(math.pi, 4): + rot_vector.x = -1.0 + + coords = rot_vector * distance + last_point x = coords[0]