fix parsing of gcode with initial purge on a high z
This commit is contained in:
parent
0b26bf35b1
commit
1239968ade
2 changed files with 15 additions and 10 deletions
1
notes.md
1
notes.md
|
|
@ -70,6 +70,7 @@
|
||||||
* `B` need to force cut line at synthetic z bottom (midlines, etc)
|
* `B` need to force cut line at synthetic z bottom (midlines, etc)
|
||||||
* `B` starting export during animation unleashes chaos
|
* `B` starting export during animation unleashes chaos
|
||||||
|
|
||||||
|
* `F` limit cut depth to flute length of selected tool
|
||||||
* `F` add ease-down support to trace op
|
* `F` add ease-down support to trace op
|
||||||
* `F` add linear clearing strategy
|
* `F` add linear clearing strategy
|
||||||
* `F` add adaptive clearing strategy
|
* `F` add adaptive clearing strategy
|
||||||
|
|
|
||||||
|
|
@ -134,7 +134,8 @@
|
||||||
seq = [],
|
seq = [],
|
||||||
autolayer = true,
|
autolayer = true,
|
||||||
newlayer = false,
|
newlayer = false,
|
||||||
arcdivs = Math.PI / 12;
|
arcdivs = Math.PI / 12,
|
||||||
|
hasmoved = false;
|
||||||
|
|
||||||
const output = scope.output = [ seq ];
|
const output = scope.output = [ seq ];
|
||||||
const beltaxis = { X: "X", Y: "Z", Z: "Y", E: "E", F: "F" };
|
const beltaxis = { X: "X", Y: "Z", Z: "Y", E: "E", F: "F" };
|
||||||
|
|
@ -211,25 +212,23 @@
|
||||||
|
|
||||||
function G0G1(g0, line) {
|
function G0G1(g0, line) {
|
||||||
const mov = {};
|
const mov = {};
|
||||||
|
const axes = {};
|
||||||
|
|
||||||
line.forEach(function(tok) {
|
line.forEach(function(tok) {
|
||||||
let axis = tok.charAt(0);
|
let axis = tok.charAt(0);
|
||||||
if (morph && belt) {
|
if (morph && belt) {
|
||||||
axis = beltaxis[axis];
|
axis = beltaxis[axis];
|
||||||
}
|
}
|
||||||
|
let val = parseFloat(tok.substring(1));
|
||||||
|
axes[axis] = val;
|
||||||
if (abs) {
|
if (abs) {
|
||||||
pos[axis] = parseFloat(tok.substring(1));
|
pos[axis] = val;
|
||||||
} else {
|
} else {
|
||||||
mov[axis] = parseFloat(tok.substring(1));
|
mov[axis] = val;
|
||||||
|
pos[axis] += val;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!abs) {
|
|
||||||
for (let [k,v] of Object.entries(mov)) {
|
|
||||||
pos[k] += v;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const point = newPoint(
|
const point = newPoint(
|
||||||
factor * pos.X + off.X + xoff.X,
|
factor * pos.X + off.X + xoff.X,
|
||||||
factor * pos.Y + off.Y + xoff.Y,
|
factor * pos.Y + off.Y + xoff.Y,
|
||||||
|
|
@ -242,7 +241,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
const retract = (fdm && pos.E < 0) || undefined;
|
const retract = (fdm && pos.E < 0) || undefined;
|
||||||
const moving = g0 || (fdm && pos.E <= 0);
|
const moving = g0 || (fdm && (pos.E <= 0 || !(axes.X || axes.Y || axes.Z)));
|
||||||
|
|
||||||
if (!moving && point.x) bounds.min.x = Math.min(bounds.min.x, point.x);
|
if (!moving && point.x) bounds.min.x = Math.min(bounds.min.x, point.x);
|
||||||
if (!moving && point.x) bounds.max.x = Math.max(bounds.max.x, point.x);
|
if (!moving && point.x) bounds.max.x = Math.max(bounds.max.x, point.x);
|
||||||
|
|
@ -280,6 +279,11 @@
|
||||||
output.push(seq);
|
output.push(seq);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!hasmoved && !moving) {
|
||||||
|
seq.height = seq.Z = pos.Z;
|
||||||
|
hasmoved = true;
|
||||||
|
}
|
||||||
|
|
||||||
// debug extrusion rate
|
// debug extrusion rate
|
||||||
if (false && fdm && lastPos) {
|
if (false && fdm && lastPos) {
|
||||||
let dE = (absE ? pos.E - lastPos.E : pos.E);
|
let dE = (absE ? pos.E - lastPos.E : pos.E);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue