checkpoint cam pocket contour setup. improve topo raster cache

This commit is contained in:
Stewart Allen 2022-10-10 00:51:03 -04:00
commit 5a05f77273
3 changed files with 25 additions and 6 deletions

View file

@ -957,7 +957,7 @@ class OpPocket extends CamOp {
} }
slice(progress) { slice(progress) {
const debug = true; const debug = false;
let { op, state } = this; let { op, state } = this;
let { tool, rate, down, plunge, expand, contour, smooth } = op; let { tool, rate, down, plunge, expand, contour, smooth } = op;
let { settings, widget, sliceAll, zMax, zTop, zThru, tabs, color } = state; let { settings, widget, sliceAll, zMax, zTop, zThru, tabs, color } = state;
@ -970,6 +970,23 @@ class OpPocket extends CamOp {
let cutdir = process.camConventional; let cutdir = process.camConventional;
if (contour) { if (contour) {
down = 0; 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); updateToolDiams(toolDiam);
if (tabs) { if (tabs) {

View file

@ -55,7 +55,9 @@ class Topo {
R2A = 180 / Math.PI, R2A = 180 / Math.PI,
stepsx = Math.ceil(boundsX / resolution), stepsx = Math.ceil(boundsX / resolution),
stepsy = Math.ceil(boundsY / 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), data: new Float32Array(stepsx * stepsy),
stepsx: stepsx, stepsx: stepsx,
stepsy: stepsy, stepsy: stepsy,
@ -83,8 +85,8 @@ class Topo {
debug_topo_shells = debug && true, debug_topo_shells = debug && true,
time = Date.now; time = Date.now;
if (tolerance == 0) { if (tolerance === 0 && !topoCache) {
console.log(`contour auto tolerance`,resolution.round(4)); console.log(widget.id, 'topo auto tolerance', resolution.round(4));
} }
this.tolerance = resolution; this.tolerance = resolution;
@ -193,7 +195,7 @@ class Topo {
function raster(slices) { function raster(slices) {
if (!topo.raster) { if (!topo.raster) {
// console.log({skipping_raster: widget.id}); console.log(widget.id, 'topo raster cached');
return; return;
} }
topo.raster = false; topo.raster = false;

View file

@ -516,7 +516,7 @@ self.kiri.lang['en-us'] = {
cp_xpnd_s: "expand", cp_xpnd_s: "expand",
cp_xpnd_l: ["grow selected area to","encompass corners"], cp_xpnd_l: ["grow selected area to","encompass corners"],
cp_smoo_s: "smooth", 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_s: "contour",
cp_cont_l: ["ignore interior voids and features"], cp_cont_l: ["ignore interior voids and features"],
cp_outl_s: "outline only", cp_outl_s: "outline only",