From 2647d17d65717f5ef11f74eaea044b3fffcfb915 Mon Sep 17 00:00:00 2001 From: Stewart Allen Date: Wed, 16 Dec 2020 23:08:52 -0500 Subject: [PATCH] fix contourin output and contour tolerance --- src/mode/cam/ops.js | 15 ++++++++++----- src/mode/cam/prepare.js | 7 ++++++- src/mode/cam/topo.js | 2 ++ 3 files changed, 18 insertions(+), 6 deletions(-) diff --git a/src/mode/cam/ops.js b/src/mode/cam/ops.js index c370d2b2..bbca9701 100644 --- a/src/mode/cam/ops.js +++ b/src/mode/cam/ops.js @@ -513,7 +513,7 @@ // we need topo for safe travel moves when roughing and outlining // not generated when drilling-only. then all z moves use bounds max. // also generates x and y contouring when selected - new CAM.Topo({ + let topo = new CAM.Topo({ // onupdate: (update, msg) => { onupdate: (index, total, msg) => { progress(index / total, msg); @@ -525,13 +525,16 @@ contour: op, state: state }); + // computed if set to 0 + this.tolerance = topo.tolerance; } prepare(ops, progress) { let { op, state, sliceOut } = this; - let { setTool, setSpindle, setPrintPoint } = ops; - let { polyEmit, poly2polyEmit } = ops; - let { camOut, newLayer, printPoint } = ops; + let { setTolerance, setTool, setSpindle, setPrintPoint } = ops; + let { polyEmit, poly2polyEmit, tip2tipEmit } = ops; + let { camOut, newLayer, printPoint, lastPoint } = ops; + let { bounds, zmax } = ops; let { settings, widget } = state; let { process } = settings; @@ -542,10 +545,12 @@ setTool(op.tool, op.rate, op.plunge); setSpindle(op.spindle); + setTolerance(this.tolerance); printPoint = newPoint(bounds.min.x,bounds.min.y,zmax); for (let slice of sliceOut) { + if (!slice.camLines) continue; let polys = [], poly, emit; slice.camLines.forEach(function (poly) { if (depthFirst) poly = poly.clone(true); @@ -577,7 +582,7 @@ camOut(point.clone(), pidx > 0); }, false); newLayer(); - return lastPoint; + return lastPoint(); }); } diff --git a/src/mode/cam/prepare.js b/src/mode/cam/prepare.js index b03cbd1b..97e07711 100644 --- a/src/mode/cam/prepare.js +++ b/src/mode/cam/prepare.js @@ -357,16 +357,21 @@ setTool, setDrill, setSpindle, + setTolerance, setPrintPoint, printPoint, newLayer, camOut, polyEmit, poly2polyEmit, + tip2tipEmit, depthRoughPath, depthOutlinePath, emitDrills, - emitTrace + emitTrace, + bounds, + zmax, + lastPoint: () => { return lastPoint } }; let opSum = 0; diff --git a/src/mode/cam/topo.js b/src/mode/cam/topo.js index c736e3a8..0b35543f 100644 --- a/src/mode/cam/topo.js +++ b/src/mode/cam/topo.js @@ -79,6 +79,8 @@ console.log(`contour auto tolerance`,resolution.round(4)); } + this.tolerance = resolution; + if (tabs) { clipTab.appendAll(tabs.map(tab => { let ctab = POLY.expand([tab.poly], toolDiameter/2);