start to add back outline features
This commit is contained in:
parent
a077cf5739
commit
2097f8d6e2
6 changed files with 86 additions and 38 deletions
|
|
@ -428,6 +428,7 @@ export const conf = {
|
||||||
camAreaTrace: "none",
|
camAreaTrace: "none",
|
||||||
camAreaSurface: "linear",
|
camAreaSurface: "linear",
|
||||||
camAreaDirection: "climb",
|
camAreaDirection: "climb",
|
||||||
|
camAreaEdgeOnly: false,
|
||||||
camAreaAngle: 0,
|
camAreaAngle: 0,
|
||||||
camAreaOver: 0.4,
|
camAreaOver: 0.4,
|
||||||
camAreaDown: 1,
|
camAreaDown: 1,
|
||||||
|
|
@ -534,6 +535,7 @@ export const conf = {
|
||||||
camOutlineRevbone: false,
|
camOutlineRevbone: false,
|
||||||
camOutlineDown: 3,
|
camOutlineDown: 3,
|
||||||
camOutlineIn: false,
|
camOutlineIn: false,
|
||||||
|
camOutlineOut: true,
|
||||||
camOutlineOmitThru: false,
|
camOutlineOmitThru: false,
|
||||||
camOutlineOver: 0.4,
|
camOutlineOver: 0.4,
|
||||||
camOutlineOverCount: 1,
|
camOutlineOverCount: 1,
|
||||||
|
|
|
||||||
|
|
@ -265,6 +265,8 @@ export function createPopOps() {
|
||||||
dogbones: 'camOutlineDogbone',
|
dogbones: 'camOutlineDogbone',
|
||||||
revbones: 'camOutlineRevbone',
|
revbones: 'camOutlineRevbone',
|
||||||
omitthru: 'camOutlineOmitThru',
|
omitthru: 'camOutlineOmitThru',
|
||||||
|
outside: 'camOutlineOut',
|
||||||
|
inside: 'camOutlineIn',
|
||||||
wide: 'camOutlineWide',
|
wide: 'camOutlineWide',
|
||||||
ov_topz: 0,
|
ov_topz: 0,
|
||||||
ov_botz: 0,
|
ov_botz: 0,
|
||||||
|
|
@ -279,7 +281,10 @@ export function createPopOps() {
|
||||||
step: UC.newInput(LANG.cc_sovr_s, { title: LANG.cc_sovr_l, convert: toFloat, bound: UC.bound(0.01, 1.0), show: () => env.popOp.outline.rec.wide }),
|
step: UC.newInput(LANG.cc_sovr_s, { title: LANG.cc_sovr_l, convert: toFloat, bound: UC.bound(0.01, 1.0), show: () => env.popOp.outline.rec.wide }),
|
||||||
steps: UC.newInput(LANG.cc_sovc_s, { title: LANG.cc_sovc_l, convert: toInt, bound: UC.bound(1, 500), show: () => env.popOp.outline.rec.wide }),
|
steps: UC.newInput(LANG.cc_sovc_s, { title: LANG.cc_sovc_l, convert: toInt, bound: UC.bound(1, 500), show: () => env.popOp.outline.rec.wide }),
|
||||||
sep: UC.newBlank({ class: "pop-sep" }),
|
sep: UC.newBlank({ class: "pop-sep" }),
|
||||||
|
inside: UC.newBoolean(LANG.co_olin_s, undefined, { title: LANG.co_olin_l, show: (op) => { return !op.inputs.outside.checked } }),
|
||||||
|
outside: UC.newBoolean(LANG.co_olot_s, undefined, { title: LANG.co_olot_l, show: (op) => { return !op.inputs.inside.checked } }),
|
||||||
omitthru: UC.newBoolean(LANG.co_omit_s, undefined, { title: LANG.co_omit_l }),
|
omitthru: UC.newBoolean(LANG.co_omit_s, undefined, { title: LANG.co_omit_l }),
|
||||||
|
sep: UC.newBlank({ class: "pop-sep" }),
|
||||||
wide: UC.newBoolean(LANG.co_wide_s, undefined, { title: LANG.co_wide_l }),
|
wide: UC.newBoolean(LANG.co_wide_s, undefined, { title: LANG.co_wide_l }),
|
||||||
dogbones: UC.newBoolean(LANG.co_dogb_s, undefined, { title: LANG.co_dogb_l, show: (op) => { return !op.inputs.wide.checked } }),
|
dogbones: UC.newBoolean(LANG.co_dogb_s, undefined, { title: LANG.co_dogb_l, show: (op) => { return !op.inputs.wide.checked } }),
|
||||||
revbones: UC.newBoolean(LANG.co_dogr_s, undefined, { title: LANG.co_dogr_l, show: () => env.poppedRec.dogbones }),
|
revbones: UC.newBoolean(LANG.co_dogr_s, undefined, { title: LANG.co_dogr_l, show: () => env.poppedRec.dogbones }),
|
||||||
|
|
@ -674,6 +679,7 @@ export function createPopOps() {
|
||||||
follow: 'camAreaFollow',
|
follow: 'camAreaFollow',
|
||||||
refine: 'camAreaRefine',
|
refine: 'camAreaRefine',
|
||||||
outline: 'camAreaOutline',
|
outline: 'camAreaOutline',
|
||||||
|
edgeonly: 'camAreaEdgeOnly',
|
||||||
tolerance: 'camTolerance',
|
tolerance: 'camTolerance',
|
||||||
dogbones: 'camAreaDogbones',
|
dogbones: 'camAreaDogbones',
|
||||||
revbones: 'camAreaRevbones',
|
revbones: 'camAreaRevbones',
|
||||||
|
|
@ -690,6 +696,7 @@ export function createPopOps() {
|
||||||
UC.newButton("surface", surfaceAdd),
|
UC.newButton("surface", surfaceAdd),
|
||||||
], { class: "ext-buttons f-row" }),
|
], { class: "ext-buttons f-row" }),
|
||||||
outline: UC.newBoolean(LANG.cp_outl_s, undefined, { title: LANG.cp_outl_l }),
|
outline: UC.newBoolean(LANG.cp_outl_s, undefined, { title: LANG.cp_outl_l }),
|
||||||
|
edgeonly: UC.newBoolean("edges only", undefined, { title: "edges only", show: isClear }),
|
||||||
expand: UC.newInput(LANG.cp_xpnd_s, { title: LANG.cp_xpnd_l, convert: toFloat, units }),
|
expand: UC.newInput(LANG.cp_xpnd_s, { title: LANG.cp_xpnd_l, convert: toFloat, units }),
|
||||||
smooth: UC.newInput(LANG.cp_smoo_s, { title: LANG.cp_smoo_l, convert: toInt, xshow: isSurface }),
|
smooth: UC.newInput(LANG.cp_smoo_s, { title: LANG.cp_smoo_l, convert: toInt, xshow: isSurface }),
|
||||||
follow: UC.newInput(LANG.cp_foll_s, { title: LANG.cp_foll_l, convert: toFloat }),
|
follow: UC.newInput(LANG.cp_foll_s, { title: LANG.cp_foll_l, convert: toFloat }),
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,7 @@ class OpArea extends CamOp {
|
||||||
|
|
||||||
async slice(progress) {
|
async slice(progress) {
|
||||||
let { op, state } = this;
|
let { op, state } = this;
|
||||||
let { tool, mode, down, over, follow, expand, outline, smooth } = op;
|
let { tool, mode, down, over, follow, edgeonly, expand, outline, smooth } = op;
|
||||||
let { ov_topz, ov_botz, direction, rename } = op;
|
let { ov_topz, ov_botz, direction, rename } = op;
|
||||||
let { settings, widget, tabs, color } = state;
|
let { settings, widget, tabs, color } = state;
|
||||||
let { addSlices, setToolDiam, cutTabs, shadowAt, workarea } = state;
|
let { addSlices, setToolDiam, cutTabs, shadowAt, workarea } = state;
|
||||||
|
|
@ -137,7 +137,7 @@ class OpArea extends CamOp {
|
||||||
let layers = slice.output();
|
let layers = slice.output();
|
||||||
let shadow = await shadowAt(z);
|
let shadow = await shadowAt(z);
|
||||||
let tool_shadow = POLY.offset(shadow, [ toolDiam / 2 - ts_off ], { count: 1, z });
|
let tool_shadow = POLY.offset(shadow, [ toolDiam / 2 - ts_off ], { count: 1, z });
|
||||||
// for roughing backward compatability
|
// for roughing/outline backward compatability
|
||||||
if (op.omitthru) {
|
if (op.omitthru) {
|
||||||
shadow = shadow.clone(true);
|
shadow = shadow.clone(true);
|
||||||
for (let poly of shadow.filter(p => p.inner)) {
|
for (let poly of shadow.filter(p => p.inner)) {
|
||||||
|
|
@ -156,7 +156,7 @@ class OpArea extends CamOp {
|
||||||
let clip = [];
|
let clip = [];
|
||||||
POLY.subtract([ area ], shadow, clip, undefined, undefined, 0);
|
POLY.subtract([ area ], shadow, clip, undefined, undefined, 0);
|
||||||
POLY.offset(clip, [ -toolDiam / 2, -toolOver ], {
|
POLY.offset(clip, [ -toolDiam / 2, -toolOver ], {
|
||||||
count: 999, outs, flat: true, z, minArea: 0
|
count: edgeonly ? 1 : 999, outs, flat: true, z, minArea: 0
|
||||||
});
|
});
|
||||||
// if we see no offsets, re-check the mesh bottom Z then exit
|
// if we see no offsets, re-check the mesh bottom Z then exit
|
||||||
if (outs.length === 0) {
|
if (outs.length === 0) {
|
||||||
|
|
|
||||||
|
|
@ -14,37 +14,72 @@ class OpOutline extends CamOp {
|
||||||
|
|
||||||
async slice(progress) {
|
async slice(progress) {
|
||||||
let { op, state } = this;
|
let { op, state } = this;
|
||||||
let { shadow, tool, widget } = state;
|
let { dogbones, down, inside, omitthru, outside, ov_botz, ov_topz } = op;
|
||||||
|
let { plunge, rate, rename, revbones, spindle, tool } = op;
|
||||||
|
let { shadow, widget } = state;
|
||||||
|
|
||||||
let shadow_base = shadow.base;
|
let shadow_base = shadow.base;
|
||||||
if (!(shadow_base && shadow_base.length)) {
|
if (!(shadow_base && shadow_base.length)) {
|
||||||
throw 'missing shadow base';
|
throw 'missing shadow base';
|
||||||
}
|
}
|
||||||
let areas = POLY.flatten(POLY.expand(shadow.base, tool.fluteDiameter() / 2 - 0.001));
|
|
||||||
let cutout = {
|
let ops_list = this.ops_list = [ ];
|
||||||
areas: { [widget.id]: areas.map(p => p.toArray()) },
|
|
||||||
dogbones: op.dogbones,
|
if (outside) {
|
||||||
down: op.down,
|
let areas = POLY.flatten(POLY.expand(shadow.base, state.tool.fluteDiameter() / 2 - 0.001));
|
||||||
expand: 0,
|
ops_list.push(new OpArea(state, {
|
||||||
mode: 'trace',
|
areas: { [widget.id]: areas.map(p => p.toArray()) },
|
||||||
outline: op.omitthru,
|
dogbones,
|
||||||
ov_botz: op.ov_botz,
|
down,
|
||||||
ov_topz: op.ov_topz,
|
expand: 0,
|
||||||
plunge: op.plunge,
|
mode: 'trace',
|
||||||
rate: op.rate,
|
outline: omitthru,
|
||||||
rename: op.rename ?? "outline",
|
ov_botz,
|
||||||
revbones: op.revbones,
|
ov_topz,
|
||||||
smooth: 0,
|
plunge,
|
||||||
spindle: op.spindle,
|
rate,
|
||||||
surfaces: {},
|
rename: rename ?? "outline",
|
||||||
tool: op.tool,
|
revbones,
|
||||||
tr_type: 'none',
|
smooth: 0,
|
||||||
};
|
spindle,
|
||||||
this.op_cutout = new OpArea(state, cutout);
|
surfaces: {},
|
||||||
return this.op_cutout.slice(progress);
|
tool,
|
||||||
|
tr_type: 'none',
|
||||||
|
}));
|
||||||
|
} else {
|
||||||
|
let areas = shadow.base.clone(true);
|
||||||
|
ops_list.push(new OpArea(state, {
|
||||||
|
areas: { [widget.id]: areas.map(p => p.toArray()) },
|
||||||
|
dogbones,
|
||||||
|
down,
|
||||||
|
edgeonly: true,
|
||||||
|
expand: 0,
|
||||||
|
mode: 'clear',
|
||||||
|
ov_botz,
|
||||||
|
ov_topz,
|
||||||
|
plunge,
|
||||||
|
rate,
|
||||||
|
rename: rename ?? "outline",
|
||||||
|
revbones,
|
||||||
|
smooth: 0,
|
||||||
|
spindle,
|
||||||
|
surfaces: {},
|
||||||
|
tool,
|
||||||
|
}));
|
||||||
|
if (!inside) {
|
||||||
|
// add outline
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (let op of this.ops_list) {
|
||||||
|
await op.slice(progress);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async prepare(ops, progress) {
|
async prepare(ops, progress) {
|
||||||
return this.op_cutout.prepare(ops, progress);
|
for (let op of this.ops_list) {
|
||||||
|
await op.prepare(ops, progress);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -30,8 +30,9 @@ class OpRough extends CamOp {
|
||||||
}
|
}
|
||||||
|
|
||||||
let areas = POLY.flatten(POLY.expand(shadowBase, tool.fluteDiameter() / 2 - 0.001));
|
let areas = POLY.flatten(POLY.expand(shadowBase, tool.fluteDiameter() / 2 - 0.001));
|
||||||
|
let ops_list = this.ops_list = [ ];
|
||||||
|
|
||||||
let rough = {
|
ops_list.push(new OpArea(state, {
|
||||||
rename: op.rename ?? "rough",
|
rename: op.rename ?? "rough",
|
||||||
spindle: op.spindle,
|
spindle: op.spindle,
|
||||||
tool: op.tool,
|
tool: op.tool,
|
||||||
|
|
@ -50,13 +51,10 @@ class OpRough extends CamOp {
|
||||||
ov_topz: op.ov_topz,
|
ov_topz: op.ov_topz,
|
||||||
areas: { [widget.id]: areas.map(p => p.toArray()) },
|
areas: { [widget.id]: areas.map(p => p.toArray()) },
|
||||||
surfaces: {}
|
surfaces: {}
|
||||||
};
|
}));
|
||||||
|
|
||||||
this.op_rough = new OpArea(state, rough);
|
|
||||||
await this.op_rough.slice(progress);
|
|
||||||
|
|
||||||
if (cutOutside) {
|
if (cutOutside) {
|
||||||
let cutout = {
|
ops_list.push(new OpArea(state, {
|
||||||
rename: op.rename ?? "rough",
|
rename: op.rename ?? "rough",
|
||||||
spindle: op.spindle,
|
spindle: op.spindle,
|
||||||
tool: op.tool,
|
tool: op.tool,
|
||||||
|
|
@ -72,16 +70,18 @@ class OpRough extends CamOp {
|
||||||
ov_topz: op.ov_topz,
|
ov_topz: op.ov_topz,
|
||||||
areas: { [widget.id]: areas.map(p => p.toArray()) },
|
areas: { [widget.id]: areas.map(p => p.toArray()) },
|
||||||
surfaces: {}
|
surfaces: {}
|
||||||
};
|
}));
|
||||||
this.op_cutout = new OpArea(state, cutout);
|
|
||||||
await this.op_cutout.slice(progress);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (let op of this.ops_list) {
|
||||||
|
await op.slice(progress);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async prepare(ops, progress) {
|
async prepare(ops, progress) {
|
||||||
await this.op_rough.prepare(ops, progress);
|
for (let op of this.ops_list) {
|
||||||
if (this.op_cutout) await this.op_cutout.prepare(ops, progress);
|
await op.prepare(ops, progress);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -555,6 +555,10 @@ self.lang['en-us'] = {
|
||||||
co_omit_l: "eliminate thru holes",
|
co_omit_l: "eliminate thru holes",
|
||||||
co_olen_s: "enable",
|
co_olen_s: "enable",
|
||||||
co_olen_l: "enabled outline cutting",
|
co_olen_l: "enabled outline cutting",
|
||||||
|
co_olin_s: "inside only",
|
||||||
|
co_olin_l: ["limit cutting to","inside part boundaries"],
|
||||||
|
co_olot_s: "outside only",
|
||||||
|
co_olot_l: ["limit cutting to","exterior part boundaries","which can be thought of","as the shadow outline"],
|
||||||
|
|
||||||
// CNC CONTOUR
|
// CNC CONTOUR
|
||||||
cn_menu: "contour",
|
cn_menu: "contour",
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue