disable gpu for pocket contour, update defaults

This commit is contained in:
Stewart Allen 2025-11-16 19:05:42 -05:00
commit 256e9fcf73
4 changed files with 30 additions and 28 deletions

View file

@ -537,7 +537,7 @@ export const conf = {
camPocketOver: 0.25,
camPocketPlunge: 200,
camPocketRefine: 20,
camPocketSmooth: 0,
camPocketSmooth: 1,
camPocketSpeed: 250,
camPocketSpindle: 1000,
camPocketTool: 1000,

View file

@ -38,23 +38,14 @@ class OpPocket extends CamOp {
let smoothVal = (smooth ?? 0) / 10;
if (contour) {
down = 0;
this.topo = await Topo({
// onupdate: (update, msg) => {
onupdate: (index, total, msg) => {
progress((index / total) * 0.9, msg);
},
ondone: (slices) => {
// console.log({ contour: slices });
},
contour: {
tool,
step: toolOver,
tolerance,
inside: true,
axis: "-"
},
state: state
});
this.contour = {
axis: "-",
inside: true,
nogpu: true,
step: toolOver,
tolerance,
tool,
};
}
updateToolDiams(toolDiam);
if (tabs) {
@ -70,7 +61,7 @@ class OpPocket extends CamOp {
sliceOut.push(slice);
return slice;
}
function clearZ(polys, z, down) {
async function clearZ(polys, z, down) {
if (down) {
// adjust step down to a value <= down that
// ends on the lowest z specified
@ -131,7 +122,7 @@ class OpPocket extends CamOp {
}
POLY.setWinding(slice.camLines, cutdir, false);
if (contour) {
slice.camLines = pocket.conform(slice.camLines, op.refine, engrave, pct => {
slice.camLines = await pocket.conform(slice.camLines, op.refine, engrave, pct => {
progress(0.9 + (zpro + zinc * pct) * 0.1, "conform");
});
}
@ -176,7 +167,7 @@ class OpPocket extends CamOp {
if (op.outline) {
POLY.clearInner(outline);
}
clearZ(outline, zmin + 0.0001, down);
await clearZ(outline, zmin + 0.0001, down);
if (devel && sliceOut?.length) sliceOut[0].output()
.setLayer("pocket area", {line: 0x1188ff}, false)
.addPolys(outline)
@ -185,7 +176,21 @@ class OpPocket extends CamOp {
}
// mold cam output lines to the surface of the topo offset by tool geometry
conform(camLines, refine, engrave, progress) {
async conform(camLines, refine, engrave, progress) {
if (!this.topo) {
console.log('deferred topo');
this.topo = await Topo({
// onupdate: (update, msg) => {
onupdate: (index, total, msg) => {
progress((index / total) * 0.9, msg);
},
ondone: (slices) => {
// console.log({ contour: slices });
},
contour: this.contour,
state: this.state
});
}
const topo = this.topo;
// re-segment polygon to a higher resolution
const hirez = camLines.map(p => p.segment(topo.tolerance * 2));

View file

@ -102,7 +102,7 @@ export class Topo {
newslices.push(debug);
}
if (webGPU) {
if (webGPU && !contour.nogpu) {
// invert tool Z offset for gpu code
let toolBounds = new THREE.Box3()
.expandByPoint({ x: -toolDiameter/2, y: -toolDiameter/2, z: 0 })
@ -137,8 +137,9 @@ export class Topo {
// console.timeEnd('swap XY vertices');
}
let trace = contour.trace;
let gpu = await self.get_raster_gpu({
mode: "planar",
mode: trace ? "tracing" : "planar",
resolution
});
let xStep = density;

View file

@ -58,10 +58,6 @@ function checkReady() {
bootctrl.postMessage({ clear: true, disable: true });
location.reload();
}
} else if (api.onshape) {
$('install').classList.add('hide');
$('uninstall').classList.add('hide');
$('app-quit').classList.add('hide');
} else {
$('install').onclick = () => {
location.replace('/boot');