more not perfect slowing of initial level cuts

This commit is contained in:
Stewart Allen 2023-02-24 13:34:13 -05:00
commit f9cc6d1cb2
2 changed files with 10 additions and 9 deletions

View file

@ -429,14 +429,15 @@ class OpRough extends CamOp {
// set winding specified in output // set winding specified in output
POLY.setWinding(level, cutdir, false); POLY.setWinding(level, cutdir, false);
printPoint = poly2polyEmit(level, printPoint, function(poly, index, count) { printPoint = poly2polyEmit(level, printPoint, function(poly, index, count) {
const factor = count === 1 ? 0.5 : 1;
poly.forEachPoint(function(point, pidx, points, offset) { poly.forEachPoint(function(point, pidx, points, offset) {
camOut(point.clone(), offset !== 0); camOut(point.clone(), offset !== 0, undefined, factor);
}, true, index); }, true, index);
}); });
newLayer(); newLayer();
} }
let index = 0; let total = 0;
for (let slice of sliceOut) { for (let slice of sliceOut) {
let polys = [], t = [], c = []; let polys = [], t = [], c = [];
POLY.flatten(slice.camLines).forEach(function (poly) { POLY.flatten(slice.camLines).forEach(function (poly) {
@ -457,12 +458,12 @@ class OpRough extends CamOp {
} else { } else {
printPoint = poly2polyEmit(polys, printPoint, function(poly, index, count) { printPoint = poly2polyEmit(polys, printPoint, function(poly, index, count) {
poly.forEachPoint(function(point, pidx, points, offset) { poly.forEachPoint(function(point, pidx, points, offset) {
camOut(point.clone(), offset !== 0); camOut(point.clone(), offset !== 0, undefined, count === 1 ? 0.5 : 1);
}, poly.isClosed(), index); }, poly.isClosed(), index);
}, { swapdir: false }); }, { swapdir: false });
newLayer(); newLayer();
} }
progress(++index / sliceOut.length, "routing"); progress(++total / sliceOut.length, "routing");
} }
function isNeg(v) { function isNeg(v) {
@ -943,11 +944,11 @@ class OpLathe extends CamOp {
// move to safe height and reset A axis // move to safe height and reset A axis
let last = ops.lastPoint(); let last = ops.lastPoint();
let amax = Math.round(last.a / 360) * 360; let amax = (Math.round(last.a / 360) * 360).round(2);
camOut(last = last.clone().setZ(zmax), 0); // camOut(last = last.clone().setZ(zmax), 0);
camOut(last = last.clone().setA(amax), 0); // camOut(last = last.clone().setA(amax), 0);
newLayer(); newLayer();
ops.addGCode("G92A0"); ops.addGCode([`G0 Z${zmax.round(2)}`,`G0 A${amax}`,"G92 A0"]);
setPrintPoint(last); setPrintPoint(last);
} }

View file

@ -335,7 +335,7 @@ function prepEach(widget, settings, print, firstPoint, update) {
} }
// convert short planar moves to cuts in some cases // convert short planar moves to cuts in some cases
if (isMove && deltaXY <= moveLen && deltaZ <= 0 && !lasering) { if (!isRough && isMove && deltaXY <= moveLen && deltaZ <= 0 && !lasering) {
let iscontour = tolerance > 0; let iscontour = tolerance > 0;
let isflat = absDeltaZ < 0.001; let isflat = absDeltaZ < 0.001;
// restrict this to contouring // restrict this to contouring