disable gpu for pocket contour, update defaults
This commit is contained in:
parent
8926a09de9
commit
256e9fcf73
4 changed files with 30 additions and 28 deletions
|
|
@ -537,7 +537,7 @@ export const conf = {
|
||||||
camPocketOver: 0.25,
|
camPocketOver: 0.25,
|
||||||
camPocketPlunge: 200,
|
camPocketPlunge: 200,
|
||||||
camPocketRefine: 20,
|
camPocketRefine: 20,
|
||||||
camPocketSmooth: 0,
|
camPocketSmooth: 1,
|
||||||
camPocketSpeed: 250,
|
camPocketSpeed: 250,
|
||||||
camPocketSpindle: 1000,
|
camPocketSpindle: 1000,
|
||||||
camPocketTool: 1000,
|
camPocketTool: 1000,
|
||||||
|
|
|
||||||
|
|
@ -38,23 +38,14 @@ class OpPocket extends CamOp {
|
||||||
let smoothVal = (smooth ?? 0) / 10;
|
let smoothVal = (smooth ?? 0) / 10;
|
||||||
if (contour) {
|
if (contour) {
|
||||||
down = 0;
|
down = 0;
|
||||||
this.topo = await Topo({
|
this.contour = {
|
||||||
// onupdate: (update, msg) => {
|
axis: "-",
|
||||||
onupdate: (index, total, msg) => {
|
inside: true,
|
||||||
progress((index / total) * 0.9, msg);
|
nogpu: true,
|
||||||
},
|
step: toolOver,
|
||||||
ondone: (slices) => {
|
tolerance,
|
||||||
// console.log({ contour: slices });
|
tool,
|
||||||
},
|
};
|
||||||
contour: {
|
|
||||||
tool,
|
|
||||||
step: toolOver,
|
|
||||||
tolerance,
|
|
||||||
inside: true,
|
|
||||||
axis: "-"
|
|
||||||
},
|
|
||||||
state: state
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
updateToolDiams(toolDiam);
|
updateToolDiams(toolDiam);
|
||||||
if (tabs) {
|
if (tabs) {
|
||||||
|
|
@ -70,7 +61,7 @@ class OpPocket extends CamOp {
|
||||||
sliceOut.push(slice);
|
sliceOut.push(slice);
|
||||||
return slice;
|
return slice;
|
||||||
}
|
}
|
||||||
function clearZ(polys, z, down) {
|
async function clearZ(polys, z, down) {
|
||||||
if (down) {
|
if (down) {
|
||||||
// adjust step down to a value <= down that
|
// adjust step down to a value <= down that
|
||||||
// ends on the lowest z specified
|
// ends on the lowest z specified
|
||||||
|
|
@ -131,7 +122,7 @@ class OpPocket extends CamOp {
|
||||||
}
|
}
|
||||||
POLY.setWinding(slice.camLines, cutdir, false);
|
POLY.setWinding(slice.camLines, cutdir, false);
|
||||||
if (contour) {
|
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");
|
progress(0.9 + (zpro + zinc * pct) * 0.1, "conform");
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
@ -176,7 +167,7 @@ class OpPocket extends CamOp {
|
||||||
if (op.outline) {
|
if (op.outline) {
|
||||||
POLY.clearInner(outline);
|
POLY.clearInner(outline);
|
||||||
}
|
}
|
||||||
clearZ(outline, zmin + 0.0001, down);
|
await clearZ(outline, zmin + 0.0001, down);
|
||||||
if (devel && sliceOut?.length) sliceOut[0].output()
|
if (devel && sliceOut?.length) sliceOut[0].output()
|
||||||
.setLayer("pocket area", {line: 0x1188ff}, false)
|
.setLayer("pocket area", {line: 0x1188ff}, false)
|
||||||
.addPolys(outline)
|
.addPolys(outline)
|
||||||
|
|
@ -185,7 +176,21 @@ class OpPocket extends CamOp {
|
||||||
}
|
}
|
||||||
|
|
||||||
// mold cam output lines to the surface of the topo offset by tool geometry
|
// 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;
|
const topo = this.topo;
|
||||||
// re-segment polygon to a higher resolution
|
// re-segment polygon to a higher resolution
|
||||||
const hirez = camLines.map(p => p.segment(topo.tolerance * 2));
|
const hirez = camLines.map(p => p.segment(topo.tolerance * 2));
|
||||||
|
|
|
||||||
|
|
@ -102,7 +102,7 @@ export class Topo {
|
||||||
newslices.push(debug);
|
newslices.push(debug);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (webGPU) {
|
if (webGPU && !contour.nogpu) {
|
||||||
// invert tool Z offset for gpu code
|
// invert tool Z offset for gpu code
|
||||||
let toolBounds = new THREE.Box3()
|
let toolBounds = new THREE.Box3()
|
||||||
.expandByPoint({ x: -toolDiameter/2, y: -toolDiameter/2, z: 0 })
|
.expandByPoint({ x: -toolDiameter/2, y: -toolDiameter/2, z: 0 })
|
||||||
|
|
@ -137,8 +137,9 @@ export class Topo {
|
||||||
// console.timeEnd('swap XY vertices');
|
// console.timeEnd('swap XY vertices');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let trace = contour.trace;
|
||||||
let gpu = await self.get_raster_gpu({
|
let gpu = await self.get_raster_gpu({
|
||||||
mode: "planar",
|
mode: trace ? "tracing" : "planar",
|
||||||
resolution
|
resolution
|
||||||
});
|
});
|
||||||
let xStep = density;
|
let xStep = density;
|
||||||
|
|
|
||||||
|
|
@ -58,10 +58,6 @@ function checkReady() {
|
||||||
bootctrl.postMessage({ clear: true, disable: true });
|
bootctrl.postMessage({ clear: true, disable: true });
|
||||||
location.reload();
|
location.reload();
|
||||||
}
|
}
|
||||||
} else if (api.onshape) {
|
|
||||||
$('install').classList.add('hide');
|
|
||||||
$('uninstall').classList.add('hide');
|
|
||||||
$('app-quit').classList.add('hide');
|
|
||||||
} else {
|
} else {
|
||||||
$('install').onclick = () => {
|
$('install').onclick = () => {
|
||||||
location.replace('/boot');
|
location.replace('/boot');
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue