add option to export gcode as a zip file with discrete operations

This commit is contained in:
Stewart Allen 2022-01-24 15:22:20 -05:00
commit 5788b800a8
3 changed files with 50 additions and 18 deletions

View file

@ -22,6 +22,7 @@
time = 0,
lines = 0,
bytes = 0,
opnum = 0,
factor = 1,
output = [],
spindle = 0,
@ -70,10 +71,14 @@
time_sec: 0,
time_ms: 0,
time: 0
},
append;
}
append = function(line) {
function section(section) {
append();
online({ section });
}
function append(line) {
if (line) {
lines++;
bytes += line.length;
@ -83,7 +88,7 @@
online(output.join("\r\n"));
output = [];
}
};
}
function filterEmit(array, consts) {
if (!array) return;
@ -234,6 +239,7 @@
points++;
}
section('header');
if (!stripComments) {
append(`; Generated by Kiri:Moto ${KIRI.version}`);
append(`; ${new Date().toString()}`);
@ -291,6 +297,7 @@
if (mode !== layerout.mode) {
if (mode && !stripComments) append("; ending " + mode + " op after " + Math.round(time/60) + " seconds");
mode = layerout.mode;
if (mode) section(`op-${opnum++}-${mode}`);
if (!stripComments) append("; starting " + mode + " op");
}
if (layerout.spindle && layerout.spindle !== spindle) {
@ -312,6 +319,7 @@
if (mode && !stripComments) append("; ending " + mode + " op after " + Math.round(time/60) + " seconds");
// emit gcode post
section('footer');
filterEmit(gcodes.gcodePost, consts);
// flush buffered gcode