add optional z step down to level op
This commit is contained in:
parent
a86d92d1a6
commit
727e61ad9c
3 changed files with 40 additions and 30 deletions
|
|
@ -422,9 +422,10 @@ export const conf = {
|
||||||
camLevelTool: 1000,
|
camLevelTool: 1000,
|
||||||
camLevelSpindle: 1000,
|
camLevelSpindle: 1000,
|
||||||
camLevelOver: 0.75,
|
camLevelOver: 0.75,
|
||||||
|
camLevelStepZ: 0,
|
||||||
camLevelSpeed: 1000,
|
camLevelSpeed: 1000,
|
||||||
camLevelDown: 0,
|
camLevelDown: 0,
|
||||||
camLevelOver: 0.5,
|
camLevelInset: 0.5,
|
||||||
camLevelStock: true,
|
camLevelStock: true,
|
||||||
camRoughTool: 1000,
|
camRoughTool: 1000,
|
||||||
camRoughSpindle: 1000,
|
camRoughSpindle: 1000,
|
||||||
|
|
|
||||||
|
|
@ -195,18 +195,20 @@ export function createPopOps() {
|
||||||
tool: 'camLevelTool',
|
tool: 'camLevelTool',
|
||||||
spindle: 'camLevelSpindle',
|
spindle: 'camLevelSpindle',
|
||||||
step: 'camLevelOver',
|
step: 'camLevelOver',
|
||||||
|
stepz: 'camLevelStepZ',
|
||||||
rate: 'camLevelSpeed',
|
rate: 'camLevelSpeed',
|
||||||
down: 'camLevelDown',
|
down: 'camLevelDown',
|
||||||
over: 'camLevelOver',
|
inset: 'camLevelInset',
|
||||||
stock: 'camLevelStock'
|
stock: 'camLevelStock'
|
||||||
}).inputs = {
|
}).inputs = {
|
||||||
tool: UC.newSelect(LANG.cc_tool, {}, "tools"),
|
tool: UC.newSelect(LANG.cc_tool, {}, "tools"),
|
||||||
sep: UC.newBlank({ class: "pop-sep" }),
|
sep: UC.newBlank({ class: "pop-sep" }),
|
||||||
spindle: UC.newInput(LANG.cc_spnd_s, { title: LANG.cc_spnd_l, convert: UC.toInt, show: hasSpindle }),
|
spindle: UC.newInput(LANG.cc_spnd_s, { title: LANG.cc_spnd_l, convert: UC.toInt, show: hasSpindle }),
|
||||||
step: UC.newInput(LANG.cc_sovr_s, { title: LANG.cc_sovr_l, convert: UC.toFloat, bound: UC.bound(0.01, 1.0) }),
|
step: UC.newInput(LANG.cc_sovr_s, { title: LANG.cc_sovr_l, convert: UC.toFloat, bound: UC.bound(0.01, 1.0) }),
|
||||||
|
stepz: UC.newInput(LANG.cc_sdwn_s, { title: LANG.cc_sdwn_l, convert: UC.toFloat, bound: UC.bound(0, 100.0) }),
|
||||||
rate: UC.newInput(LANG.cc_feed_s, { title: LANG.cc_feed_l, convert: UC.toInt, units: true }),
|
rate: UC.newInput(LANG.cc_feed_s, { title: LANG.cc_feed_l, convert: UC.toInt, units: true }),
|
||||||
down: UC.newInput(LANG.cc_loff_s, { title: LANG.cc_loff_l, convert: UC.toFloat, units: true }),
|
down: UC.newInput(LANG.cc_loff_s, { title: LANG.cc_loff_l, convert: UC.toFloat, units: true }),
|
||||||
over: UC.newInput(LANG.cc_lxyo_s, { title: LANG.cc_lxyo_l, convert: UC.toFloat, units: true }),
|
inset: UC.newInput(LANG.cc_lxyo_s, { title: LANG.cc_lxyo_l, convert: UC.toFloat, units: true, show: () => !env.popOp.level.rec.stock }),
|
||||||
sep: UC.newBlank({ class: "pop-sep" }),
|
sep: UC.newBlank({ class: "pop-sep" }),
|
||||||
stock: UC.newBoolean(LANG.cc_lsto_s, undefined, { title: LANG.cc_lsto_l }),
|
stock: UC.newBoolean(LANG.cc_lsto_s, undefined, { title: LANG.cc_lsto_l }),
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@ import { Tool } from './tool.js';
|
||||||
import { newPolygon } from '../../../geo/polygon.js';
|
import { newPolygon } from '../../../geo/polygon.js';
|
||||||
import { polygons as POLY } from '../../../geo/polygons.js';
|
import { polygons as POLY } from '../../../geo/polygons.js';
|
||||||
import { newSlice } from '../../core/slice.js';
|
import { newSlice } from '../../core/slice.js';
|
||||||
|
import { util } from '../../../geo/base.js';
|
||||||
|
|
||||||
class OpLevel extends CamOp {
|
class OpLevel extends CamOp {
|
||||||
constructor(state, op) {
|
constructor(state, op) {
|
||||||
|
|
@ -13,55 +14,61 @@ class OpLevel extends CamOp {
|
||||||
|
|
||||||
async slice(progress) {
|
async slice(progress) {
|
||||||
let { op, state } = this;
|
let { op, state } = this;
|
||||||
let { settings, widget, addSlices } = state;
|
let { settings, addSlices, updateToolDiams } = state;
|
||||||
let { updateToolDiams, tabs, cutTabs } = state;
|
let { zMax, ztOff, color, tshadow } = state;
|
||||||
let { bounds, zMax, ztOff, color, tshadow } = state;
|
|
||||||
let { stock } = settings;
|
let { stock } = settings;
|
||||||
|
|
||||||
let toolDiam = new Tool(settings, op.tool).fluteDiameter();
|
let toolDiam = new Tool(settings, op.tool).fluteDiameter();
|
||||||
let stepOver = this.stepOver = toolDiam * op.step;
|
let stepOver = this.stepOver = toolDiam * op.step;
|
||||||
let z = zMax + ztOff - op.down;
|
let zTop = zMax + ztOff;
|
||||||
|
let zBot = zTop - op.down;
|
||||||
|
let zList = op.stepz ? util.lerp(zTop, zBot, op.stepz) : [ zBot ];
|
||||||
|
|
||||||
updateToolDiams(toolDiam);
|
updateToolDiams(toolDiam);
|
||||||
|
|
||||||
let points = [];
|
let points = [];
|
||||||
let clear = op.stock ?
|
let clear = op.stock ?
|
||||||
[ newPolygon().centerRectangle({x:0,y:0,z:0}, stock.x, stock.y) ] :
|
[ newPolygon().centerRectangle({x:0,y:0,z:0}, stock.x, stock.y) ] :
|
||||||
POLY.outer(POLY.offset(tshadow, toolDiam * (op.over || 0)));
|
POLY.outer(POLY.offset(tshadow, toolDiam * (op.inset || 0)));
|
||||||
|
|
||||||
POLY.fillArea(clear, 90, stepOver, points);
|
POLY.fillArea(clear, 90, stepOver, points);
|
||||||
|
|
||||||
let lines = this.lines = [];
|
let layers = this.layers = [];
|
||||||
for (let i=0; i<points.length; i += 2) {
|
for (let z of zList) {
|
||||||
let slice = newSlice(z);
|
let lines = [];
|
||||||
lines.push( newPolygon().setOpen().addPoints([ points[i], points[i+1] ]).setZ(z) );
|
layers.push(lines);
|
||||||
slice.output()
|
for (let i=0; i<points.length; i += 2) {
|
||||||
.setLayer("level", {face: color, line: color})
|
let slice = newSlice(z);
|
||||||
.addPolys(this.lines);
|
lines.push( newPolygon().setOpen().addPoints([ points[i], points[i+1] ]).setZ(z) );
|
||||||
addSlices(slice);
|
slice.output()
|
||||||
|
.setLayer("level", {face: color, line: color})
|
||||||
|
.addPolys(lines);
|
||||||
|
addSlices(slice);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
prepare(ops, progress) {
|
prepare(ops, progress) {
|
||||||
let { op, state, lines, stepOver } = this;
|
let { op, layers, stepOver } = this;
|
||||||
let { setTool, setSpindle, printPoint, setPrintPoint } = ops;
|
let { setTool, setSpindle, printPoint, setPrintPoint } = ops;
|
||||||
let { polyEmit, newLayer, tip2tipEmit, camOut } = ops;
|
let { newLayer, tip2tipEmit, camOut } = ops;
|
||||||
|
|
||||||
setTool(op.tool, op.rate);
|
setTool(op.tool, op.rate);
|
||||||
setSpindle(op.spindle);
|
setSpindle(op.spindle);
|
||||||
lines = lines.map(p => { return { first: p.first(), last: p.last(), poly: p } });
|
for (let lines of layers) {
|
||||||
printPoint = tip2tipEmit(lines, printPoint, (el, point, count) => {
|
lines = lines.map(p => { return { first: p.first(), last: p.last(), poly: p } });
|
||||||
let poly = el.poly;
|
printPoint = tip2tipEmit(lines, printPoint, (el, point, count) => {
|
||||||
if (poly.last() === point) {
|
let poly = el.poly;
|
||||||
poly.reverse();
|
if (poly.last() === point) {
|
||||||
}
|
poly.reverse();
|
||||||
poly.forEachPoint((point, pidx) => {
|
}
|
||||||
camOut(point.clone(), true, stepOver);
|
poly.forEachPoint((point, pidx) => {
|
||||||
}, false);
|
camOut(point.clone(), true, stepOver);
|
||||||
});
|
}, false);
|
||||||
|
});
|
||||||
|
newLayer();
|
||||||
|
}
|
||||||
setPrintPoint(printPoint);
|
setPrintPoint(printPoint);
|
||||||
|
|
||||||
newLayer();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue