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 camRoughPocket: false, // camPocketOnlyRough
camOutlinePocket: false, // camPocketOnlyFinish camOutlinePocket: false, // camPocketOnlyFinish
camDepthFirst: true, camDepthFirst: true,
camWideCutout: false,
camEaseDown: false, camEaseDown: false,
camOriginTop: true, camOriginTop: true,
camZTopOffset: 0, camZTopOffset: 0,

View file

@ -1440,6 +1440,7 @@
camConventional: UC.newBoolean(LANG.ou_conv_s, onBooleanClick, {title:LANG.ou_conv_l, modes:CAM}), 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}), 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}), 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}), 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}), 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}), 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} stock to leave (mm)
* @param {number} percent overlap on each pass * @param {number} percent overlap on each pass
* @param {boolean} true for pocket only mode * @param {boolean} true for pocket only mode
* @param {boolean} widecut expand outer cutout
* @returns {Object} shell or newly generated shell * @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), let tops = slice.gatherTopPolys([]).clone(true),
outer = [], outer = [],
offset = []; offset = [];
@ -716,6 +717,10 @@
// re-nest offset polys // re-nest offset polys
// outer = POLY.nest(offset); // outer = POLY.nest(offset);
outer = offset; outer = offset;
// more outer
if (widecut) {
POLY.expand(offset, diameter * overlap, slice.z, outer, 1);
}
} }
slice.tops[0].traces = outer; slice.tops[0].traces = outer;
@ -801,8 +806,9 @@
* @param {Polygon[]} outermost pancacked shells for fill * @param {Polygon[]} outermost pancacked shells for fill
* @param {number} tool diameter * @param {number} tool diameter
* @param {boolean} pocket only * @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; if (slice.tops.length === 0) return shell;
let tops = slice.gatherTopPolys([]).clone(true), let tops = slice.gatherTopPolys([]).clone(true),
@ -822,6 +828,10 @@
} }
return poly; 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); const output = POLY.flatten(offset, [], true);
@ -876,7 +886,8 @@
shellRough, shellRough,
shellOutline, shellOutline,
facePolys, facePolys,
thruHoles; thruHoles,
wideCut = proc.camWideCutout;
if (settings.stock.x + 0.00001 < bounds.max.x - bounds.min.x) { 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'); 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); createLevelPaths(slice, facePolys, roughToolDiam, proc.camRoughOver, pocketOnlyRough);
break; break;
case CPRO.ROUGH: 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); if (addTabsRough) addCutoutTabs(slice, roughToolDiam);
break; break;
case CPRO.OUTLINE: case CPRO.OUTLINE:
createOutlinePaths(slice, shellOutline, outlineToolDiam, pocketOnlyOutline); createOutlinePaths(slice, shellOutline, outlineToolDiam, pocketOnlyOutline, wideCut);
if (addTabsOutline) addCutoutTabs(slice, outlineToolDiam); if (addTabsOutline) addCutoutTabs(slice, outlineToolDiam);
if (traceToolProfile) findTracingPaths(widget, slice, traceTool, traceToolProfile); if (traceToolProfile) findTracingPaths(widget, slice, traceTool, traceToolProfile);
break; break;

View file

@ -357,6 +357,8 @@ kiri.lang['en-us'] = {
ou_conv_l: "milling direction\nuncheck for 'climb'", ou_conv_l: "milling direction\nuncheck for 'climb'",
ou_depf_s: "depth first", ou_depf_s: "depth first",
ou_depf_l: "optimize pocket cuts\nwith depth priority", 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 // CAM STOCK
cs_menu: "stock", cs_menu: "stock",