From 0d9e549da4fe43a3e1d9894bae681dfa59edb616 Mon Sep 17 00:00:00 2001 From: Stewart Allen Date: Mon, 16 May 2022 22:42:07 -0400 Subject: [PATCH] fix potential crash into stock when parts are z bottom anchored. fix fdm/cnc pmode check --- src/kiri-mode/cam/prepare.js | 4 ++-- src/kiri/function.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/kiri-mode/cam/prepare.js b/src/kiri-mode/cam/prepare.js index 7479284a..b7ddfb2f 100644 --- a/src/kiri-mode/cam/prepare.js +++ b/src/kiri-mode/cam/prepare.js @@ -307,11 +307,11 @@ function prepEach(widget, settings, print, firstPoint, update) { clearz = maxz; // up if any point between higher than start/outline, go up first if (mustGoUp) { - layerPush(lastPoint.clone().setZ(clearz), 0, 0, tool.getNumber()); + layerPush(lastPoint.clone().setZ(clearz + ztOff), 0, 0, tool.getNumber()); } // move to point above target point if (mustGoUp || point.z < maxz) { - layerPush(point.clone().setZ(clearz), 0, 0, tool.getNumber()); + layerPush(point.clone().setZ(clearz + ztOff), 0, 0, tool.getNumber()); // new pos for plunge calc deltaXY = 0; } diff --git a/src/kiri/function.js b/src/kiri/function.js index 5d3082b4..f08f17c6 100644 --- a/src/kiri/function.js +++ b/src/kiri/function.js @@ -239,7 +239,7 @@ function preparePreview(callback, scale = 1, offset = 0) { const { device, process, controller } = settings; if (complete.preview === feature.pmode) { - if (device.extruders.length > 1) { + if (device.extruders && device.extruders.length > 1) { if (++feature.pmode > 2) { feature.pmode = 1; }