fix nested and tiny polys in tracing

This commit is contained in:
Stewart Allen 2023-01-13 22:42:21 -05:00
commit e22b0aee18
3 changed files with 8 additions and 3 deletions

View file

@ -102,6 +102,7 @@
* `F` ease-in and ease-out especially on tab cut-out start/stop
* `F` maintain several part orientations + op chains in a single profile
* `P` improve parser - do not require spaced tokens and support implied G0 / G1
* `P` inner corner arc moves
* `P` log Z interpolation for contour XYZ moves
* `P` option to start with the smallest poly by area on layer change

View file

@ -955,14 +955,14 @@ class OpTrace extends CamOp {
poly2polyEmit(polys, newPoint(0,0,0), (poly, index, count, spoint) => {
routed.push(poly);
});
for (let poly of routed) {
for (let poly of POLY.nest(routed)) {
let offdist = 0;
switch (offset) {
case "outside": offdist = toolDiam / 2; break;
case "inside": offdist = -toolDiam / 2; break;
}
if (offdist) {
let pnew = POLY.offset([poly], offdist);
let pnew = POLY.offset([poly], offdist, { minArea: 0 });
if (pnew) {
poly = POLY.setZ(pnew, poly.getZ());
} else {

View file

@ -475,7 +475,10 @@ class Print {
newlayer = true;
autolayer = false;
}
line = line.split(";")[0].split(" ").filter(v => v);
// if (["X","Y","Z"].indexOf(line.charAt(0)) >= 0) {
// line = `G0${line}`;
// }
line = line.trim().split(";")[0].split(" ").filter(v => v);
let cmd = line.shift();
if (!cmd) return;
if (cmd.charAt(0) === 'T') {
@ -486,6 +489,7 @@ class Print {
xoff.Y = -ext[pos].extOffsetY;
}
}
pos.E = 0.0;
switch (cmd) {
case 'M82':