mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-10 01:41:57 +00:00
Fix polyline tool angle lock when using XZ and YZ plane
This commit is contained in:
@@ -110,7 +110,7 @@ class Cad:
|
||||
parameter = (
|
||||
round(axis.z, 2) < 0
|
||||
or (round(axis.y, 2) == 0 and round(axis.x < 0))
|
||||
or (round(axis.x, 2) == 0 and round(axis.y < 0))
|
||||
or (round(axis.x, 2) == 0 and round(axis.y > 0))
|
||||
)
|
||||
if new_angle is not None:
|
||||
rot_mat = Matrix.Rotation(new_angle, 3, axis)
|
||||
|
||||
@@ -155,8 +155,12 @@ class Polyline(bonsai.core.tool.Polyline):
|
||||
# Creates a fake "second to last" point away from the first point but in the same x axis
|
||||
# this allows to calculate the angle relative to x axis when there is only one point
|
||||
second_to_last_point = Vector((last_point.x + 1000, last_point.y, last_point.z))
|
||||
if tool_state.plane_method == "YZ":
|
||||
second_to_last_point = Vector((last_point.x, last_point.y + 1000, last_point.z))
|
||||
|
||||
world_second_to_last_point = Vector((last_point.x + 1000, last_point.y, last_point.z))
|
||||
if tool_state.plane_method == "YZ":
|
||||
world_second_to_last_point = Vector((last_point.x, last_point.y + 1000, last_point.z))
|
||||
|
||||
distance = (snap_vector - last_point).length
|
||||
if distance < 0:
|
||||
|
||||
@@ -140,7 +140,7 @@ class Snap(bonsai.core.tool.Snap):
|
||||
bpy.context.scene.BIMPolylineProperties.snap_mouse_ref.clear()
|
||||
|
||||
@classmethod
|
||||
def snap_on_axis(cls, intersection, tool_state, lock_angle=False):
|
||||
def snap_on_axis(cls, intersection, tool_state):
|
||||
def create_axis_line_data(rot_mat, origin):
|
||||
length = 1000
|
||||
direction = Vector((1, 0, 0))
|
||||
@@ -488,10 +488,10 @@ class Snap(bonsai.core.tool.Snap):
|
||||
tool_state.snap_angle = 90
|
||||
if tool_state.lock_axis or tool_state.axis_method:
|
||||
# Doesn't update snap_angle so that it keeps in the same axis
|
||||
rot_intersection, _, axis_start, axis_end = cls.snap_on_axis(intersection, tool_state, True)
|
||||
rot_intersection, _, axis_start, axis_end = cls.snap_on_axis(intersection, tool_state)
|
||||
else:
|
||||
rot_intersection, tool_state.snap_angle, axis_start, axis_end = cls.snap_on_axis(
|
||||
intersection, tool_state, False
|
||||
intersection, tool_state
|
||||
)
|
||||
|
||||
if rot_intersection and polyline_points:
|
||||
|
||||
Reference in New Issue
Block a user