fix contourin output and contour tolerance

This commit is contained in:
Stewart Allen 2020-12-16 23:08:52 -05:00
commit 2647d17d65
3 changed files with 18 additions and 6 deletions

View file

@ -513,7 +513,7 @@
// we need topo for safe travel moves when roughing and outlining // we need topo for safe travel moves when roughing and outlining
// not generated when drilling-only. then all z moves use bounds max. // not generated when drilling-only. then all z moves use bounds max.
// also generates x and y contouring when selected // also generates x and y contouring when selected
new CAM.Topo({ let topo = new CAM.Topo({
// onupdate: (update, msg) => { // onupdate: (update, msg) => {
onupdate: (index, total, msg) => { onupdate: (index, total, msg) => {
progress(index / total, msg); progress(index / total, msg);
@ -525,13 +525,16 @@
contour: op, contour: op,
state: state state: state
}); });
// computed if set to 0
this.tolerance = topo.tolerance;
} }
prepare(ops, progress) { prepare(ops, progress) {
let { op, state, sliceOut } = this; let { op, state, sliceOut } = this;
let { setTool, setSpindle, setPrintPoint } = ops; let { setTolerance, setTool, setSpindle, setPrintPoint } = ops;
let { polyEmit, poly2polyEmit } = ops; let { polyEmit, poly2polyEmit, tip2tipEmit } = ops;
let { camOut, newLayer, printPoint } = ops; let { camOut, newLayer, printPoint, lastPoint } = ops;
let { bounds, zmax } = ops;
let { settings, widget } = state; let { settings, widget } = state;
let { process } = settings; let { process } = settings;
@ -542,10 +545,12 @@
setTool(op.tool, op.rate, op.plunge); setTool(op.tool, op.rate, op.plunge);
setSpindle(op.spindle); setSpindle(op.spindle);
setTolerance(this.tolerance);
printPoint = newPoint(bounds.min.x,bounds.min.y,zmax); printPoint = newPoint(bounds.min.x,bounds.min.y,zmax);
for (let slice of sliceOut) { for (let slice of sliceOut) {
if (!slice.camLines) continue;
let polys = [], poly, emit; let polys = [], poly, emit;
slice.camLines.forEach(function (poly) { slice.camLines.forEach(function (poly) {
if (depthFirst) poly = poly.clone(true); if (depthFirst) poly = poly.clone(true);
@ -577,7 +582,7 @@
camOut(point.clone(), pidx > 0); camOut(point.clone(), pidx > 0);
}, false); }, false);
newLayer(); newLayer();
return lastPoint; return lastPoint();
}); });
} }

View file

@ -357,16 +357,21 @@
setTool, setTool,
setDrill, setDrill,
setSpindle, setSpindle,
setTolerance,
setPrintPoint, setPrintPoint,
printPoint, printPoint,
newLayer, newLayer,
camOut, camOut,
polyEmit, polyEmit,
poly2polyEmit, poly2polyEmit,
tip2tipEmit,
depthRoughPath, depthRoughPath,
depthOutlinePath, depthOutlinePath,
emitDrills, emitDrills,
emitTrace emitTrace,
bounds,
zmax,
lastPoint: () => { return lastPoint }
}; };
let opSum = 0; let opSum = 0;

View file

@ -79,6 +79,8 @@
console.log(`contour auto tolerance`,resolution.round(4)); console.log(`contour auto tolerance`,resolution.round(4));
} }
this.tolerance = resolution;
if (tabs) { if (tabs) {
clipTab.appendAll(tabs.map(tab => { clipTab.appendAll(tabs.map(tab => {
let ctab = POLY.expand([tab.poly], toolDiameter/2); let ctab = POLY.expand([tab.poly], toolDiameter/2);