add wide cutout option

This commit is contained in:
Stewart Allen 2020-07-30 19:58:03 -04:00
commit 55f818f9ef
4 changed files with 20 additions and 5 deletions

View file

@ -438,6 +438,7 @@
camRoughPocket: false, // camPocketOnlyRough
camOutlinePocket: false, // camPocketOnlyFinish
camDepthFirst: true,
camWideCutout: false,
camEaseDown: false,
camOriginTop: true,
camZTopOffset: 0,

View file

@ -1440,6 +1440,7 @@
camConventional: UC.newBoolean(LANG.ou_conv_s, onBooleanClick, {title:LANG.ou_conv_l, modes:CAM}),
camEaseDown: UC.newBoolean(LANG.cr_ease_s, onBooleanClick, {title:LANG.cr_ease_l, modes:CAM}),
camDepthFirst: UC.newBoolean(LANG.ou_depf_s, onBooleanClick, {title:LANG.ou_depf_l, modes:CAM}),
camWideCutout: UC.newBoolean(LANG.ou_wide_s, onBooleanClick, {title:LANG.ou_wide_l, modes:CAM}),
outputOriginBounds: UC.newBoolean(LANG.or_bnds_s, onBooleanClick, {title:LANG.or_bnds_l, modes:LASER}),
outputOriginCenter: UC.newBoolean(LANG.or_cntr_s, onBooleanClick, {title:LANG.or_cntr_l, modes:CAM_LASER}),
camOriginTop: UC.newBoolean(LANG.or_topp_s, onBooleanClick, {title:LANG.or_topp_l, modes:CAM}),

View file

@ -677,9 +677,10 @@
* @param {number} stock to leave (mm)
* @param {number} percent overlap on each pass
* @param {boolean} true for pocket only mode
* @param {boolean} widecut expand outer cutout
* @returns {Object} shell or newly generated shell
*/
function createRoughPaths(slice, shell, diameter, stock, overlap, pocket, holes) {
function createRoughPaths(slice, shell, diameter, stock, overlap, pocket, holes, widecut) {
let tops = slice.gatherTopPolys([]).clone(true),
outer = [],
offset = [];
@ -716,6 +717,10 @@
// re-nest offset polys
// outer = POLY.nest(offset);
outer = offset;
// more outer
if (widecut) {
POLY.expand(offset, diameter * overlap, slice.z, outer, 1);
}
}
slice.tops[0].traces = outer;
@ -801,8 +806,9 @@
* @param {Polygon[]} outermost pancacked shells for fill
* @param {number} tool diameter
* @param {boolean} pocket only
* @param {boolean} widecut expand outer cutout
*/
function createOutlinePaths(slice, shell, diameter, pocket) {
function createOutlinePaths(slice, shell, diameter, pocket, widecut) {
if (slice.tops.length === 0) return shell;
let tops = slice.gatherTopPolys([]).clone(true),
@ -822,6 +828,10 @@
}
return poly;
});
} else if (widecut) {
offset.slice().forEach(op => {
POLY.expand([op], diameter * 0.5, slice.z, offset, 1);
});
}
const output = POLY.flatten(offset, [], true);
@ -876,7 +886,8 @@
shellRough,
shellOutline,
facePolys,
thruHoles;
thruHoles,
wideCut = proc.camWideCutout;
if (settings.stock.x + 0.00001 < bounds.max.x - bounds.min.x) {
return ondone('stock X too small for part. disable stock or use offset stock');
@ -1089,11 +1100,11 @@
createLevelPaths(slice, facePolys, roughToolDiam, proc.camRoughOver, pocketOnlyRough);
break;
case CPRO.ROUGH:
createRoughPaths(slice, shellRough, roughToolDiam, camRoughStock, proc.camRoughOver, pocketOnlyRough, thruHoles);
createRoughPaths(slice, shellRough, roughToolDiam, camRoughStock, proc.camRoughOver, pocketOnlyRough, thruHoles, wideCut);
if (addTabsRough) addCutoutTabs(slice, roughToolDiam);
break;
case CPRO.OUTLINE:
createOutlinePaths(slice, shellOutline, outlineToolDiam, pocketOnlyOutline);
createOutlinePaths(slice, shellOutline, outlineToolDiam, pocketOnlyOutline, wideCut);
if (addTabsOutline) addCutoutTabs(slice, outlineToolDiam);
if (traceToolProfile) findTracingPaths(widget, slice, traceTool, traceToolProfile);
break;

View file

@ -357,6 +357,8 @@ kiri.lang['en-us'] = {
ou_conv_l: "milling direction\nuncheck for 'climb'",
ou_depf_s: "depth first",
ou_depf_l: "optimize pocket cuts\nwith depth priority",
ou_wide_s: "wide cutout",
ou_wide_l: "widen outside cutout paths\nfor deep cuts in hard material",
// CAM STOCK
cs_menu: "stock",