From 8a29428f787c208b7e7432b437082a6a4e657b5c Mon Sep 17 00:00:00 2001 From: Stewart Allen Date: Sat, 28 Nov 2020 00:07:38 -0500 Subject: [PATCH] fix inside tabs. add tabs to shadow so moves always avoid them --- notes.md | 2 +- src/mode/cam/slice.js | 28 ++++++++++++++++++++++------ 2 files changed, 23 insertions(+), 7 deletions(-) diff --git a/notes.md b/notes.md index 256c4d8e..3564a92d 100644 --- a/notes.md +++ b/notes.md @@ -23,7 +23,6 @@ ## `C` cosmetic, `F` functional, `P` performance, `B` bug fix -* `F` image import borders * `F` mesh / stl export (like w/ images, rotate, scale, future cleanup ops) * `F` detect and report slow framerates * `F` right click / context menu (object deletion, etc) @@ -72,6 +71,7 @@ * `B` outside cutting direction in roughing mode inverted * `B` clear voids has double interior pass because wrong offset shadow used * `B` top clearing operations should use linear, not offset, passes +* `F` animation should clear the mesh in areas where the cuts go through the stock? * `F` switch z top offset to an z anchor (top/bottom) + offset * `F` use 3 registration holes to prevent rotation accidents (midline offset one axis) * `F` parameterize dropping close points in prep.js. ensure long segments remain straight diff --git a/src/mode/cam/slice.js b/src/mode/cam/slice.js index 272a2251..b2b6a5d5 100644 --- a/src/mode/cam/slice.js +++ b/src/mode/cam/slice.js @@ -306,15 +306,16 @@ const outside = POLY.offset(shadow.clone(), roughToolDiam * proc.camRoughOver, {z: slice.z}); if (outside) { offset.appendAll(outside); - if (tabs) { - tabs.forEach(tab => { - tab.off = POLY.expand([tab.poly], roughToolDiam / 2).flat(); - }); - offset = cutTabs(tabs, offset, slice.z); - } } } + if (tabs) { + tabs.forEach(tab => { + tab.off = POLY.expand([tab.poly], roughToolDiam / 2).flat(); + }); + offset = cutTabs(tabs, offset, slice.z); + } + if (!offset) return; slice.camLines = offset; @@ -477,6 +478,21 @@ sliceAll.forEach((slice, index) => slice.index = index); // used in printSetup() + // used in CAM.prepare.getZClearPath() + // add tabs to terrain tops so moves avoid them + if (tabs) { + terrain.forEach(slab => { + tabs.forEach(tab => { + if (tab.pos.z + tab.dim.z/2 >= slab.z) { + let all = [...slab.tops, tab.poly]; + slab.tops = POLY.union(all, 0, true); + // slab.slice.output() + // .setLayer("debug-tabs", {line: 0x880088, thin: true }) + // .addPolys(POLY.setZ(slab.tops.clone(true), slab.z), { thin: true }); + } + }); + }); + } widget.terrain = terrain; widget.maxToolDiam = maxToolDiam;