diff --git a/src/cli/kiri-cam-process.json b/src/cli/kiri-cam-process.json index e9be91ab..b1457afa 100644 --- a/src/cli/kiri-cam-process.json +++ b/src/cli/kiri-cam-process.json @@ -97,6 +97,7 @@ "top": false }], "camTrueShadow": false, + "camArcTolerance": 0.01, "camDrillMark": true, "camPocketSpindle": 1000, "camPocketTool": 1665454124874, diff --git a/src/kiri-mode/cam/prepare.js b/src/kiri-mode/cam/prepare.js index ea2b6d8b..a464282c 100644 --- a/src/kiri-mode/cam/prepare.js +++ b/src/kiri-mode/cam/prepare.js @@ -96,6 +96,7 @@ function prepEach(widget, settings, print, firstPoint, update) { easeAngle = process.camEaseAngle, depthFirst = process.camDepthFirst, engageFactor = process.camFullEngage, + arcTolerance = process.camArcTolerance, tolerance = 0, drillDown = 0, drillLift = 0, @@ -726,8 +727,8 @@ function prepEach(widget, settings, print, firstPoint, update) { * @returns {Point} - the last point of the polygon */ function polyEmit(poly, index, count, fromPoint) { - const arcDist = 0.05, // allowable distance between circle centers - arcRes = 8, //8 degs max + //arcTolerance is the allowable distance between circle centers + let arcRes = 8, //8 degs max arcMax = Infinity; // no max arc radius fromPoint = fromPoint || printPoint; @@ -783,7 +784,7 @@ function prepEach(widget, settings, print, firstPoint, update) { // console.log("start",point,lastp) let dist = lastp? point.distTo2D(lastp) : 0; if (lastp) { - if (dist >arcDist && lastp) { + if (dist >arcTolerance && lastp) { let rec = Object.assign(point,{dist}); arcQ.push(rec); let desp = false; // do arcQ[0] and rec have differing move speeds? @@ -835,9 +836,9 @@ function prepEach(widget, settings, print, firstPoint, update) { dc = Math.hypot(dx, dy); // delta center distance } // if new point is off the arc - // if (deem || depm || desp || dc > arcDist || cc.r < arcMin || cc.r > arcMax || dist > cc.r) { - if ( desp || dc * arcQ.center.length / arcQ.rSum > arcDist || dist > cc.r || cc.r > arcMax || radFault ) { - // let debug = [deem, depm, desp, dc * arcQ.center.length / arcQ.rSum > arcDist, dist > cc.r, cc.r > arcMax, radFault]; + // if (deem || depm || desp || dc > arcTolerance || cc.r < arcMin || cc.r > arcMax || dist > cc.r) { + if ( desp || dc * arcQ.center.length / arcQ.rSum > arcTolerance || dist > cc.r || cc.r > arcMax || radFault ) { + // let debug = [deem, depm, desp, dc * arcQ.center.length / arcQ.rSum > arcTolerance, dist > cc.r, cc.r > arcMax, radFault]; // console.log("point off the arc,",structuredClone(arcQ),); if (arcQ.length === 4) { // not enough points for an arc, drop first point and recalc center @@ -889,7 +890,7 @@ function prepEach(widget, settings, print, firstPoint, update) { function drainQ() { - if (!arcDist) { + if (!arcTolerance) { return; } if (arcQ.length > 4) { diff --git a/src/kiri/conf.js b/src/kiri/conf.js index 1830281f..3fcb2bb6 100644 --- a/src/kiri/conf.js +++ b/src/kiri/conf.js @@ -578,6 +578,7 @@ const conf = exports({ outputInvertY: false, camExpertFast: false, camTrueShadow: false, + camArcTolerance: 0.05, camForceZMax: false, camFirstZMax: false, camToolInit: true, diff --git a/src/kiri/init.js b/src/kiri/init.js index 5efc145e..2742aae1 100644 --- a/src/kiri/init.js +++ b/src/kiri/init.js @@ -1281,6 +1281,7 @@ gapp.register("kiri.init", (root, exports) => { _____: newGroup(LANG.op_xprt_s, $('cam-expert'), { group:"cam_expert", modes:CAM, marker: false, driven, separator }), camExpertFast: newBoolean(LANG.cx_fast_s, onBooleanClick, {title:LANG.cx_fast_l, show: () => !ui.camTrueShadow.checked }), camTrueShadow: newBoolean(LANG.cx_true_s, onBooleanClick, {title:LANG.cx_true_l, show: () => !ui.camExpertFast.checked }), + camArcTolerance: newInput(LANG.ad_arct_s, {title:LANG.ad_arct_l, convert:toFloat, bound:bound(0,100)}), /** LASER/DRAG/WJET/WEDM cut tool Settings */