cam: add zsafe and move to safe z at start of new operation
This commit is contained in:
parent
eb67e1976d
commit
5ac8c63d54
3 changed files with 23 additions and 13 deletions
|
|
@ -14,8 +14,8 @@ class OpDrill extends CamOp {
|
|||
async slice(progress) {
|
||||
let { op, state } = this;
|
||||
let { settings, addSlices, widget, updateToolDiams } = state;
|
||||
let { zBottom, zThru, thruHoles, color } = state;
|
||||
let { drills, drillThrough } = op
|
||||
let { color } = state;
|
||||
let { drills } = op
|
||||
|
||||
let drillTool = new Tool(settings, op.tool),
|
||||
drillToolDiam = drillTool.fluteDiameter(),
|
||||
|
|
@ -55,11 +55,10 @@ class OpDrill extends CamOp {
|
|||
}
|
||||
|
||||
prepare(ops, progress) {
|
||||
let { op, state } = this;
|
||||
let { settings, widget, addSlices, updateToolDiams } = state;
|
||||
let { op } = this;
|
||||
let { setTool, setSpindle, setDrill, emitDrills } = ops;
|
||||
setTool(op.tool, undefined, op.rate);
|
||||
setDrill(op.down, op.lift, op.dwell, op.thru);
|
||||
setDrill(op.down, op.lift, op.dwell);
|
||||
setSpindle(op.spindle);
|
||||
emitDrills(this.sliceOut.map(slice => slice.camLines).flat());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -56,8 +56,7 @@ export function prepEach(widget, settings, print, firstPoint, update) {
|
|||
|
||||
if (widget.camops.length === 0 || widget.meta.disabled) return;
|
||||
|
||||
let device = settings.device,
|
||||
process = settings.process,
|
||||
let { device, process } = settings,
|
||||
isIndexed = process.camStockIndexed,
|
||||
startCenter = process.camOriginCenter,
|
||||
alignTop = settings.controller.alignTop,
|
||||
|
|
@ -65,7 +64,7 @@ export function prepEach(widget, settings, print, firstPoint, update) {
|
|||
stockz = stock.z * (isIndexed ? 0.5 : 1),
|
||||
outer = settings.bounds || widget.getPositionBox(),
|
||||
outerz = outer.max.z,
|
||||
slices = widget.slices,
|
||||
// slices = widget.slices,
|
||||
zclear = (process.camZClearance || 1),
|
||||
zmax_force = process.camForceZMax || false,
|
||||
zmax_outer = stockz + zclear,
|
||||
|
|
@ -75,13 +74,14 @@ export function prepEach(widget, settings, print, firstPoint, update) {
|
|||
boundsz = isIndexed ? stock.z / 2 : bounds.max.z + ztOff,
|
||||
zadd = !isIndexed ? stock.z - boundsz : alignTop ? outerz - boundsz : 0,
|
||||
zmax = outerz + zclear + (process.camOriginOffZ || 0),
|
||||
zsafe = isIndexed ? Math.hypot(bounds.dim.y, bounds.dim.z) / 2 + zclear : zmax,
|
||||
wmpos = widget.track.pos,
|
||||
wmx = wmpos.x,
|
||||
wmy = wmpos.y,
|
||||
originx = (startCenter ? 0 : -stock.x / 2) + (process.camOriginOffX || 0),
|
||||
originy = (startCenter ? 0 : -stock.y / 2) + (process.camOriginOffY || 0),
|
||||
origin = newPoint(originx + wmx, originy + wmy, zmax),
|
||||
output = print.output,
|
||||
// output = print.output,
|
||||
easeDown = process.camEaseDown,
|
||||
easeAngle = process.camEaseAngle,
|
||||
depthFirst = process.camDepthFirst,
|
||||
|
|
@ -94,13 +94,12 @@ export function prepEach(widget, settings, print, firstPoint, update) {
|
|||
drillDown = 0,
|
||||
drillLift = 0,
|
||||
drillDwell = 0,
|
||||
drillThru = 0,
|
||||
lasering = false,
|
||||
laserPower = 0,
|
||||
newOutput = print.output || [],
|
||||
layerOut = [],
|
||||
printPoint,
|
||||
isNewMode,
|
||||
// isNewMode,
|
||||
isPocket,
|
||||
isContour,
|
||||
isRough,
|
||||
|
|
@ -188,11 +187,10 @@ export function prepEach(widget, settings, print, firstPoint, update) {
|
|||
laserPower = power;
|
||||
}
|
||||
|
||||
function setDrill(down, lift, dwell, thru) {
|
||||
function setDrill(down, lift, dwell) {
|
||||
drillDown = down;
|
||||
drillLift = lift;
|
||||
drillDwell = dwell;
|
||||
drillThru = thru;
|
||||
}
|
||||
|
||||
function emitDrills(polys) {
|
||||
|
|
@ -337,6 +335,17 @@ export function prepEach(widget, settings, print, firstPoint, update) {
|
|||
function camOut(point, emit = 1, opts) {
|
||||
let lop = lastOp;
|
||||
lastOp = currentOp;
|
||||
|
||||
// on operation changes:
|
||||
// 1. move to safe z of current point preserving angle
|
||||
// 2. move to safe z of new point preserving old angle
|
||||
// 3. move to safe z of new point with new angle
|
||||
if (lop !== currentOp && lastPoint) {
|
||||
camOut(lastPoint.clone().setZ(zsafe).setA(lastPoint.a), 1);
|
||||
camOut(point.clone().setZ(zsafe).setA(lastPoint.a), 1);
|
||||
camOut(point.clone().setZ(zsafe), 1);
|
||||
}
|
||||
|
||||
if (lop?.type === 'index' && lop !== currentOp ) {
|
||||
// console.log('post index first point', point);
|
||||
camOut(point.clone().setZ(lastPoint.z).setA(lastPoint.a), 1);
|
||||
|
|
@ -710,6 +719,7 @@ export function prepEach(widget, settings, print, firstPoint, update) {
|
|||
bounds,
|
||||
zclear,
|
||||
zmax,
|
||||
zsafe,
|
||||
lastPoint: () => { return lastPoint }
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -229,6 +229,7 @@ export class Topo {
|
|||
slices.push(slice);
|
||||
}
|
||||
} else {
|
||||
let { pointsPerLine } = strips[0];
|
||||
for (let i=0; i<pointsPerLine; i++) {
|
||||
let slice = newSlice(i);
|
||||
let points = rows.map(row => row[i]);
|
||||
|
|
|
|||
Loading…
Reference in a new issue