From f5b90087d386939ec4d4802475ba0f46b3ccaa8d Mon Sep 17 00:00:00 2001 From: Stewart Allen Date: Mon, 13 Feb 2023 15:38:39 -0500 Subject: [PATCH] fix lathe slice allocation --- src/kiri-mode/cam/topo4.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/kiri-mode/cam/topo4.js b/src/kiri-mode/cam/topo4.js index eb0a48a8..13926610 100644 --- a/src/kiri-mode/cam/topo4.js +++ b/src/kiri-mode/cam/topo4.js @@ -288,8 +288,9 @@ class Topo4 { } } - for (let heights of recs[0].heights) { - let slice = newSlice(); + count = recs[0].heights.length / 3; + while (count-- > 0) { + let slice = newSlice(count); slice.camLines = [ newPolygon().setOpen() ]; paths.push(slice); } @@ -304,6 +305,7 @@ class Topo4 { for (let slice of paths) { const poly = slice.camLines[0]; if (!poly.length) { + console.log('empty', slice); continue; } slice.camLines[0].push(poly.points[0].clone());