diff --git a/src/kiri-mode/cam/ops.js b/src/kiri-mode/cam/ops.js index 5810d4d9..992ff651 100644 --- a/src/kiri-mode/cam/ops.js +++ b/src/kiri-mode/cam/ops.js @@ -957,7 +957,7 @@ class OpPocket extends CamOp { } slice(progress) { - const debug = true; + const debug = false; let { op, state } = this; let { tool, rate, down, plunge, expand, contour, smooth } = op; let { settings, widget, sliceAll, zMax, zTop, zThru, tabs, color } = state; @@ -970,6 +970,23 @@ class OpPocket extends CamOp { let cutdir = process.camConventional; if (contour) { down = 0; + let topo = new CAM.Topo({ + // onupdate: (update, msg) => { + onupdate: (index, total, msg) => { + progress(index / total, msg); + }, + ondone: (slices) => { + this.sliceOut = slices; + sliceAll.appendAll(slices); + }, + contour: { + tolerance: 0, + inside: true, + tool: tool, + axis: "-" + }, + state: state + }); } updateToolDiams(toolDiam); if (tabs) { diff --git a/src/kiri-mode/cam/topo.js b/src/kiri-mode/cam/topo.js index 1167acb0..131b3798 100644 --- a/src/kiri-mode/cam/topo.js +++ b/src/kiri-mode/cam/topo.js @@ -55,7 +55,9 @@ class Topo { R2A = 180 / Math.PI, stepsx = Math.ceil(boundsX / resolution), stepsy = Math.ceil(boundsY / resolution), - topo = widget.topo = { + widtopo = widget.topo, + topoCache = widtopo && widtopo.resolution === resolution ? widtopo : undefined, + topo = widget.topo = topoCache || { data: new Float32Array(stepsx * stepsy), stepsx: stepsx, stepsy: stepsy, @@ -83,8 +85,8 @@ class Topo { debug_topo_shells = debug && true, time = Date.now; - if (tolerance == 0) { - console.log(`contour auto tolerance`,resolution.round(4)); + if (tolerance === 0 && !topoCache) { + console.log(widget.id, 'topo auto tolerance', resolution.round(4)); } this.tolerance = resolution; @@ -193,7 +195,7 @@ class Topo { function raster(slices) { if (!topo.raster) { - // console.log({skipping_raster: widget.id}); + console.log(widget.id, 'topo raster cached'); return; } topo.raster = false; diff --git a/web/kiri/lang/en.js b/web/kiri/lang/en.js index 984d38f3..79489063 100644 --- a/web/kiri/lang/en.js +++ b/web/kiri/lang/en.js @@ -516,7 +516,7 @@ self.kiri.lang['en-us'] = { cp_xpnd_s: "expand", cp_xpnd_l: ["grow selected area to","encompass corners"], cp_smoo_s: "smooth", - cp_smoo_l: ["clean up jagged edges caused by highly angled walls. can speedup pocketing for detailed geometries. recommend a value around 1"], + cp_smoo_l: ["clean up jagged edges caused by angled walls. can speedup and improve pocketing for detailed geometries. recommend starting with values around 1"], cp_cont_s: "contour", cp_cont_l: ["ignore interior voids and features"], cp_outl_s: "outline only",