add prusa ini conversion mapping of gcode vars

speed up surface selection
This commit is contained in:
Stewart Allen 2022-04-14 12:46:31 -04:00
commit 0d58db27ed
5 changed files with 51 additions and 14 deletions

View file

@ -618,6 +618,11 @@ function settingsImportZip(data, ask) {
function settingsPrusaConvert(data) {
const { uc } = api;
const map = {};
const vsub = {
'[first_layer_bed_temperature]': '{bed_temp}',
'[first_layer_temperature]': '{temp}',
'[layer_z]': '{z}'
};
try {
data.split('\n')
.filter(l => l.charAt(0) !== '#')
@ -625,7 +630,13 @@ function settingsPrusaConvert(data) {
.map(l => {
// convert gcode string into a string array
if (l[0].indexOf('_gcode') > 0) {
l[1] = l[1].replaceAll('\\n','\n').split('\n');
l[1] = l[1].replaceAll('\\n','\n').split('\n')
.map(line => {
for (let [k,v] of Object.entries(vsub)) {
line = line.replace(k,v);
}
return line;
});
}
return l;
})