fix pocket outline only with thru holes

This commit is contained in:
Stewart Allen 2025-02-28 23:25:52 -05:00
commit 6ead32637e
2 changed files with 11 additions and 4 deletions

View file

@ -41,6 +41,7 @@ const ClipperLib = self.ClipperLib,
;
const POLYS = base.polygons = {
clearInner,
rayIntersect,
alignWindings,
setWinding,
@ -104,6 +105,12 @@ function setZ(polys, z) {
return polys;
}
function clearInner(polys) {
for (let p of polys) {
p.clearInner();
}
}
function toClipper(polys = []) {
let out = [];
for (let poly of polys) {

View file

@ -1242,7 +1242,6 @@ class OpPocket extends CamOp {
return slice;
}
function clearZ(polys, z, down) {
// console.log({ clearZ: polys });
if (down) {
// adjust step down to a value <= down that
// ends on the lowest z specified
@ -1275,6 +1274,9 @@ class OpPocket extends CamOp {
shadow = POLY.setZ(POLY.offset(POLY.offset(shadow, smooth), -smooth), z);
}
POLY.subtract([ poly ], shadow, clip, undefined, undefined, 0);
if (op.outline) {
POLY.clearInner(clip);
}
}
if (clip.length === 0) {
continue;
@ -1343,9 +1345,7 @@ class OpPocket extends CamOp {
if (outline.length) {
// option to skip interior features (holes, pillars)
if (op.outline) {
for (let p of outline) {
p.inner = undefined;
}
POLY.clearInner(outline);
}
if (debug) newSliceOut(zmin).output()
.setLayer("pocket area", {line: 0x1188ff}, false)