diff --git a/src/Mod/CAM/CAMTests/TestPathDepthParams.py b/src/Mod/CAM/CAMTests/TestPathDepthParams.py index feefa5d7ba..7d03f911c7 100644 --- a/src/Mod/CAM/CAMTests/TestPathDepthParams.py +++ b/src/Mod/CAM/CAMTests/TestPathDepthParams.py @@ -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}" + ) diff --git a/src/Mod/CAM/PathScripts/PathUtils.py b/src/Mod/CAM/PathScripts/PathUtils.py index edbcfd0dfb..7b7e0db9ff 100644 --- a/src/Mod/CAM/PathScripts/PathUtils.py +++ b/src/Mod/CAM/PathScripts/PathUtils.py @@ -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))