From 1fcc2405a099fceb50409c2e00f470c779a01744 Mon Sep 17 00:00:00 2001 From: Stewart Allen Date: Sun, 29 Jun 2025 12:21:14 -0400 Subject: [PATCH] fix open but really closed traced, prevent slice on null stock --- src/kiri-mode/cam/slice.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/kiri-mode/cam/slice.js b/src/kiri-mode/cam/slice.js index f7c79fdf..7e97fc32 100644 --- a/src/kiri-mode/cam/slice.js +++ b/src/kiri-mode/cam/slice.js @@ -134,6 +134,10 @@ CAM.slice = async function(settings, widget, onupdate, ondone) { return error('no processes specified'); } + if (stock.x === 0 || stock.y === 0 || stock.z === 0) { + return error("one or more stock dimensions is zero
offset stock or set to non zero value"); + } + if (stock.x && stock.y && stock.z && !isIndexed) { if (stock.x + 0.00001 < bounds.max.x - bounds.min.x) { return error('stock X too small for part. resize stock or use offset stock'); @@ -681,6 +685,12 @@ function contourPolys(widget, polys) { } function healPolys(noff) { + for (let p of noff) { + if (p.appearsClosed()) { + p.points.pop(); + p.setClosed(); + } + } if (noff.length > 1) { let heal = 0; // heal/rejoin open segments that share endpoints