add contour filtering
This commit is contained in:
parent
c391bae399
commit
614c049b2a
4 changed files with 28 additions and 2 deletions
|
|
@ -1301,6 +1301,8 @@ CAM.init = function(kiri, api) {
|
||||||
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 }}),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const contourFilter = gcodeEditor('Layer Filter', 'filter');
|
||||||
|
|
||||||
createPopOp('contour', {
|
createPopOp('contour', {
|
||||||
tool: 'camContourTool',
|
tool: 'camContourTool',
|
||||||
spindle: 'camContourSpindle',
|
spindle: 'camContourSpindle',
|
||||||
|
|
@ -1315,6 +1317,7 @@ CAM.init = function(kiri, api) {
|
||||||
bottom: 'camContourBottom',
|
bottom: 'camContourBottom',
|
||||||
curves: 'camContourCurves',
|
curves: 'camContourCurves',
|
||||||
inside: 'camContourIn',
|
inside: 'camContourIn',
|
||||||
|
filter: 'camContourFilter',
|
||||||
axis: 'X'
|
axis: 'X'
|
||||||
}).inputs = {
|
}).inputs = {
|
||||||
tool: UC.newSelect(LANG.cc_tool, {}, "tools"),
|
tool: UC.newSelect(LANG.cc_tool, {}, "tools"),
|
||||||
|
|
@ -1334,7 +1337,8 @@ CAM.init = function(kiri, api) {
|
||||||
sep: UC.newBlank({class:"pop-sep"}),
|
sep: UC.newBlank({class:"pop-sep"}),
|
||||||
curves: UC.newBoolean(LANG.cf_curv_s, undefined, {title:LANG.cf_curv_l}),
|
curves: UC.newBoolean(LANG.cf_curv_s, undefined, {title:LANG.cf_curv_l}),
|
||||||
inside: UC.newBoolean(LANG.cf_olin_s, undefined, {title:LANG.cf_olin_l}),
|
inside: UC.newBoolean(LANG.cf_olin_s, undefined, {title:LANG.cf_olin_l}),
|
||||||
bottom: UC.newBoolean(LANG.cf_botm_s, undefined, {title:LANG.cf_botm_l, show:(op,conf) => conf ? conf.process.camZBottom : 0})
|
bottom: UC.newBoolean(LANG.cf_botm_s, undefined, {title:LANG.cf_botm_l, show:(op,conf) => conf ? conf.process.camZBottom : 0}),
|
||||||
|
filter: UC.newRow([ UC.newButton(LANG.filter, contourFilter) ], {class:"ext-buttons f-row"})
|
||||||
};
|
};
|
||||||
|
|
||||||
createPopOp('lathe', {
|
createPopOp('lathe', {
|
||||||
|
|
|
||||||
|
|
@ -757,6 +757,26 @@ class OpContour extends CamOp {
|
||||||
async slice(progress) {
|
async slice(progress) {
|
||||||
let { op, state } = this;
|
let { op, state } = this;
|
||||||
let { addSlices } = state;
|
let { addSlices } = state;
|
||||||
|
let filter = slices => slices;
|
||||||
|
if (op.filter) {
|
||||||
|
try {
|
||||||
|
const obj = eval(`( ${op.filter.join('\n')} )`);
|
||||||
|
let idx = 0;
|
||||||
|
if (obj && obj.slices) {
|
||||||
|
const nadd = [];
|
||||||
|
filter = function(slices) {
|
||||||
|
for (let slice of slices) {
|
||||||
|
if (obj.slices(slice, idx++)) {
|
||||||
|
nadd.push(slice);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return nadd;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
console.log('filter parse error', e, op.filter);
|
||||||
|
}
|
||||||
|
}
|
||||||
// we need topo for safe travel moves when roughing and outlining
|
// we need topo for safe travel moves when roughing and outlining
|
||||||
// not generated when drilling-only. then all z moves use bounds max.
|
// not generated when drilling-only. then all z moves use bounds max.
|
||||||
// also generates x and y contouring when selected
|
// also generates x and y contouring when selected
|
||||||
|
|
@ -766,6 +786,7 @@ class OpContour extends CamOp {
|
||||||
progress(index / total, msg);
|
progress(index / total, msg);
|
||||||
},
|
},
|
||||||
ondone: (slices) => {
|
ondone: (slices) => {
|
||||||
|
slices = filter(slices);
|
||||||
this.sliceOut = slices;
|
this.sliceOut = slices;
|
||||||
addSlices(slices);
|
addSlices(slices);
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -346,7 +346,7 @@ function prepEach(widget, settings, print, firstPoint, update) {
|
||||||
// new pos for plunge calc
|
// new pos for plunge calc
|
||||||
deltaXY = 0;
|
deltaXY = 0;
|
||||||
}
|
}
|
||||||
} else if (isMove && ['lathe','contour'].contains(currentOp.type)) {
|
} else if (isMove && ['lathe'].contains(currentOp.type)) {
|
||||||
if (point.z > lastPoint.z) {
|
if (point.z > lastPoint.z) {
|
||||||
layerPush(lastPoint.clone().setZ(point.z), 0, 0, tool.getNumber());
|
layerPush(lastPoint.clone().setZ(point.z), 0, 0, tool.getNumber());
|
||||||
} else if (point.z < lastPoint.z) {
|
} else if (point.z < lastPoint.z) {
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,7 @@ self.kiri.lang['en-us'] = {
|
||||||
disable: "disable",
|
disable: "disable",
|
||||||
export: "export",
|
export: "export",
|
||||||
files: "files",
|
files: "files",
|
||||||
|
filter: "filter",
|
||||||
fullscreen: "fullscreen",
|
fullscreen: "fullscreen",
|
||||||
help: "help",
|
help: "help",
|
||||||
ghost: "ghost", // left render pop menu (wireframe)
|
ghost: "ghost", // left render pop menu (wireframe)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue