diff --git a/src/add/array.js b/src/add/array.js index 690823d4..3d7dbd14 100644 --- a/src/add/array.js +++ b/src/add/array.js @@ -34,9 +34,13 @@ * @param v * @returns {Array} */ - AP.append = function(v) { - this.push(v); - return this; + AP.append = function(v, flat) { + if (flat) { + return this.appendAll(v); + } else { + this.push(v); + return this; + } }; /** diff --git a/src/geo/polygons.js b/src/geo/polygons.js index 0735f0e6..d9b62c9f 100644 --- a/src/geo/polygons.js +++ b/src/geo/polygons.js @@ -520,17 +520,17 @@ // if specified, perform offset gap analysis if (opt.gaps && polys.length) { - let negoff = offset(polys, -offs, { + let oneg = offset(polys, -offs, { fill: opt.fill, join: opt.join, type: opt.type, z: opt.z, minArea: mina }); let suba = []; - let diff = subtract(orig, negoff, suba, null, zed); - opt.gaps.push(suba); + let diff = subtract(orig, oneg, suba, null, zed); + opt.gaps.append(suba, opt.flat); } // if offset fails, consider last polygons as gap areas if (opt.gaps && !polys.length) { - opt.gaps.push(orig); + opt.gaps.append(orig, opt.flat); } // if specified, perform up to *count* successive offsets @@ -538,7 +538,7 @@ // ensure opts has offset accumulator array opt.outs = opt.outs || []; // store polys in accumulator - opt.outs.push(polys); + opt.outs.append(polys, opt.flat); if (opt.count > 1) { // decrement count, increment depth opt.count--; diff --git a/src/kiri/conf.js b/src/kiri/conf.js index ec5ffc53..e9452959 100644 --- a/src/kiri/conf.js +++ b/src/kiri/conf.js @@ -437,7 +437,7 @@ camTabsOn: false, camRoughPocket: false, // camPocketOnlyRough camOutlinePocket: false, // camPocketOnlyFinish - camDepthFirst: true, + camDepthFirst: false, camWideCutout: false, camEaseDown: false, camOriginTop: true, diff --git a/src/mode/cam/driver.js b/src/mode/cam/driver.js index b2be8b4b..b8fe841e 100644 --- a/src/mode/cam/driver.js +++ b/src/mode/cam/driver.js @@ -693,10 +693,12 @@ } // clone and flatten the shell with tops to offset array - shell.clone(true).forEach(function(poly) { poly.setZ(slice.z).flattenTo(offset) }); + shell.clone(true).forEach(function(poly) { + poly.setZ(slice.z).flattenTo(offset); + }); POLY.flatten(tops, offset, true); - // only tab cut polys should be open + // only tab cut polys should be open (happens later) offset.forEach(function(trace) { trace.setClosed(); }); @@ -705,7 +707,12 @@ offset = POLY.nest(offset); // inset offset array by 1/2 diameter then by tool overlap % - POLY.expand(offset, - (diameter / 2 + stock), slice.z, outer, 0, -diameter * overlap); + POLY.offset(offset, [-(diameter / 2 + stock), -diameter * overlap], { + z: slice.z, + count: 999, + flat: true, + outs: outer + }); if (!pocket) { // re-flatten offset polys @@ -718,7 +725,7 @@ // re-nest offset polys // outer = POLY.nest(offset); outer = offset; - // more outer + // add another wider pass to the cutout polygon(s) if (widecut) { POLY.expand(offset, diameter * overlap, slice.z, outer, 1); }