add tab support to trace follow op

This commit is contained in:
Stewart Allen 2021-01-12 08:01:34 -05:00
commit ce57120036
2 changed files with 14 additions and 3 deletions

View file

@ -50,6 +50,7 @@
# CAM # CAM
* `B` path routing with tabs sometimes makes no sense
* `B` clicking on a pop-op should pin it until clicked or [esc] * `B` clicking on a pop-op should pin it until clicked or [esc]
* `B` need to force cut line at synthetic z bottom (midlines, etc) * `B` need to force cut line at synthetic z bottom (midlines, etc)
* `B` non-clear-voids duplicates thru-holes * `B` non-clear-voids duplicates thru-holes

View file

@ -683,9 +683,10 @@
slice(progress) { slice(progress) {
let { op, state } = this; let { op, state } = this;
let { settings, widget, sliceAll, updateToolDiams, zMax } = state;
let { process } = settings;
let { tool, rate, down, plunge, offset } = op; let { tool, rate, down, plunge, offset } = op;
let { settings, widget, sliceAll, zMax, tabs } = state;
let { updateToolDiams, cutTabs } = state;
let { process } = settings;
// generate tracing offsets from chosen features // generate tracing offsets from chosen features
let sliceOut = this.sliceOut = []; let sliceOut = this.sliceOut = [];
let areas = op.areas[widget.id] || []; let areas = op.areas[widget.id] || [];
@ -694,6 +695,11 @@
let cutdir = process.camConventional; let cutdir = process.camConventional;
let polys = []; let polys = [];
updateToolDiams(toolDiam); updateToolDiams(toolDiam);
if (tabs) {
tabs.forEach(tab => {
tab.off = POLY.expand([tab.poly], toolDiam / 2).flat();
});
}
for (let arr of areas) { for (let arr of areas) {
let poly = newPolygon().fromArray(arr); let poly = newPolygon().fromArray(arr);
POLY.setWinding([ poly ], cutdir, false); POLY.setWinding([ poly ], cutdir, false);
@ -708,7 +714,11 @@
function followZ(poly) { function followZ(poly) {
let slice = newSliceOut(poly.getZ()); let slice = newSliceOut(poly.getZ());
slice.camTrace = { tool, rate, plunge }; slice.camTrace = { tool, rate, plunge };
slice.camLines = [ poly ]; if (tabs) {
slice.camLines = cutTabs(tabs, [poly], poly.getZ());
} else {
slice.camLines = [ poly ];
}
slice.output() slice.output()
.setLayer("follow", {line: 0xaa00aa}, false) .setLayer("follow", {line: 0xaa00aa}, false)
.addPolys(slice.camLines) .addPolys(slice.camLines)