diff --git a/src/geo/polygon.js b/src/geo/polygon.js index 8ff28826..9338031d 100644 --- a/src/geo/polygon.js +++ b/src/geo/polygon.js @@ -1306,6 +1306,15 @@ if (clip.Execute(ctyp.ctUnion, ctre, cfil.pftEvenOdd, cfil.pftEvenOdd)) { let union = POLY().fromClipperTreeUnion(ctre, poly.getZ(), minarea); if (all) { + if (union.length === 2) { + // TODO look for faster equivalence check. area? perimeter? + let src = [this, poly].sort((a,b) => { return a.area() - b.area() }); + let dst = union.sort((a,b) => { return a.area() - b.area() }); + if (src[0].isEquivalent(dst[0]) && src[1].isEquivalent(dst[1])) { + return null; + } + return union; + } return union; } if (union.length === 1) { @@ -1313,7 +1322,7 @@ union.fillang = fillang; return union; } else { - console.log({check_union_call_path: union}); + console.log({check_union_call_path: union, this: this, poly}); } } diff --git a/src/kiri/print.js b/src/kiri/print.js index 969ddb04..8679da3e 100644 --- a/src/kiri/print.js +++ b/src/kiri/print.js @@ -1064,8 +1064,8 @@ // - it has more than one sibling // - it has no parent (top/outer most) // - it is offset from its parent by more than diameter - // if (poly.isOpen() || !poly.parent || poly.parent.innerCount() > 1 || !polygonWithinOffset(poly, poly.parent, offset)) { - if (poly.depth === 0) { + if (poly.isOpen() || !poly.parent || poly.parent.innerCount() > 1 || !polygonWithinOffset(poly, poly.parent, offset)) { + // if (poly.depth === 0) { pools.push(poly); poly.pool = []; poly.poolsDown = []; diff --git a/src/mode/cam/driver.js b/src/mode/cam/driver.js index 0f5932ed..0a7d1716 100644 --- a/src/mode/cam/driver.js +++ b/src/mode/cam/driver.js @@ -673,7 +673,6 @@ let flat = POLY.flatten(offset, [], true); offset = POLY.setZ(POLY.nest(flat), slice.z); - // slice.tops[0].inner = offset; // inset offset array by 1/2 diameter then by tool overlap % slice.tops[0].traces = @@ -1027,8 +1026,9 @@ data.shadow = shadow.clone(true); data.slice.camMode = CPRO.OUTLINE; data.slice.shadow = data.shadow; + // data.slice.tops[0].inner = shadow; slices.push(data.slice); - onupdate(0.2 + (index/total) * 0.1, "roughing"); + onupdate(0.2 + (index/total) * 0.1, "outlines"); }, genso: true }); shellOutline = tshadow;