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
|
|
@ -980,7 +980,7 @@
|
|||
}
|
||||
}
|
||||
|
||||
function constReplace(str, consts, start) {
|
||||
function constReplace(str, consts, start, pad) {
|
||||
let cs = str.indexOf("{", start || 0),
|
||||
ce = str.indexOf("}", cs),
|
||||
tok, nutok, nustr;
|
||||
|
|
@ -992,6 +992,9 @@
|
|||
constOp(tok, consts, "/", function(v1,v2) { return v1/v2 }) ||
|
||||
constOp(tok, consts, "*", function(v1,v2) { return v1*v2 }) ||
|
||||
consts[tok] || 0;
|
||||
if (pad) {
|
||||
nutok = nutok.toString().padEnd(ce-cs+1, ' ');
|
||||
}
|
||||
nustr = str.replace("{"+tok+"}",nutok);
|
||||
return constReplace(nustr, consts, ce+1+(nustr.length-str.length));
|
||||
} else {
|
||||
|
|
|
|||
Loading…
Reference in a new issue