rename sliceOutput to pocket
This commit is contained in:
parent
e71d8157a4
commit
2e046bd698
3 changed files with 15 additions and 14 deletions
|
|
@ -242,7 +242,7 @@ class OpPocket extends CamOp {
|
||||||
|
|
||||||
prepare(ops, progress) {
|
prepare(ops, progress) {
|
||||||
let { op, state, pockets } = this;
|
let { op, state, pockets } = this;
|
||||||
let { setTool, setSpindle, setTolerance, sliceOutput, getPrintPoint } = ops;
|
let { getPrintPoint , pocket, setTool, setSpindle, setTolerance } = ops;
|
||||||
let { process } = state.settings;
|
let { process } = state.settings;
|
||||||
|
|
||||||
setTool(op.tool, op.rate);
|
setTool(op.tool, op.rate);
|
||||||
|
|
@ -275,11 +275,12 @@ class OpPocket extends CamOp {
|
||||||
}
|
}
|
||||||
if (min.pocket) {
|
if (min.pocket) {
|
||||||
min.pocket.used = true;
|
min.pocket.used = true;
|
||||||
sliceOutput(min.pocket, {
|
pocket({
|
||||||
cutdir: op.ov_conv,
|
cutdir: op.ov_conv,
|
||||||
depthFirst: process.camDepthFirst && !state.isIndexed,
|
depthFirst: process.camDepthFirst && !state.isIndexed,
|
||||||
easeDown: op.down && process.easeDown ? op.down : 0,
|
easeDown: op.down && process.easeDown ? op.down : 0,
|
||||||
progress: (n,m) => progress(n/m, "pocket")
|
progress: (n,m) => progress(n/m, "pocket"),
|
||||||
|
slices: min.pocket
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
break;
|
break;
|
||||||
|
|
|
||||||
|
|
@ -297,7 +297,7 @@ class OpRough extends CamOp {
|
||||||
|
|
||||||
prepare(ops, progress) {
|
prepare(ops, progress) {
|
||||||
let { op, state, sliceOut, camFaces } = this;
|
let { op, state, sliceOut, camFaces } = this;
|
||||||
let { setTool, setSpindle, setPrintPoint, sliceOutput, polyEmit, newLayer, printPoint } = ops;
|
let { setTool, setSpindle, setPrintPoint, pocket, polyEmit, newLayer, printPoint } = ops;
|
||||||
let { settings } = state;
|
let { settings } = state;
|
||||||
let { process } = settings;
|
let { process } = settings;
|
||||||
|
|
||||||
|
|
@ -331,11 +331,12 @@ class OpRough extends CamOp {
|
||||||
|
|
||||||
// output the roughing passes
|
// output the roughing passes
|
||||||
setPrintPoint(printPoint);
|
setPrintPoint(printPoint);
|
||||||
sliceOutput(sliceOut, {
|
pocket({
|
||||||
cutdir,
|
cutdir,
|
||||||
depthFirst,
|
depthFirst,
|
||||||
easeDown: op.down && easeDown ? 0.001 : 0,
|
easeDown: op.down && easeDown ? 0.001 : 0,
|
||||||
progress: (n,m) => progress(n/m, "routing")
|
progress: (n,m) => progress(n/m, "routing"),
|
||||||
|
slices: sliceOut
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -554,16 +554,15 @@ export function prepEach(widget, settings, print, firstPoint, update) {
|
||||||
* output an array of slices that form a pocket
|
* output an array of slices that form a pocket
|
||||||
* used by rough and pocket ops, does not support arcs
|
* used by rough and pocket ops, does not support arcs
|
||||||
*
|
*
|
||||||
* @param {Slice[]} top-down Z stack of slices
|
* @param {Slice[]} slices top-down Z stack of slices
|
||||||
* @param {*} opts
|
* @param {boolean} cutdir true=CW false=CCW
|
||||||
|
* @param {boolean} depthFirst prioritize cut depth in pockets by nesting
|
||||||
*/
|
*/
|
||||||
function sliceOutput(sliceOut, opts = {}) {
|
function pocket({ slices, cutdir, depthFirst, easeDown, progress }) {
|
||||||
const { cutdir, depthFirst, easeDown, progress } = opts;
|
|
||||||
|
|
||||||
let total = 0;
|
let total = 0;
|
||||||
let depthData = [];
|
let depthData = [];
|
||||||
|
|
||||||
for (let slice of sliceOut) {
|
for (let slice of slices) {
|
||||||
let polys = [], t = [], c = [];
|
let polys = [], t = [], c = [];
|
||||||
POLY.flatten(slice.camLines).forEach(function (poly) {
|
POLY.flatten(slice.camLines).forEach(function (poly) {
|
||||||
let child = poly.parent;
|
let child = poly.parent;
|
||||||
|
|
@ -590,7 +589,7 @@ export function prepEach(widget, settings, print, firstPoint, update) {
|
||||||
}, { swapdir: false });
|
}, { swapdir: false });
|
||||||
newLayer();
|
newLayer();
|
||||||
}
|
}
|
||||||
progress(++total, sliceOut.length);
|
progress(++total, slices.length);
|
||||||
}
|
}
|
||||||
|
|
||||||
// crucially returns true for -0 as well as other negative #s
|
// crucially returns true for -0 as well as other negative #s
|
||||||
|
|
@ -695,6 +694,7 @@ export function prepEach(widget, settings, print, firstPoint, update) {
|
||||||
getPrintPoint() { return printPoint },
|
getPrintPoint() { return printPoint },
|
||||||
lastPoint: () => { return lastPoint },
|
lastPoint: () => { return lastPoint },
|
||||||
newLayer,
|
newLayer,
|
||||||
|
pocket,
|
||||||
poly2polyEmit,
|
poly2polyEmit,
|
||||||
polyEmit,
|
polyEmit,
|
||||||
printPoint,
|
printPoint,
|
||||||
|
|
@ -704,7 +704,6 @@ export function prepEach(widget, settings, print, firstPoint, update) {
|
||||||
setSpindle,
|
setSpindle,
|
||||||
setTolerance,
|
setTolerance,
|
||||||
setTool,
|
setTool,
|
||||||
sliceOutput,
|
|
||||||
stock,
|
stock,
|
||||||
tip2tipEmit,
|
tip2tipEmit,
|
||||||
zclear,
|
zclear,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue