maintain gcode header/footer padding with substitutions
This commit is contained in:
parent
0ddfdeb376
commit
00ca621f4a
3 changed files with 18 additions and 11 deletions
|
|
@ -116,8 +116,12 @@
|
|||
}
|
||||
};
|
||||
|
||||
function appendSub(line) {
|
||||
append(print.constReplace(line, subst));
|
||||
function appendSubPad(line, pad) {
|
||||
appendSub(line, true);
|
||||
}
|
||||
|
||||
function appendSub(line, pad) {
|
||||
append(print.constReplace(line, subst, 0, pad));
|
||||
}
|
||||
|
||||
function appendAll(arr) {
|
||||
|
|
@ -126,10 +130,10 @@
|
|||
arr.forEach(function(line) { append(line) });
|
||||
}
|
||||
|
||||
function appendAllSub(arr) {
|
||||
function appendAllSub(arr, pad) {
|
||||
if (!arr) return;
|
||||
if (!Array.isArray(arr)) arr = [ arr ];
|
||||
arr.forEach(function(line) { appendSub(line) });
|
||||
arr.forEach(function(line) { appendSub(line, pad) });
|
||||
}
|
||||
|
||||
append(`; Generated by Kiri:Moto ${KIRI.version}`);
|
||||
|
|
@ -174,11 +178,11 @@
|
|||
if (line.indexOf("{tool}") > 0 && extruders.length > 1) {
|
||||
for (let i=0; i<extruders.length; i++) {
|
||||
subst.tool = i;
|
||||
appendSub(line);
|
||||
appendSubPad(line);
|
||||
}
|
||||
subst.tool = 0;
|
||||
} else {
|
||||
appendSub(line);
|
||||
appendSubPad(line);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -275,8 +279,8 @@
|
|||
path.layer === 0 ?
|
||||
(process.firstSliceHeight || process.sliceHeight) : path.height);
|
||||
|
||||
subst.z = zpos = path.z;
|
||||
subst.Z = subst.z;
|
||||
zpos = path.z;
|
||||
subst.z = subst.Z = zpos.round(3);
|
||||
subst.e = subst.E = outputLength;
|
||||
subst.layer = layer;
|
||||
subst.height = path.height.toFixed(3);
|
||||
|
|
|
|||
Loading…
Reference in a new issue