diff --git a/src/kiri-mode/cam/prepare.js b/src/kiri-mode/cam/prepare.js index e3ef4fd2..b0fdca69 100644 --- a/src/kiri-mode/cam/prepare.js +++ b/src/kiri-mode/cam/prepare.js @@ -346,7 +346,7 @@ function prepEach(widget, settings, print, firstPoint, update) { // new pos for plunge calc deltaXY = 0; } - } else if (isMove && currentOp.type === 'lathe') { + } else if (isMove && ['lathe','contour'].contains(currentOp.type)) { if (point.z > lastPoint.z) { layerPush(lastPoint.clone().setZ(point.z), 0, 0, tool.getNumber()); } else if (point.z < lastPoint.z) { diff --git a/src/kiri-mode/cam/slice.js b/src/kiri-mode/cam/slice.js index ae8bf752..953c33c1 100644 --- a/src/kiri-mode/cam/slice.js +++ b/src/kiri-mode/cam/slice.js @@ -239,14 +239,14 @@ CAM.slice = async function(settings, widget, onupdate, ondone) { }); tracker.rotation = isIndexed ? axisRotation : 0; // setup new state when indexing the workspace - if (true && op.op.type === "index") { + if (op.op.type === "index") { + widget.topo = undefined; // let points = base.verticesToPoints(); state.slicer = new kiri.cam_slicer(widget); shadows = {}; await new CAM.OPS.shadow(state, { type: "shadow", silent: true }).slice(progress => { // console.log('reshadow', progress.round(3)); }); - widget.topo = undefined; } camOps.push(op); opSum += weight; diff --git a/src/kiri-mode/cam/topo.js b/src/kiri-mode/cam/topo.js index b87a52fd..b5d9c44a 100644 --- a/src/kiri-mode/cam/topo.js +++ b/src/kiri-mode/cam/topo.js @@ -87,7 +87,7 @@ class Topo { clipTo = inside ? shadow : POLY.expand(shadow, toolDiameter/2 + resolution * 3), partOff = inside ? 0 : toolDiameter / 2 + resolution, gridDelta = Math.floor(partOff / resolution), - debug = true, + debug = false, debug_clips = debug && true, debug_topo = debug && true, debug_topo_lines = debug && true, @@ -205,7 +205,7 @@ class Topo { const { box } = params; const { worker, minions } = kiri; - const vertices = widget.getGeoVertices().toShared(); + const vertices = widget.getGeoVertices({ unroll: true, translate: true }).toShared(); const range = { min: Infinity, max: -Infinity }; // swap XZ in shared array @@ -449,7 +449,7 @@ class Probe { xl = sx - 1, yl = sy - 1; - let gv, i = 0, mz = -1; + let gv, i = 0, mz = -Infinity; while (i < profile.length) { // tool profile point x, y, and z offsets @@ -467,7 +467,7 @@ class Probe { mz = Math.max(tz + gv, mz); } - return Math.max(mz, 0); + return Math.max(mz, zMin); } // export z probe function @@ -777,7 +777,7 @@ function raster_slice(inputs) { // rasterize one x slice for (y = minY; y < maxY && gridy < stepsY; y += resolution) { gridi = gridx * stepsY + gridy; - gridv = data[gridi] || 0; + gridv = data[gridi] || zMin; // strategy using raw lines (faster slice, but more lines) for (i=0, il=points.length; i