add clip-to-stock for roughing and outlines

This commit is contained in:
Stewart Allen 2021-01-06 12:32:32 -05:00
commit 7aee1b19a5
7 changed files with 31 additions and 7 deletions

View file

@ -105,6 +105,7 @@
bounds,
tabs,
cutTabs,
cutPolys,
slicer,
sliceAll,
updateToolDiams,
@ -265,10 +266,15 @@
return true;
};
function cutTabs(tabs, offset, z) {
let noff = [];
function cutTabs(tabs, offset, z, inter) {
tabs = tabs.filter(tab => z < tab.pos.z + tab.dim.z/2).map(tab => tab.off).flat();
offset.forEach(op => noff.appendAll( op.cut(POLY.union(tabs, 0, true)) ));
return cutPolys(tabs, offset, z, false);
}
function cutPolys(polys, offset, z, inter) {
let noff = [];
// tabs = tabs.filter(tab => z < tab.pos.z + tab.dim.z/2).map(tab => tab.off).flat();
offset.forEach(op => noff.appendAll( op.cut(POLY.union(polys, 0, true), inter) ));
if (noff.length > 1) {
let heal = 0;
// heal/rejoin open segments that share endpoints