From b9597cc0964d91c713e04ff3d86f497fb20de593 Mon Sep 17 00:00:00 2001 From: Stewart Allen Date: Sat, 15 Aug 2020 17:32:09 -0400 Subject: [PATCH] add 'z thru' option for cleaner cutouts --- src/kiri/conf.js | 1 + src/kiri/init.js | 1 + src/mode/cam/driver.js | 19 +++++++++++++++++++ web/kiri/lang/en.js | 2 ++ 4 files changed, 23 insertions(+) diff --git a/src/kiri/conf.js b/src/kiri/conf.js index b5770f3d..f829a6ec 100644 --- a/src/kiri/conf.js +++ b/src/kiri/conf.js @@ -444,6 +444,7 @@ camZTopOffset: 0, camZBottom: 0, camZClearance: 1, + camZThru: 0, camFastFeed: 6000, camFastFeedZ: 300, camTolerance: 0.15, diff --git a/src/kiri/init.js b/src/kiri/init.js index a6824d14..ca6ccc8f 100644 --- a/src/kiri/init.js +++ b/src/kiri/init.js @@ -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}), diff --git a/src/mode/cam/driver.js b/src/mode/cam/driver.js index 12e6c13e..7afcdb30 100644 --- a/src/mode/cam/driver.js +++ b/src/mode/cam/driver.js @@ -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); } } diff --git a/web/kiri/lang/en.js b/web/kiri/lang/en.js index 99cf41a4..27d72651 100644 --- a/web/kiri/lang/en.js +++ b/web/kiri/lang/en.js @@ -353,6 +353,8 @@ kiri.lang['en-us'] = { ou_zbot_l: "offset from part bottom\nto limit cutting depth\nin workspace units", ou_zclr_s: "z clearance", ou_zclr_l: "travel offset from z top\nin workspace units", + ou_ztru_s: "z thru", + ou_ztru_l: "extend cutout pass down\nin workspace units", ou_conv_s: "conventional", ou_conv_l: "milling direction\nuncheck for 'climb'", ou_depf_s: "depth first",