From bae6bd2d8e67cb2f46882a0e4f0514659d02e519 Mon Sep 17 00:00:00 2001 From: Stewart Allen Date: Wed, 7 Mar 2018 07:28:46 -0500 Subject: [PATCH] fix gcode generated height for adaptive slices --- js/kiri-slicer.js | 10 +++++----- js/license.js | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/js/kiri-slicer.js b/js/kiri-slicer.js index a9a7d9a8..b43df3af 100644 --- a/js/kiri-slicer.js +++ b/js/kiri-slicer.js @@ -209,6 +209,7 @@ var gs_kiri_slicer = exports; return b-a; }); } else if (zIncMin) { + // FDM adaptive slicing var zPos = zMin + zIncFirst, zOI = 0, zDelta, @@ -218,7 +219,7 @@ var gs_kiri_slicer = exports; nextZ; // first slice is fixed - zHeights.push(zPos); + zHeights.push(zIncFirst); zIndexes.push(zIncFirst / 2); while (zPos < zMax && zOI < zOrdered.length) { @@ -230,21 +231,20 @@ var gs_kiri_slicer = exports; zDivMin = Math.floor(zDelta / zIncMin); zDivMax = Math.floor(zDelta / zInc); - if (zDivMax) { + if (zDivMax && zDivMax < zDivMin) { zStep = zDelta / (zDivMax + 1); } else { zStep = zDelta; } while (zPos < nextZ) { - zHeights.push(zPos + zStep); + zHeights.push(zStep); zIndexes.push(zPos + zStep / 2); zPos += zStep; } } } else { - // FDM is the simplest case. Just offset and slice at - // predicable offsets. + // FDM fixed slicing if (options.firstHeight) { zIndexes.push(options.firstHeight / 2); zMin = options.firstHeight; diff --git a/js/license.js b/js/license.js index 23867065..710f48cf 100644 --- a/js/license.js +++ b/js/license.js @@ -1,7 +1,7 @@ var exports = { COPYRIGHT:"Copyright (C) 2014-2017 Stewart Allen - All Rights Reserved", LICENSE:"Unauthorized copying, modification and re-distribution are strictly prohibited without prior written consent.", - VERSION:"1.1.8" + VERSION:"1.1.8a" }; if (!module) var module = {}; module.exports = exports;