diff --git a/src/mode/cam/driver.js b/src/mode/cam/driver.js index 0a7d1716..42c41236 100644 --- a/src/mode/cam/driver.js +++ b/src/mode/cam/driver.js @@ -228,68 +228,6 @@ SLICER.sliceWidget(widget, options, ondone, onupdate); } - /** - * top down progressive union - */ - function pancake(slices, onupdate) { - let union, tops, last; - - slices.forEach(function(slice,index) { - tops = slice.gatherTopPolys([]).clone(true); - if (!union) { - union = tops; - } else { - // replace slice's tops with unioned tops - tops.appendAll(union); - union = POLY.union(tops); - slice.tops = []; - union.forEach(function(poly) { - slice.addTop(poly); - poly.setZ(slice.z); - }); - } - last = slice; - if (onupdate) onupdate(index/slices.length); - }); - - return last.clone(false); - } - - /** - * bottom up progressive intersection of holes - */ - function holes(slices, offset, onupdate) { - let last; - - slices.slice().reverse().forEach(function(slice,index) { - let holes = slice.gatherTopPolyInners([]).clone(); - if (last) { - let inter = []; - // find intersection of hole below and hole in this layer - holes.forEach(hole => { - last.forEach(hole_under => { - inter.appendAll(hole.intersect(hole_under)); - }); - }); - // filter dup polygons (which intersect can produce) - last = inter.filter((poly, index, arr) => { - for (let i=index+1, il=arr.length; i s1.z) return; - let delta = Math.abs(s2.z - s1.z), - inc = delta / step, - nstep = step, - dec = inc - Math.floor(inc), - slop = step * 0.02; // allow 2% over/under on step alignment - // skip if delta close to step - if (Math.abs(delta - step) < slop) { - return; - } - // add another step if decimal too high - if (dec > slop) nstep = delta / Math.ceil(inc); - // find closest slices in-between - for (let zv = s1.z - nstep; zv >= s2.z + nstep/2; zv -= nstep) { - mid.push(closestSliceToZ(slices, zv)); - } - }, 1); - - forced.appendAll(mid); - forced.sort(function(s1, s2) { return s2.z - s1.z; }); - - // drop first/top slice. it's not an actual cut. it was - // added in the beginning to force layer interpolation. - forced = forced.slice(1); - forced.forEach(function(slice) { - emit(slice); - }); - - // add to output array - emitted.forEach(function(slice) { - output.push(slice); - }); - } - /** * @param {Widget} widget * @param {Object} settings @@ -977,10 +847,11 @@ sliceDrill(settings, widget, tslices, sliceAll); } - // creating roughing slices + // identify through holes + thruHoles = tshadow.map(p => p.inner || []).flat(); + + // create roughing slices if (procRough) { - // identify through holes - thruHoles = tshadow.map(p => p.inner || []).flat(); let shadow = []; let slices = []; @@ -1017,7 +888,7 @@ sliceAll.appendAll(slices); } - // creating outline slices + // create outline slices if (procOutline) { let shadow = []; let slices = [];