From ce57120036cff60c5c3e00538767550531a828ba Mon Sep 17 00:00:00 2001 From: Stewart Allen Date: Tue, 12 Jan 2021 08:01:34 -0500 Subject: [PATCH] add tab support to trace follow op --- notes.md | 1 + src/mode/cam/ops.js | 16 +++++++++++++--- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/notes.md b/notes.md index d4c62ab0..ab164b6c 100644 --- a/notes.md +++ b/notes.md @@ -50,6 +50,7 @@ # CAM +* `B` path routing with tabs sometimes makes no sense * `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` non-clear-voids duplicates thru-holes diff --git a/src/mode/cam/ops.js b/src/mode/cam/ops.js index cb68b16d..98950865 100644 --- a/src/mode/cam/ops.js +++ b/src/mode/cam/ops.js @@ -683,9 +683,10 @@ slice(progress) { let { op, state } = this; - let { settings, widget, sliceAll, updateToolDiams, zMax } = state; - let { process } = settings; 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 let sliceOut = this.sliceOut = []; let areas = op.areas[widget.id] || []; @@ -694,6 +695,11 @@ let cutdir = process.camConventional; let polys = []; updateToolDiams(toolDiam); + if (tabs) { + tabs.forEach(tab => { + tab.off = POLY.expand([tab.poly], toolDiam / 2).flat(); + }); + } for (let arr of areas) { let poly = newPolygon().fromArray(arr); POLY.setWinding([ poly ], cutdir, false); @@ -708,7 +714,11 @@ function followZ(poly) { let slice = newSliceOut(poly.getZ()); slice.camTrace = { tool, rate, plunge }; - slice.camLines = [ poly ]; + if (tabs) { + slice.camLines = cutTabs(tabs, [poly], poly.getZ()); + } else { + slice.camLines = [ poly ]; + } slice.output() .setLayer("follow", {line: 0xaa00aa}, false) .addPolys(slice.camLines)