add oname and oid params for macro conditions and substitutions
This commit is contained in:
parent
ac956a3cac
commit
7660570f3a
2 changed files with 13 additions and 2 deletions
|
|
@ -176,6 +176,14 @@ class Print {
|
|||
}
|
||||
|
||||
constReplace(str, consts, start, pad, short) {
|
||||
function tryeval(str) {
|
||||
try {
|
||||
return eval(`{ ${str} }`)
|
||||
} catch (e) {
|
||||
console.log({ eval_error: e, str });
|
||||
return str;
|
||||
}
|
||||
}
|
||||
let cs = str.indexOf("{", start || 0),
|
||||
ce = str.indexOf("}", cs),
|
||||
tok, nutok, nustr;
|
||||
|
|
@ -199,8 +207,7 @@ class Print {
|
|||
}
|
||||
eva.push(`function range(a,b) { return (a + (layer / layers) * (b-a)).round(4) }`);
|
||||
eva.push(`try {( ${tok} )} catch (e) {console.log(e);0}`);
|
||||
let scr = eva.join('');
|
||||
let evl = eval(`{ ${scr} }`);
|
||||
let evl = tryeval(eva.join(''));
|
||||
nutok = evl;
|
||||
if (pad === 666) {
|
||||
return evl;
|
||||
|
|
|
|||
|
|
@ -111,6 +111,8 @@ export function fdm_export(print, online, ondone, ondebug) {
|
|||
progress: 0,
|
||||
nozzle: tool,
|
||||
tool: tool,
|
||||
oid: '',
|
||||
oname: '',
|
||||
model_labels: model_labels.sort().join(',')
|
||||
},
|
||||
pidx, path, out, speedMMM, emitMM, emitPerMM, lastp, laste, dist,
|
||||
|
|
@ -620,6 +622,8 @@ export function fdm_export(print, online, ondone, ondebug) {
|
|||
let b64 = encodeBitOffset(off);
|
||||
append(`; start object id: ${out.widget.track.grid_id}`);
|
||||
isBambu && append(`M624 ${b64}`);
|
||||
subst.oid = out.widget.track.grid_id;
|
||||
subst.oname = out.widget.meta.file;
|
||||
}
|
||||
cwidget = out.widget;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue