From fcc247a4e07e5d11ce871255efdefb7af8581372 Mon Sep 17 00:00:00 2001 From: Stewart Allen Date: Sat, 6 Mar 2021 15:26:41 -0500 Subject: [PATCH] fix contour cutting corners --- src/mode/cam/ops.js | 7 ++++--- src/mode/cam/prepare.js | 6 +++--- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/mode/cam/ops.js b/src/mode/cam/ops.js index 465a3cce..0c8d515a 100644 --- a/src/mode/cam/ops.js +++ b/src/mode/cam/ops.js @@ -647,7 +647,8 @@ let { settings, widget } = state; let { process } = settings; - let toolDiam = this.toolDiam; + let toolDiam = this.toolDiam = new CAM.Tool(settings, op.tool).fluteDiameter(); + let stepover = toolDiam * op.step * 2; let cutdir = process.camConventional; let depthFirst = process.camDepthFirst; let depthData = []; @@ -674,7 +675,7 @@ poly.reverse(); } poly.forEachPoint(function(point, pidx) { - camOut(point.clone(), pidx > 0); + camOut(point.clone(), pidx > 0, stepover); }, false); }); newLayer(); @@ -688,7 +689,7 @@ poly.reverse(); } poly.forEachPoint(function(point, pidx) { - camOut(point.clone(), pidx > 0); + camOut(point.clone(), pidx > 0, stepover); }, false); newLayer(); return lastPoint(); diff --git a/src/mode/cam/prepare.js b/src/mode/cam/prepare.js index a5ebc0f3..91d43b38 100644 --- a/src/mode/cam/prepare.js +++ b/src/mode/cam/prepare.js @@ -231,7 +231,7 @@ ); } - function camOut(point, cut) { + function camOut(point, cut, moveLen = toolDiamMove) { point = point.clone(); point.x += wmx; point.y += wmy; @@ -264,7 +264,7 @@ } // convert short planar moves to cuts in some cases - if (isMove && deltaXY <= toolDiamMove) { + if (isMove && deltaXY <= moveLen) { let iscontour = tolerance > 0; let isflat = absDeltaZ < 0.001; // restrict this to contouring @@ -279,7 +279,7 @@ } } else if (isMove) { // for longer moves, check the terrain to see if we need to go up and over - const bigXY = (deltaXY > toolDiamMove); + const bigXY = (deltaXY > moveLen); const bigZ = (deltaZ > toolDiam/2 && deltaXY > tolerance); const midZ = (absDeltaZ >= tolerance); if ((bigXY || bigZ) && (isMove || midZ)) {