add range() function in gcode macro expressions
This commit is contained in:
parent
06347df531
commit
aa0ccdaab2
2 changed files with 3 additions and 1 deletions
|
|
@ -1278,7 +1278,8 @@
|
||||||
for (let [k,v] of Object.entries(consts)) {
|
for (let [k,v] of Object.entries(consts)) {
|
||||||
eva.push(`let ${k} = "${v}";`);
|
eva.push(`let ${k} = "${v}";`);
|
||||||
}
|
}
|
||||||
eva.push(`try {( ${tok} )} catch (e) {0}`);
|
eva.push(`function range(a,b) { return (a + (layer / layers) * (b-a)).round(3) }`)
|
||||||
|
eva.push(`try {( ${tok} )} catch (e) {console.log(e);0}`);
|
||||||
let scr = eva.join('');
|
let scr = eva.join('');
|
||||||
let evl = eval(`{ ${scr} }`);
|
let evl = eval(`{ ${scr} }`);
|
||||||
nutok = evl;
|
nutok = evl;
|
||||||
|
|
|
||||||
|
|
@ -92,6 +92,7 @@
|
||||||
bottom: offset ? 0 : -device.bedDepth/2,
|
bottom: offset ? 0 : -device.bedDepth/2,
|
||||||
z_max: device.maxHeight,
|
z_max: device.maxHeight,
|
||||||
layers: layers.length,
|
layers: layers.length,
|
||||||
|
progress: 0,
|
||||||
nozzle: 0,
|
nozzle: 0,
|
||||||
tool: 0
|
tool: 0
|
||||||
},
|
},
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue