fix slice,print,export for missing extruders
This commit is contained in:
parent
14526eb384
commit
3d1ad7169c
2 changed files with 21 additions and 3 deletions
|
|
@ -33,6 +33,17 @@ let gs_kiri_fdm = exports;
|
|||
return Math.max(min,Math.min(max,v));
|
||||
}
|
||||
|
||||
function fixExtruders(settings) {
|
||||
Object.entries(settings.widget).forEach(arr => {
|
||||
let [wid,val] = arr;
|
||||
let dext = settings.device.extruders[val.extruder];
|
||||
if (!dext) {
|
||||
settings.widget[wid].extruder = 0;
|
||||
}
|
||||
});
|
||||
return settings;
|
||||
}
|
||||
|
||||
/**
|
||||
* DRIVER SLICE CONTRACT
|
||||
*
|
||||
|
|
@ -47,6 +58,7 @@ let gs_kiri_fdm = exports;
|
|||
* @param {Function} ondone (called when complete with an array of Slice objects)
|
||||
*/
|
||||
function slice(settings, widget, onupdate, ondone) {
|
||||
fixExtruders(settings);
|
||||
let spro = settings.process,
|
||||
sdev = settings.device,
|
||||
update_start = Date.now(),
|
||||
|
|
@ -73,6 +85,10 @@ let gs_kiri_fdm = exports;
|
|||
return ondone("invalid nozzle size");
|
||||
}
|
||||
|
||||
if (spro.firstSliceHeight === 0) {
|
||||
spro.firstSliceHeight = sliceHeight;
|
||||
}
|
||||
|
||||
if (spro.firstSliceHeight < sliceHeight) {
|
||||
DBUG.log("invalid first layer height < slice height");
|
||||
DBUG.log("reverting to slice height");
|
||||
|
|
@ -376,7 +392,7 @@ let gs_kiri_fdm = exports;
|
|||
*/
|
||||
function printSetup(print, update) {
|
||||
let widgets = print.widgets,
|
||||
settings = print.settings,
|
||||
settings = fixExtruders(print.settings),
|
||||
device = settings.device,
|
||||
nozzle = device.extruders[0].extNozzle,
|
||||
process = settings.process,
|
||||
|
|
@ -697,7 +713,7 @@ let gs_kiri_fdm = exports;
|
|||
*/
|
||||
function printExport(print, online) {
|
||||
let layers = print.output,
|
||||
settings = print.settings,
|
||||
settings = fixExtruders(print.settings),
|
||||
device = settings.device,
|
||||
extruders = device.extruders,
|
||||
process = settings.process,
|
||||
|
|
|
|||
|
|
@ -1373,7 +1373,9 @@ self.kiri.copyright = exports.COPYRIGHT;
|
|||
updateExtruderFields(device);
|
||||
};
|
||||
UI.extAdd.onclick = function() {
|
||||
device.extruders.push(clone(device.extruders[device.internal]));
|
||||
let copy = clone(device.extruders[device.internal]);
|
||||
copy.extSelect = [`T${device.extruders.length}`];
|
||||
device.extruders.push(copy);
|
||||
device.internal = device.extruders.length - 1;
|
||||
updateExtruderFields(device);
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in a new issue