From f41d166199c46db602cc9b5a71261a5812b152da Mon Sep 17 00:00:00 2001 From: Stewart Allen Date: Wed, 11 Nov 2020 15:38:14 -0500 Subject: [PATCH] fix 0/1 bucket slicing in slicer2 --- src/kiri/slicer2.js | 2 +- src/mode/cam/slice.js | 2 ++ src/mode/cam/topo.js | 4 +++- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/kiri/slicer2.js b/src/kiri/slicer2.js index e2cc75a0..ce83376e 100644 --- a/src/kiri/slicer2.js +++ b/src/kiri/slicer2.js @@ -194,7 +194,7 @@ lines = [], zScale = this.zScale, buckets = this.buckets, - bucket = buckets.length ? buckets[Math.floor(z * zScale)] : points; + bucket = buckets.length ? buckets[Math.floor(z * zScale)] : this.points; if (onflat) { z += flatoff; diff --git a/src/mode/cam/slice.js b/src/mode/cam/slice.js index a85c6e1f..3fe2aff9 100644 --- a/src/mode/cam/slice.js +++ b/src/mode/cam/slice.js @@ -223,6 +223,8 @@ } }); + if (!offset) return; + // add outside pass if not inside only if (!insideOnly) { const outside = POLY.offset(shadow, roughToolDiam * proc.camRoughOver, {z: slice.z}); diff --git a/src/mode/cam/topo.js b/src/mode/cam/topo.js index 70340495..8add3c4e 100644 --- a/src/mode/cam/topo.js +++ b/src/mode/cam/topo.js @@ -293,10 +293,12 @@ stepsTotal += sindex.length * 2; if (proc.camContourXOn) stepsTotal += (maxX-minX) / toolStep; if (proc.camContourYOn) stepsTotal += (maxY-minY) / toolStep; + let slices = slicer.slice(sindex, { each: (data, index, total) => { onupdate(++stepsTaken, stepsTotal, "topo slice"); }, genso: true }); - processSlices(slices.map(data => data.slice)); + + processSlices(slices.filter(s => s.lines).map(data => data.slice)); } }