Fixed issue with polyline inserting point at world origin (0, 0, 0).

This commit is contained in:
Bruno Perdigão
2024-09-23 17:13:57 -03:00
parent 98d767988e
commit 3c2a0c9bf3
+4
View File
@@ -159,6 +159,8 @@ class Polyline(bonsai.core.tool.Polyline):
second_to_last_point = Vector((last_point.x + 1000, last_point.y, last_point.z)) second_to_last_point = Vector((last_point.x + 1000, last_point.y, last_point.z))
distance = (snap_vector - last_point).length distance = (snap_vector - last_point).length
if distance < 0:
return
if distance > 0: if distance > 0:
angle = tool.Cad.angle_3_vectors( angle = tool.Cad.angle_3_vectors(
second_to_last_point, last_point, snap_vector, new_angle=None, degrees=True second_to_last_point, last_point, snap_vector, new_angle=None, degrees=True
@@ -167,6 +169,8 @@ class Polyline(bonsai.core.tool.Polyline):
# Round angle to the nearest 0.05 # Round angle to the nearest 0.05
angle = round(angle / 0.05) * 0.05 angle = round(angle / 0.05) * 0.05
if distance == 0:
angle = 0
if input_ui: if input_ui:
input_ui.set_value("X", snap_vector.x) input_ui.set_value("X", snap_vector.x)
input_ui.set_value("Y", snap_vector.y) input_ui.set_value("Y", snap_vector.y)