improve gcode fdm import + render (still buggy)
This commit is contained in:
parent
fff3ad5db6
commit
a1460f4032
3 changed files with 14 additions and 6 deletions
|
|
@ -113,6 +113,7 @@
|
||||||
seq = [],
|
seq = [],
|
||||||
abs = true,
|
abs = true,
|
||||||
move = false,
|
move = false,
|
||||||
|
height = 0,
|
||||||
factor = 1,
|
factor = 1,
|
||||||
tool = 0,
|
tool = 0,
|
||||||
E0G0 = false,
|
E0G0 = false,
|
||||||
|
|
@ -121,9 +122,11 @@
|
||||||
if (seq.length > 0) {
|
if (seq.length > 0) {
|
||||||
output.push(seq);
|
output.push(seq);
|
||||||
seq = [];
|
seq = [];
|
||||||
|
seq.height = height;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
LZ = 0.0,
|
LZ = 0.0,
|
||||||
|
LMZ = 0.0,
|
||||||
pos = {
|
pos = {
|
||||||
X: 0.0,
|
X: 0.0,
|
||||||
Y: 0.0,
|
Y: 0.0,
|
||||||
|
|
@ -184,6 +187,9 @@
|
||||||
if (E0G0 && pos.E === 0.0) {
|
if (E0G0 && pos.E === 0.0) {
|
||||||
if (LZ != pos.Z) G0();
|
if (LZ != pos.Z) G0();
|
||||||
else move = true;
|
else move = true;
|
||||||
|
if (move && pos.Z > LMZ) {
|
||||||
|
height = seq.height = pos.Z - LMZ;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
addOutput(
|
addOutput(
|
||||||
seq,
|
seq,
|
||||||
|
|
@ -203,6 +209,7 @@
|
||||||
move = false;
|
move = false;
|
||||||
pos.E = 0.0;
|
pos.E = 0.0;
|
||||||
LZ = pos.Z;
|
LZ = pos.Z;
|
||||||
|
LMZ = Math.max(LZ, LMZ);
|
||||||
});
|
});
|
||||||
|
|
||||||
G0();
|
G0();
|
||||||
|
|
@ -211,7 +218,7 @@
|
||||||
scope.lines = lines.length;
|
scope.lines = lines.length;
|
||||||
scope.bytes = gcode.length;
|
scope.bytes = gcode.length;
|
||||||
|
|
||||||
done(scope.output);
|
done({ output: scope.output });
|
||||||
};
|
};
|
||||||
|
|
||||||
function pref(a,b) {
|
function pref(a,b) {
|
||||||
|
|
|
||||||
|
|
@ -95,7 +95,6 @@
|
||||||
|
|
||||||
for (const [label, data] of Object.entries(render.layers)) {
|
for (const [label, data] of Object.entries(render.layers)) {
|
||||||
if (!DYN[label]) {
|
if (!DYN[label]) {
|
||||||
console.log('new label', label);
|
|
||||||
DYN[label] = {
|
DYN[label] = {
|
||||||
group: [],
|
group: [],
|
||||||
toggle: UC.newBoolean(label, (abc) => {
|
toggle: UC.newBoolean(label, (abc) => {
|
||||||
|
|
|
||||||
|
|
@ -163,13 +163,15 @@ KIRI.worker = {
|
||||||
z: origin.z
|
z: origin.z
|
||||||
};
|
};
|
||||||
const print = KIRI.newPrint(settings, Object.values(cache));
|
const print = KIRI.newPrint(settings, Object.values(cache));
|
||||||
|
const tools = settings.device.extruders;
|
||||||
|
const thin = settings.controller.thinRender || settings.mode !== 'FDM';
|
||||||
|
|
||||||
const parsed = print.parseGCode(code, offset, progress => {
|
const parsed = print.parseGCode(code, offset, progress => {
|
||||||
send.data({progress});
|
send.data({ progress: progress * 0.5 });
|
||||||
}, done => {
|
}, done => {
|
||||||
const layers = KIRI.driver.FDM.prepareRender(done, progress => {
|
const layers = KIRI.driver.FDM.prepareRender(done.output, progress => {
|
||||||
send.data({progress});
|
send.data({ progress: 0.5 + progress * 0.5 });
|
||||||
}, { thin: true });
|
}, { thin, tools });
|
||||||
send.done({parsed: KIRI.codec.encode(layers)});
|
send.done({parsed: KIRI.codec.encode(layers)});
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue