From 2e9ee736363d3101d750407e429acb1ad39d8d91 Mon Sep 17 00:00:00 2001 From: Jeff Cooper Date: Sat, 29 Aug 2026 19:57:28 -0400 Subject: [PATCH 1/2] Perform Z-hop + plunge for descending travel transitions within pockets/regions --- src/kiri/mode/cam/work/prepare.js | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/src/kiri/mode/cam/work/prepare.js b/src/kiri/mode/cam/work/prepare.js index c6ed072c2..ec9cb8c52 100644 --- a/src/kiri/mode/cam/work/prepare.js +++ b/src/kiri/mode/cam/work/prepare.js @@ -584,9 +584,14 @@ export async function prepare_one(widget, settings, print, firstPoint, update) { emit = 1; } else // otherwise move over before descending - if (deltaZ <= -tolerance) { - if (debug) console.log('over before descend', deltaZ, -tolerance); - layerPush(point.clone().setZ(printPoint.z), 0, 0, tool); + if (deltaZ < Math.min(-tolerance, -0.001)) { + let lift = printPoint.clone(); + lift.z += 0.1; + let target = point.clone(); + target.z = printPoint.z + 0.1; + + layerPush(lift, 0, 0, tool); + layerPush(target, 0, 0, tool); newLayer(); } } else @@ -626,6 +631,21 @@ export async function prepare_one(widget, settings, print, firstPoint, update) { } } lastTravelBounds = undefined; + + // If we are NOT retracting (didn't cross boundaries): + if (!upAndOver) { + if (deltaZ < Math.min(-tolerance, -0.001)) { + // Descending transition within the pocket -> Z-hop + let lift = printPoint.clone(); + lift.z += 0.1; + let target = point.clone(); + target.z = printPoint.z + 0.1; + + layerPush(lift, 0, 0, tool); + layerPush(target, 0, 0, tool); + newLayer(); + } + } } else // for longer moves if (isMove) { From 24c42e0ecbc3ed008db802dad616c3f2a99811a2 Mon Sep 17 00:00:00 2001 From: Jeff Cooper Date: Sat, 29 Aug 2026 19:57:29 -0400 Subject: [PATCH 2/2] Force pocket stepovers inside boundaries to G1 cuts --- src/kiri/mode/cam/work/prepare.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/kiri/mode/cam/work/prepare.js b/src/kiri/mode/cam/work/prepare.js index ec9cb8c52..ff9fe8c43 100644 --- a/src/kiri/mode/cam/work/prepare.js +++ b/src/kiri/mode/cam/work/prepare.js @@ -644,6 +644,15 @@ export async function prepare_one(widget, settings, print, firstPoint, update) { layerPush(lift, 0, 0, tool); layerPush(target, 0, 0, tool); newLayer(); + } else if (deltaXY <= shortCut && deltaZ <= 0 && !lasering) { + // If this is a short move and the deltaZ failed the check + // in the first branch of this conditional (ie, it's not a + // significant z-descent), but it's still either zero + // (in-plane move) or insignificantly negative, that means + // that we're likely making a cut through stock (a stepover + // cut is the best example of this). Since that's still + // going through material, we force a G1 move for this cut. + emit = 1; } } } else