Merge pull request #27247 from Daniel-Khodabakhsh/fix-0-step-down

CAM: Fix case when CAM operation `Start depth` equal to `Final depth` and `Step down` is zero
This commit is contained in:
sliptonic
2026-02-09 10:06:04 -06:00
committed by GitHub
2 changed files with 19 additions and 0 deletions

View File

@@ -262,3 +262,19 @@ class depthTestCases(unittest.TestCase):
d = PathUtils.depth_params(**args)
r = [i for i in d]
self.assertListEqual(r, expected, "Expected {}, but result of {}".format(expected, r))
def test_0_step_down_and_start_depth_equal_to_final_depth(self):
target_depth = 10
sut = PathUtils.depth_params(
clearance_height=target_depth + 10,
safe_height=target_depth + 5,
start_depth=target_depth,
step_down=0,
z_finish_step=0,
final_depth=target_depth,
)
self.assertListEqual(
sut.data, [target_depth], f"Expected [{target_depth}] but got {sut.data}"
)

View File

@@ -912,6 +912,9 @@ class depth_params(object):
all steps are of size 'size' except the one at the bottom which can be
smaller."""
if Path.Geom.isRoughly(start, stop):
return [stop]
fullsteps = int((start - stop) / size)
last_step = start - (fullsteps * size)
depths = list(linspace(last_step, start, fullsteps, endpoint=False))