add 'z thru' option for cleaner cutouts

This commit is contained in:
Stewart Allen 2020-08-15 17:32:09 -04:00
commit b9597cc096
4 changed files with 23 additions and 0 deletions

View file

@ -444,6 +444,7 @@
camZTopOffset: 0,
camZBottom: 0,
camZClearance: 1,
camZThru: 0,
camFastFeed: 6000,
camFastFeedZ: 300,
camTolerance: 0.15,

View file

@ -1449,6 +1449,7 @@
camZTopOffset: UC.newInput(LANG.ou_ztof_s, {title:LANG.ou_ztof_l, convert:UC.toFloat, modes:CAM}),
camZBottom: UC.newInput(LANG.ou_zbot_s, {title:LANG.ou_zbot_l, convert:UC.toFloat, modes:CAM}),
camZClearance: UC.newInput(LANG.ou_zclr_s, {title:LANG.ou_zclr_l, convert:UC.toFloat, bound:UC.bound(0.01,100), modes:CAM}),
camZThru: UC.newInput(LANG.ou_ztru_s, {title:LANG.ou_ztru_l, convert:UC.toFloat, bound:UC.bound(0.0,100), modes:CAM}),
camFastFeedZ: UC.newInput(LANG.cc_rzpd_s, {title:LANG.cc_rzpd_l, convert:UC.toInt, modes:CAM}),
camFastFeed: UC.newInput(LANG.cc_rapd_s, {title:LANG.cc_rapd_l, convert:UC.toInt, modes:CAM}),
camTolerance: UC.newInput(LANG.ou_toll_s, {title:LANG.ou_toll_l, convert:UC.toFloat, bound:UC.bound(0.001,1.0), modes:CAM}),

View file

@ -882,6 +882,7 @@
bounds = widget.getBoundingBox(),
mesh = widget.mesh,
zMin = Math.max(bounds.min.z, proc.camZBottom) * units,
zThru = (proc.camZThru || 0) * units,
camRoughStock = proc.camRoughStock * units,
shellRough,
shellOutline,
@ -986,6 +987,18 @@
slice.tops[0].traces = nutrace;
}
// extend bottom cutout
const addZThru = function(selected) {
let last = selected[selected.length-1];
let add = last.clone(true);
add.camMode = last.camMode;
add.z -= zThru;
add.tops.forEach(top => {
top.poly.setZ(add.z);
});
selected.push(add);
};
// called when z-index slicing complete
const camSlicesDone = function(slices) {
@ -1049,6 +1062,9 @@
if (procRough) {
let selected = [];
selectSlices(slices, proc.camRoughDown * units, CPRO.ROUGH, selected);
if (zThru) {
addZThru(selected);
}
sliceAll.appendAll(selected);
if (!proc.camRoughVoid) {
thruHoles = holes(slices, roughToolDiam + camRoughStock);
@ -1058,6 +1074,9 @@
if (procOutline) {
let selected = [];
selectSlices(slices, proc.camOutlineDown * units, CPRO.OUTLINE, selected);
if (zThru) {
addZThru(selected);
}
sliceAll.appendAll(selected);
}
}