add function to force op change when chaining ops internally like roughing does

This commit is contained in:
Stewart Allen 2026-01-01 23:43:46 -05:00
commit 45803664f1
2 changed files with 11 additions and 2 deletions

View file

@ -106,10 +106,12 @@ class OpRough extends CamOp {
await op.slice(progress); await op.slice(progress);
} }
} }
s
async prepare(ops, progress) { async prepare(ops, progress) {
let { setChangeOp } = ops;
for (let op of this.ops_list) { for (let op of this.ops_list) {
await op.prepare(ops, progress); await op.prepare(ops, progress);
setChangeOp();
} }
} }
} }

View file

@ -131,6 +131,7 @@ export async function prepare_one(widget, settings, print, firstPoint, update) {
lastTravelBounds, lastTravelBounds,
newOutput = print.output || [], newOutput = print.output || [],
nextIsMove = true, nextIsMove = true,
nextIsNewOp = false,
plungeRate = camFastFeedZ, plungeRate = camFastFeedZ,
printPoint, printPoint,
tool, tool,
@ -354,6 +355,10 @@ export async function prepare_one(widget, settings, print, firstPoint, update) {
nextIsMove = true; nextIsMove = true;
} }
function setChangeOp() {
nextIsNewOp = true;
}
/** /**
* Move a point by the widget's movement offset. * Move a point by the widget's movement offset.
* @param {Point} p - point to move * @param {Point} p - point to move
@ -475,11 +480,12 @@ export async function prepare_one(widget, settings, print, firstPoint, update) {
// 1. move to safe z of current point preserving angle // 1. move to safe z of current point preserving angle
// 2. move to safe z of new point preserving old angle // 2. move to safe z of new point preserving old angle
// 3. move to safe z of new point with new angle // 3. move to safe z of new point with new angle
if (lop !== currentOp) { if (nextIsNewOp || lop !== currentOp) {
layerPush(printPoint.clone().setZ(zSafe).setA(printPoint.a), 0, feedRate, tool); layerPush(printPoint.clone().setZ(zSafe).setA(printPoint.a), 0, feedRate, tool);
layerPush(point.clone().setZ(zSafe).setA(printPoint.a), 0, feedRate, tool); layerPush(point.clone().setZ(zSafe).setA(printPoint.a), 0, feedRate, tool);
layerPush(point.clone().setZ(zSafe), 0, feedRate, tool); layerPush(point.clone().setZ(zSafe), 0, feedRate, tool);
newLayer(); newLayer();
nextIsNewOp = false;
} }
// consume forced next move flag and convert to move // consume forced next move flag and convert to move
@ -965,6 +971,7 @@ export async function prepare_one(widget, settings, print, firstPoint, update) {
poly2polyEmit, poly2polyEmit,
polyEmit, polyEmit,
printPoint, printPoint,
setChangeOp,
setContouring, setContouring,
setDrill, setDrill,
setLasering, setLasering,