From 4489b37b2380959b36c474babe599ac1cf9b6b8e Mon Sep 17 00:00:00 2001 From: Stewart Allen Date: Wed, 15 Apr 2020 09:09:15 -0400 Subject: [PATCH] fix cases of direct slice through horizontal line or plane --- js/kiri-slicer.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/js/kiri-slicer.js b/js/kiri-slicer.js index 9925f7f2..45c97d6e 100644 --- a/js/kiri-slicer.js +++ b/js/kiri-slicer.js @@ -141,7 +141,7 @@ var gs_kiri_slicer = exports; countZ(p2.z); countZ(p3.z); } - if (options.cam) { + if (true || options.cam) { if (p1.z === p2.z && p2.z === p3.z && p1.z > bounds.min.z) { // auto-detect flats for cam faces and to avoid slicing directly on flats var zkey = p1.z.toFixed(5), @@ -151,7 +151,7 @@ var gs_kiri_slicer = exports; } else { zFlat[zkey] += area; } - } else if (options.trace) { + } else if (true || options.trace) { // detect zLines (curved region tops/bottoms) // mark these layers for ball mills only if (p1.z === p2.z && p1.z > bounds.min.z) { @@ -316,6 +316,10 @@ var gs_kiri_slicer = exports; // create a Slice for each z offset in the zIndexes array for (var i = 0; i < zIndexes.length; i++) { + let ik = zIndexes[i].toFixed(5); + // ensure no slice through horizontal lines or planes + if (zFlat[ik]) zIndexes[i] -= 0.001; + if (zLines[ik]) zIndexes[i] -= 0.001; // slice next layer and add to slices[] array sliceZ(zIndexes[i], zHeights[i]); onupdate(i / zIndexes.length);