improve smoothing, pocket devmode visuals
This commit is contained in:
parent
0d10fb7dfc
commit
5fd8e3bed9
2 changed files with 11 additions and 11 deletions
|
|
@ -114,8 +114,7 @@
|
||||||
"prebuild": "npm run setup && cross-env ELECTRON_BUILD=1 npm run pack-dev && node bin/electron-pre.js",
|
"prebuild": "npm run setup && cross-env ELECTRON_BUILD=1 npm run pack-dev && node bin/electron-pre.js",
|
||||||
"preinstall": "node bin/install-pre.js",
|
"preinstall": "node bin/install-pre.js",
|
||||||
"prod": "npm run pack-prod && gs-app-server",
|
"prod": "npm run pack-prod && gs-app-server",
|
||||||
"setup-mods": "cd mods && npm i",
|
"setup": "npm run clean && npm i && npm run webpack-ext",
|
||||||
"setup": "npm run clean && npm run setup-mods && npm i && npm run webpack-ext",
|
|
||||||
"start-dbg": "npm run prebuild && electron . --debugg",
|
"start-dbg": "npm run prebuild && electron . --debugg",
|
||||||
"start-ddb": "npm run prebuild && electron . --devel --debugg",
|
"start-ddb": "npm run prebuild && electron . --devel --debugg",
|
||||||
"start-dev": "npm run prebuild prod && electron . --devel",
|
"start-dev": "npm run prebuild prod && electron . --devel",
|
||||||
|
|
|
||||||
|
|
@ -19,13 +19,11 @@ class OpPocket extends CamOp {
|
||||||
|
|
||||||
async slice(progress) {
|
async slice(progress) {
|
||||||
const pocket = this;
|
const pocket = this;
|
||||||
const debug = false;
|
|
||||||
let { op, state } = this;
|
let { op, state } = this;
|
||||||
let { tool, rate, down, plunge, expand, contour, smooth, tolerance } = op;
|
let { tool, rate, down, plunge, expand, contour, smooth, tolerance } = op;
|
||||||
let { ov_botz, ov_conv } = op;
|
let { ov_botz, ov_conv } = op;
|
||||||
let { settings, widget, addSlices, zBottom, zThru, tabs, color } = state;
|
let { settings, widget, addSlices, zBottom, zThru, tabs, color } = state;
|
||||||
let { updateToolDiams, cutTabs, healPolys, shadowAt, workarea } = state;
|
let { updateToolDiams, cutTabs, healPolys, shadowAt, workarea } = state;
|
||||||
let { process } = settings;
|
|
||||||
zBottom = ov_botz ? workarea.bottom_stock + ov_botz : zBottom;
|
zBottom = ov_botz ? workarea.bottom_stock + ov_botz : zBottom;
|
||||||
// generate tracing offsets from chosen features
|
// generate tracing offsets from chosen features
|
||||||
let sliceOut;
|
let sliceOut;
|
||||||
|
|
@ -36,6 +34,8 @@ class OpPocket extends CamOp {
|
||||||
let cutdir = ov_conv;
|
let cutdir = ov_conv;
|
||||||
let engrave = contour && op.engrave;
|
let engrave = contour && op.engrave;
|
||||||
let zTop = workarea.top_z;
|
let zTop = workarea.top_z;
|
||||||
|
let devel = settings.controller.devel;
|
||||||
|
let smoothVal = (smooth ?? 0) / 10;
|
||||||
if (contour) {
|
if (contour) {
|
||||||
down = 0;
|
down = 0;
|
||||||
this.topo = await Topo({
|
this.topo = await Topo({
|
||||||
|
|
@ -48,6 +48,7 @@ class OpPocket extends CamOp {
|
||||||
},
|
},
|
||||||
contour: {
|
contour: {
|
||||||
tool,
|
tool,
|
||||||
|
step: toolOver,
|
||||||
tolerance,
|
tolerance,
|
||||||
inside: true,
|
inside: true,
|
||||||
axis: "-"
|
axis: "-"
|
||||||
|
|
@ -92,14 +93,14 @@ class OpPocket extends CamOp {
|
||||||
let clip = [], shadow;
|
let clip = [], shadow;
|
||||||
if (contour) {
|
if (contour) {
|
||||||
if (smooth) {
|
if (smooth) {
|
||||||
clip = POLY.offset(POLY.offset([ poly ], smooth), -smooth);
|
clip = POLY.offset(POLY.offset([ poly ], smoothVal), -smoothVal);
|
||||||
} else {
|
} else {
|
||||||
clip = [ poly ];
|
clip = [ poly ];
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
shadow = shadowAt(z);
|
shadow = shadowAt(z);
|
||||||
if (smooth) {
|
if (smooth) {
|
||||||
shadow = POLY.setZ(POLY.offset(POLY.offset(shadow, smooth), -smooth), z);
|
shadow = POLY.setZ(POLY.offset(POLY.offset(shadow, smoothVal), -smoothVal), z);
|
||||||
}
|
}
|
||||||
POLY.subtract([ poly ], shadow, clip, undefined, undefined, 0);
|
POLY.subtract([ poly ], shadow, clip, undefined, undefined, 0);
|
||||||
if (op.outline) {
|
if (op.outline) {
|
||||||
|
|
@ -137,9 +138,9 @@ class OpPocket extends CamOp {
|
||||||
slice.output()
|
slice.output()
|
||||||
.setLayer(state.layername, {line: color}, false)
|
.setLayer(state.layername, {line: color}, false)
|
||||||
.addPolys(slice.camLines)
|
.addPolys(slice.camLines)
|
||||||
if (debug && shadow) slice.output()
|
if (devel && shadow) slice.output()
|
||||||
.setLayer("pocket shadow", {line: 0xff8811}, false)
|
.setLayer("pocket shadow", {line: 0xff8811}, false)
|
||||||
.addPolys(shadow)
|
.addPolys(shadow);
|
||||||
if (!contour) {
|
if (!contour) {
|
||||||
progress(zpro, "pocket");
|
progress(zpro, "pocket");
|
||||||
}
|
}
|
||||||
|
|
@ -168,17 +169,17 @@ class OpPocket extends CamOp {
|
||||||
outline = POLY.setWinding(outline, cutdir, false);
|
outline = POLY.setWinding(outline, cutdir, false);
|
||||||
outline = healPolys(outline);
|
outline = healPolys(outline);
|
||||||
if (smooth) {
|
if (smooth) {
|
||||||
outline = POLY.offset(POLY.offset(outline, smooth), -smooth);
|
outline = POLY.offset(POLY.offset(outline, smoothVal), -smoothVal);
|
||||||
}
|
}
|
||||||
if (outline.length) {
|
if (outline.length) {
|
||||||
// option to skip interior features (holes, pillars)
|
// option to skip interior features (holes, pillars)
|
||||||
if (op.outline) {
|
if (op.outline) {
|
||||||
POLY.clearInner(outline);
|
POLY.clearInner(outline);
|
||||||
}
|
}
|
||||||
if (debug) newSliceOut(zmin).output()
|
clearZ(outline, zmin + 0.0001, down);
|
||||||
|
if (devel && sliceOut?.length) sliceOut[0].output()
|
||||||
.setLayer("pocket area", {line: 0x1188ff}, false)
|
.setLayer("pocket area", {line: 0x1188ff}, false)
|
||||||
.addPolys(outline)
|
.addPolys(outline)
|
||||||
clearZ(outline, zmin + 0.0001, down);
|
|
||||||
progress(1, "pocket");
|
progress(1, "pocket");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue