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 = [],
|
||||
abs = true,
|
||||
move = false,
|
||||
height = 0,
|
||||
factor = 1,
|
||||
tool = 0,
|
||||
E0G0 = false,
|
||||
|
|
@ -121,9 +122,11 @@
|
|||
if (seq.length > 0) {
|
||||
output.push(seq);
|
||||
seq = [];
|
||||
seq.height = height;
|
||||
}
|
||||
},
|
||||
LZ = 0.0,
|
||||
LMZ = 0.0,
|
||||
pos = {
|
||||
X: 0.0,
|
||||
Y: 0.0,
|
||||
|
|
@ -184,6 +187,9 @@
|
|||
if (E0G0 && pos.E === 0.0) {
|
||||
if (LZ != pos.Z) G0();
|
||||
else move = true;
|
||||
if (move && pos.Z > LMZ) {
|
||||
height = seq.height = pos.Z - LMZ;
|
||||
}
|
||||
}
|
||||
addOutput(
|
||||
seq,
|
||||
|
|
@ -203,6 +209,7 @@
|
|||
move = false;
|
||||
pos.E = 0.0;
|
||||
LZ = pos.Z;
|
||||
LMZ = Math.max(LZ, LMZ);
|
||||
});
|
||||
|
||||
G0();
|
||||
|
|
@ -211,7 +218,7 @@
|
|||
scope.lines = lines.length;
|
||||
scope.bytes = gcode.length;
|
||||
|
||||
done(scope.output);
|
||||
done({ output: scope.output });
|
||||
};
|
||||
|
||||
function pref(a,b) {
|
||||
|
|
|
|||
|
|
@ -95,7 +95,6 @@
|
|||
|
||||
for (const [label, data] of Object.entries(render.layers)) {
|
||||
if (!DYN[label]) {
|
||||
console.log('new label', label);
|
||||
DYN[label] = {
|
||||
group: [],
|
||||
toggle: UC.newBoolean(label, (abc) => {
|
||||
|
|
|
|||
|
|
@ -163,13 +163,15 @@ KIRI.worker = {
|
|||
z: origin.z
|
||||
};
|
||||
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 => {
|
||||
send.data({progress});
|
||||
send.data({ progress: progress * 0.5 });
|
||||
}, done => {
|
||||
const layers = KIRI.driver.FDM.prepareRender(done, progress => {
|
||||
send.data({progress});
|
||||
}, { thin: true });
|
||||
const layers = KIRI.driver.FDM.prepareRender(done.output, progress => {
|
||||
send.data({ progress: 0.5 + progress * 0.5 });
|
||||
}, { thin, tools });
|
||||
send.done({parsed: KIRI.codec.encode(layers)});
|
||||
});
|
||||
},
|
||||
|
|
|
|||
Loading…
Reference in a new issue