mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-10 01:41:57 +00:00
Polyline tool - increment snap implementation.
This commit is contained in:
@@ -88,7 +88,6 @@ class Snap(bonsai.core.tool.Snap):
|
||||
def clear_snapping_ref(cls):
|
||||
bpy.context.scene.BIMPolylineProperties.snap_mouse_ref.clear()
|
||||
|
||||
|
||||
@classmethod
|
||||
def snap_on_axis(cls, intersection, tool_state, lock_angle=False):
|
||||
def create_axis_line_data(rot_mat, origin):
|
||||
@@ -360,9 +359,28 @@ class Snap(bonsai.core.tool.Snap):
|
||||
rot_intersection, tool_state.snap_angle, axis_start, axis_end = cls.snap_on_axis(
|
||||
intersection, tool_state, False
|
||||
)
|
||||
if rot_intersection:
|
||||
|
||||
increment = None
|
||||
if rv3d.view_perspective == "PERSP":
|
||||
if rv3d.view_distance < 10:
|
||||
increment = 0.1
|
||||
else:
|
||||
increment = 1
|
||||
if rv3d.view_perspective == "ORTHO" or (
|
||||
rv3d.view_perspective == "CAMERA" and context.scene.camera.data.type == "ORTHO"
|
||||
):
|
||||
window_scale = rv3d.window_matrix.to_scale()
|
||||
if window_scale[0] < -0.1 and window_scale[1] < -0.1:
|
||||
increment = 0.1
|
||||
else:
|
||||
increment = 1
|
||||
|
||||
if rot_intersection and polyline_points:
|
||||
detected_snaps.append({"Axis": (rot_intersection, axis_start, axis_end)})
|
||||
|
||||
if increment:
|
||||
for i in range(len(intersection)):
|
||||
intersection[i] = increment * round(intersection[i] / increment)
|
||||
detected_snaps.append({"Plane": intersection})
|
||||
|
||||
return detected_snaps
|
||||
|
||||
Reference in New Issue
Block a user