From 55514c0297156ca201626f2de81587c4a4d2537d Mon Sep 17 00:00:00 2001 From: Dan Taylor Date: Wed, 14 May 2025 20:07:33 -0500 Subject: [PATCH] CAM: Adaptive: Fix helix entry start height (fix #21058) --- src/Mod/CAM/Path/Op/Adaptive.py | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/src/Mod/CAM/Path/Op/Adaptive.py b/src/Mod/CAM/Path/Op/Adaptive.py index b4e93a5364..1f05eccc80 100644 --- a/src/Mod/CAM/Path/Op/Adaptive.py +++ b/src/Mod/CAM/Path/Op/Adaptive.py @@ -734,13 +734,39 @@ def Execute(op, obj): adaptiveResults = list() for depths, region in cutlist: for result in region["toolpaths"]: + # Top depth is the height where the helix starts for a + # region. + # We want the lowest of 3 possibilities: + # - the top of the stock OR + # - the region's first cut depth + stepdown OR + # - the operation's starting depth + # The starting depth option covers the case where the user + # has a previous operations that cleared some stock and + # wants the adaptive toolpath to pick up where the previous + # operation left off. + # Regions are only generated where stock needs to be + # removed, so we can't start at the cut level- we know + # there's material there. + # TODO: Due to the adaptive algorithm currently not + # processing holes in the stock when finding entry points, + # this may result in a helix up to stepdown in height where + # one isn't required. This should be fixed in FindEntryPoint + # or FindEntryPointOutside in Adaptive.cpp, not bandaged + # here. + + TopDepth = min( + topZ, + depths[0] + stepdown, + obj.StartDepth.Value, + ) + adaptiveResults.append( { "HelixCenterPoint": result.HelixCenterPoint, "StartPoint": result.StartPoint, "AdaptivePaths": result.AdaptivePaths, "ReturnMotionType": result.ReturnMotionType, - "TopDepth": depths[0] + stepdown, + "TopDepth": TopDepth, "BottomDepth": depths[-1], } )