fix stock intersection test logic for long moves
This commit is contained in:
parent
834e60cd6b
commit
3ba7aae26a
2 changed files with 12 additions and 9 deletions
|
|
@ -13,7 +13,8 @@ export class OpHelical extends CamOp {
|
||||||
|
|
||||||
async slice(progress) {
|
async slice(progress) {
|
||||||
let { op, state } = this;
|
let { op, state } = this;
|
||||||
let { settings, addSlices, widget, updateToolDiams } = state;
|
let { addSlices, color, settings, updateToolDiams, widget } = state;
|
||||||
|
let { stock } = settings
|
||||||
let {
|
let {
|
||||||
cylinders,
|
cylinders,
|
||||||
forceStartAng,
|
forceStartAng,
|
||||||
|
|
@ -29,8 +30,6 @@ export class OpHelical extends CamOp {
|
||||||
entry,
|
entry,
|
||||||
entryOffset,
|
entryOffset,
|
||||||
} = op;
|
} = op;
|
||||||
let { color } = state;
|
|
||||||
let { stock } = settings
|
|
||||||
|
|
||||||
let tool = new Tool(settings, op.tool),
|
let tool = new Tool(settings, op.tool),
|
||||||
toolDiam = tool.fluteDiameter(),
|
toolDiam = tool.fluteDiameter(),
|
||||||
|
|
@ -240,10 +239,11 @@ export class OpHelical extends CamOp {
|
||||||
}
|
}
|
||||||
|
|
||||||
async prepare(ops, progress) {
|
async prepare(ops, progress) {
|
||||||
let { polyEmit, printPoint, setTool } = ops;
|
let { clearTravelBounds, polyEmit, printPoint, setNextIsMove, setTool } = ops;
|
||||||
let { tool, spindle, rate, feed } = this.op;
|
let { tool, spindle, rate, feed } = this.op;
|
||||||
|
|
||||||
setTool(tool, feed, rate);
|
setTool(tool, feed, rate);
|
||||||
|
clearTravelBounds();
|
||||||
|
|
||||||
let [ polys ] = this.sliceOut.map((s) => s.camLines);
|
let [ polys ] = this.sliceOut.map((s) => s.camLines);
|
||||||
polys = polys.slice();
|
polys = polys.slice();
|
||||||
|
|
@ -267,6 +267,7 @@ export class OpHelical extends CamOp {
|
||||||
if (!closest) break;
|
if (!closest) break;
|
||||||
poly = polys[closestI]
|
poly = polys[closestI]
|
||||||
polys[closestI] = null;
|
polys[closestI] = null;
|
||||||
|
|
||||||
printPoint = polyEmit(poly);
|
printPoint = polyEmit(poly);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -454,10 +454,9 @@ export async function prepare_one(widget, settings, print, firstPoint, update) {
|
||||||
// * rapid to just above stock
|
// * rapid to just above stock
|
||||||
// * continue plunge as cut
|
// * continue plunge as cut
|
||||||
if (isMove && deltaZ < 0 && printPoint.z > stockZ && point.z < stockZ) {
|
if (isMove && deltaZ < 0 && printPoint.z > stockZ && point.z < stockZ) {
|
||||||
if (debug) console.log('detected plunge cut as rapid move', printPoint.z, stockZ, point.z);
|
if (debug) console.log('detected plunge cut as rapid move', printPoint.z, point.z);
|
||||||
layerPush(point.clone().setZ(zSafe), 0, 0, tool);
|
layerPush(point.clone().setZ(zSafe), 0, 0, tool);
|
||||||
// change to cutting move for remainder of plunge
|
// change to cutting move for remainder of plunge
|
||||||
emit = 1;
|
|
||||||
newLayer();
|
newLayer();
|
||||||
} else
|
} else
|
||||||
// convert short planar moves to cuts when not lasering
|
// convert short planar moves to cuts when not lasering
|
||||||
|
|
@ -502,15 +501,16 @@ export async function prepare_one(widget, settings, print, firstPoint, update) {
|
||||||
}
|
}
|
||||||
lastTravelBounds = undefined;
|
lastTravelBounds = undefined;
|
||||||
} else
|
} else
|
||||||
// for longer moves, check the terrain to see if we need to go up and over
|
// for longer moves
|
||||||
if (isMove) {
|
if (isMove) {
|
||||||
const bigXY = (deltaXY > shortCut && !lasering);
|
const bigXY = (deltaXY > shortCut && !lasering);
|
||||||
const bigZ = (absDeltaZ > toolDiam / 2 && deltaXY > tolerance);
|
const bigZ = (absDeltaZ > toolDiam / 2 && deltaXY > tolerance);
|
||||||
const midZ = (tolerance && absDeltaZ >= tolerance);
|
const midZ = (tolerance && absDeltaZ >= tolerance);
|
||||||
|
const inStock = printPoint.z < stockZ || point.z < stockZ;
|
||||||
if (bigXY || bigZ || midZ) {
|
if (bigXY || bigZ || midZ) {
|
||||||
if (debug) console.log({ fromz: printPoint.z, toz: point.z });
|
if (debug) console.log({ fromz: printPoint.z, toz: point.z });
|
||||||
// for big moves inside stock...
|
// for big moves intersecting stock...
|
||||||
if (camForceZMax || printPoint.z < stockZ) {
|
if (camForceZMax || inStock) {
|
||||||
upAndOver = true;
|
upAndOver = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -849,6 +849,7 @@ export async function prepare_one(widget, settings, print, firstPoint, update) {
|
||||||
let ops = {
|
let ops = {
|
||||||
addGCode,
|
addGCode,
|
||||||
camOut,
|
camOut,
|
||||||
|
clearTravelBounds() { setTravelBoundary() },
|
||||||
depthOutlinePath,
|
depthOutlinePath,
|
||||||
emitDrills,
|
emitDrills,
|
||||||
emitTraces,
|
emitTraces,
|
||||||
|
|
@ -866,6 +867,7 @@ export async function prepare_one(widget, settings, print, firstPoint, update) {
|
||||||
setSpindle,
|
setSpindle,
|
||||||
setTolerance,
|
setTolerance,
|
||||||
setTool,
|
setTool,
|
||||||
|
setTravelBoundary,
|
||||||
tip2tipEmit,
|
tip2tipEmit,
|
||||||
widget,
|
widget,
|
||||||
zSafe,
|
zSafe,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue