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 }}),
|
||||
};
|
||||
|
||||
const contourFilter = gcodeEditor('Layer Filter', 'filter');
|
||||
|
||||
createPopOp('contour', {
|
||||
tool: 'camContourTool',
|
||||
spindle: 'camContourSpindle',
|
||||
|
|
@ -1315,6 +1317,7 @@ CAM.init = function(kiri, api) {
|
|||
bottom: 'camContourBottom',
|
||||
curves: 'camContourCurves',
|
||||
inside: 'camContourIn',
|
||||
filter: 'camContourFilter',
|
||||
axis: 'X'
|
||||
}).inputs = {
|
||||
tool: UC.newSelect(LANG.cc_tool, {}, "tools"),
|
||||
|
|
@ -1334,7 +1337,8 @@ CAM.init = function(kiri, api) {
|
|||
sep: UC.newBlank({class:"pop-sep"}),
|
||||
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}),
|
||||
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', {
|
||||
|
|
|
|||
|
|
@ -757,6 +757,26 @@ class OpContour extends CamOp {
|
|||
async slice(progress) {
|
||||
let { op, state } = this;
|
||||
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
|
||||
// not generated when drilling-only. then all z moves use bounds max.
|
||||
// also generates x and y contouring when selected
|
||||
|
|
@ -766,6 +786,7 @@ class OpContour extends CamOp {
|
|||
progress(index / total, msg);
|
||||
},
|
||||
ondone: (slices) => {
|
||||
slices = filter(slices);
|
||||
this.sliceOut = slices;
|
||||
addSlices(slices);
|
||||
},
|
||||
|
|
|
|||
|
|
@ -346,7 +346,7 @@ function prepEach(widget, settings, print, firstPoint, update) {
|
|||
// new pos for plunge calc
|
||||
deltaXY = 0;
|
||||
}
|
||||
} else if (isMove && ['lathe','contour'].contains(currentOp.type)) {
|
||||
} else if (isMove && ['lathe'].contains(currentOp.type)) {
|
||||
if (point.z > lastPoint.z) {
|
||||
layerPush(lastPoint.clone().setZ(point.z), 0, 0, tool.getNumber());
|
||||
} else if (point.z < lastPoint.z) {
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ self.kiri.lang['en-us'] = {
|
|||
disable: "disable",
|
||||
export: "export",
|
||||
files: "files",
|
||||
filter: "filter",
|
||||
fullscreen: "fullscreen",
|
||||
help: "help",
|
||||
ghost: "ghost", // left render pop menu (wireframe)
|
||||
|
|
|
|||
Loading…
Reference in a new issue