add new uber-op: area
This commit is contained in:
parent
6c89d99bb8
commit
cc85832236
7 changed files with 80 additions and 2 deletions
|
|
@ -73,6 +73,9 @@ let UC = UI.prefix('kiri').inputAction(settings.conf.update),
|
||||||
redo: noop // do.js
|
redo: noop // do.js
|
||||||
},
|
},
|
||||||
devel = {
|
devel = {
|
||||||
|
get enabled() {
|
||||||
|
return settings.ctrl().devel;
|
||||||
|
},
|
||||||
xray(layers, raw) {
|
xray(layers, raw) {
|
||||||
let proc = api.conf.get().process,
|
let proc = api.conf.get().process,
|
||||||
size = proc.sliceHeight || proc.slaSlice || 1,
|
size = proc.sliceHeight || proc.slaSlice || 1,
|
||||||
|
|
|
||||||
|
|
@ -423,6 +423,16 @@ export const conf = {
|
||||||
camArcEnabled: false,
|
camArcEnabled: false,
|
||||||
camArcResolution: 5,
|
camArcResolution: 5,
|
||||||
camArcTolerance: 0.15,
|
camArcTolerance: 0.15,
|
||||||
|
camAreaSpindle: 1000,
|
||||||
|
camAreaTool: 1000,
|
||||||
|
camAreaType: "clear",
|
||||||
|
camAreaOver: 0.4,
|
||||||
|
camAreaDown: 1,
|
||||||
|
camAreaSpeed: 1000,
|
||||||
|
camAreaPlunge: 100,
|
||||||
|
camAreaExpand: 0,
|
||||||
|
camAreaSmooth: 1,
|
||||||
|
camAreaRefine: 0,
|
||||||
camContourAngle: 85,
|
camContourAngle: 85,
|
||||||
camContourBottom: false,
|
camContourBottom: false,
|
||||||
camContourBridge: 0,
|
camContourBridge: 0,
|
||||||
|
|
|
||||||
|
|
@ -121,6 +121,11 @@ const LISTS = {
|
||||||
{ name: "adaptive" },
|
{ name: "adaptive" },
|
||||||
{ name: "legacy 1" },
|
{ name: "legacy 1" },
|
||||||
{ name: "legacy 2" }
|
{ name: "legacy 2" }
|
||||||
|
],
|
||||||
|
opmode: [
|
||||||
|
{ name: "clear" },
|
||||||
|
{ name: "trace" },
|
||||||
|
{ name: "surface" }
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -651,4 +651,48 @@ export function createPopOps() {
|
||||||
};
|
};
|
||||||
|
|
||||||
createPopOp('|', {}).inputs = {};
|
createPopOp('|', {}).inputs = {};
|
||||||
|
|
||||||
|
createPopOp('area', {
|
||||||
|
spindle: 'camAreaSpindle',
|
||||||
|
tool: 'camAreaTool',
|
||||||
|
mode: 'camAreaMode',
|
||||||
|
over: 'camAreaOver',
|
||||||
|
down: 'camAreaDown',
|
||||||
|
rate: 'camAreaSpeed',
|
||||||
|
plunge: 'camAreaPlunge',
|
||||||
|
expand: 'camAreaExpand',
|
||||||
|
smooth: 'camAreaSmooth',
|
||||||
|
refine: 'camAreaRefine',
|
||||||
|
ov_topz: 0,
|
||||||
|
ov_botz: 0,
|
||||||
|
ov_conv: '~camConventional',
|
||||||
|
tolerance: 'camTolerance',
|
||||||
|
}).inputs = {
|
||||||
|
tool: UC.newSelect(LANG.cc_tool, {}, "tools"),
|
||||||
|
mode: UC.newSelect(LANG.mo_menu, {}, "opmode"),
|
||||||
|
sep: UC.newBlank({ class: "pop-sep" }),
|
||||||
|
spindle: UC.newInput(LANG.cc_spnd_s, { title: LANG.cc_spnd_l, convert: UC.toInt, show: hasSpindle }),
|
||||||
|
rate: UC.newInput(LANG.cc_feed_s, { title: LANG.cc_feed_l, convert: UC.toInt, units: true }),
|
||||||
|
plunge: UC.newInput(LANG.cc_plng_s, { title: LANG.cc_plng_l, convert: UC.toInt, units: true }),
|
||||||
|
sep: UC.newBlank({ class: "pop-sep" }),
|
||||||
|
over: UC.newInput(LANG.cc_sovr_s, { title: LANG.cc_sovr_l, convert: UC.toFloat, bound: UC.bound(0.01, 1.0) }),
|
||||||
|
down: UC.newInput(LANG.cc_sdwn_s, { title: LANG.cc_sdwn_l, convert: UC.toFloat, units: true }),
|
||||||
|
sep: UC.newBlank({ class: "pop-sep" }),
|
||||||
|
expand: UC.newInput(LANG.cp_xpnd_s, { title: LANG.cp_xpnd_l, convert: UC.toFloat, units: true }),
|
||||||
|
refine: UC.newInput(LANG.cp_refi_s, { title: LANG.cp_refi_l, convert: UC.toInt }),
|
||||||
|
smooth: UC.newInput(LANG.cp_smoo_s, { title: LANG.cp_smoo_l, convert: UC.toInt }),
|
||||||
|
tolerance: UC.newInput(LANG.ou_toll_s, { title: LANG.ou_toll_l, convert: UC.toFloat, bound: UC.bound(0, 10.0), units: true, round: 4 }),
|
||||||
|
exp: UC.newExpand("overrides"),
|
||||||
|
sep: UC.newBlank({ class: "pop-sep" }),
|
||||||
|
ov_topz: UC.newInput(LANG.ou_ztop_s, { title: LANG.ou_ztop_l, convert: UC.toFloat, units: true }),
|
||||||
|
ov_botz: UC.newInput(LANG.ou_zbot_s, { title: LANG.ou_zbot_l, convert: UC.toFloat, units: true }),
|
||||||
|
ov_conv: UC.newBoolean(LANG.ou_conv_s, undefined, { title: LANG.ou_conv_l }),
|
||||||
|
exp_end: UC.endExpand(),
|
||||||
|
sep: UC.newBlank({ class: "pop-sep" }),
|
||||||
|
menu: UC.newRow([
|
||||||
|
UC.newButton("edge", traceAdd),
|
||||||
|
UC.newButton("surface", surfaceAdd),
|
||||||
|
], { class: "ext-buttons f-row" }),
|
||||||
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -16,9 +16,10 @@ export function surfaceAdd(ev) {
|
||||||
return surfaceDone();
|
return surfaceDone();
|
||||||
}
|
}
|
||||||
clearPops();
|
clearPops();
|
||||||
|
let { surfaces, follow } = env.poppedRec;
|
||||||
|
let { edgeangle } = api.conf.get().controller;
|
||||||
alert = api.show.alert("analyzing surfaces...", 1000);
|
alert = api.show.alert("analyzing surfaces...", 1000);
|
||||||
let surfaces = env.poppedRec.surfaces;
|
let radians = (follow ?? edgeangle) * DEG2RAD;
|
||||||
let radians = env.poppedRec.follow * DEG2RAD;
|
|
||||||
CAM.surface_prep(env.currentIndex * RAD2DEG, () => {
|
CAM.surface_prep(env.currentIndex * RAD2DEG, () => {
|
||||||
api.hide.alert(alert);
|
api.hide.alert(alert);
|
||||||
alert = api.show.alert("[esc] cancels surface selection");
|
alert = api.show.alert("[esc] cancels surface selection");
|
||||||
|
|
|
||||||
|
|
@ -189,6 +189,15 @@ const opAddHelical = () => {
|
||||||
opAdd(rec);
|
opAdd(rec);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const opAddArea = () => {
|
||||||
|
traceDone();
|
||||||
|
surfaceDone();
|
||||||
|
let rec = env.popOp.area.new();
|
||||||
|
rec.areas = { /* widget.id: [ polygons... ] */ };
|
||||||
|
rec.surfaces = { /* widget.id: [ faces... ] */ };
|
||||||
|
opAdd(rec);
|
||||||
|
};
|
||||||
|
|
||||||
const opAddContour = (axis) => {
|
const opAddContour = (axis) => {
|
||||||
let rec = env.popOp.contour.new();
|
let rec = env.popOp.contour.new();
|
||||||
rec.axis = axis.toUpperCase();
|
rec.axis = axis.toUpperCase();
|
||||||
|
|
@ -517,6 +526,10 @@ export function opRender() {
|
||||||
|
|
||||||
export function init() {
|
export function init() {
|
||||||
|
|
||||||
|
if (api.devel.enabled) {
|
||||||
|
$('op:area').classList.remove('hide');
|
||||||
|
}
|
||||||
|
|
||||||
api.event.on('tool.mesh.face-normal', normal => {
|
api.event.on('tool.mesh.face-normal', normal => {
|
||||||
// console.log({ env.poppedRec });
|
// console.log({ env.poppedRec });
|
||||||
env.poppedRec.degrees = (Math.atan2(normal.y, normal.z) * RAD2DEG).round(2);
|
env.poppedRec.degrees = (Math.atan2(normal.y, normal.z) * RAD2DEG).round(2);
|
||||||
|
|
@ -764,6 +777,7 @@ export function init() {
|
||||||
case "trace": return opAddTrace();
|
case "trace": return opAddTrace();
|
||||||
case "pocket": return opAddPocket();
|
case "pocket": return opAddPocket();
|
||||||
case "helical": return opAddHelical();
|
case "helical": return opAddHelical();
|
||||||
|
case "area": return opAddArea();
|
||||||
case "flip":
|
case "flip":
|
||||||
// only one flip op permitted
|
// only one flip op permitted
|
||||||
for (let op of env.current.process.ops) {
|
for (let op of env.current.process.ops) {
|
||||||
|
|
|
||||||
|
|
@ -461,6 +461,7 @@
|
||||||
<div title="2.5D tracing along X or Y axis used for complex part features">contour</div>
|
<div title="2.5D tracing along X or Y axis used for complex part features">contour</div>
|
||||||
<div title="clear areas above selected surfaces">pocket</div>
|
<div title="clear areas above selected surfaces">pocket</div>
|
||||||
<div title="follow a helix around circular paths">helical</div>
|
<div title="follow a helix around circular paths">helical</div>
|
||||||
|
<div title="perform configurable operations on selected areas" id="op:area" class="hide">area</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue