order planar slices by extruder first for proper purge blocks
This commit is contained in:
parent
ef80c547a7
commit
14526eb384
3 changed files with 25 additions and 16 deletions
|
|
@ -390,16 +390,15 @@ let gs_kiri_fdm = exports;
|
||||||
zoff = 0,
|
zoff = 0,
|
||||||
meshIndex,
|
meshIndex,
|
||||||
lastIndex,
|
lastIndex,
|
||||||
// lastOut,
|
|
||||||
closest,
|
closest,
|
||||||
mindist,
|
mindist,
|
||||||
minidx,
|
minidx,
|
||||||
find,
|
find,
|
||||||
found,
|
|
||||||
layerout = [],
|
layerout = [],
|
||||||
slices = [],
|
slices = [],
|
||||||
sliceEntry;
|
sliceEntry;
|
||||||
|
|
||||||
|
// TODO pick a widget with a slice on the first layer and use that nozzle
|
||||||
// create brim, skirt, raft if specificed in FDM mode (code shared by laser)
|
// create brim, skirt, raft if specificed in FDM mode (code shared by laser)
|
||||||
if (process.outputBrimCount || process.outputRaft) {
|
if (process.outputBrimCount || process.outputRaft) {
|
||||||
let brims = [],
|
let brims = [],
|
||||||
|
|
@ -588,7 +587,7 @@ let gs_kiri_fdm = exports;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// for each layer until no layers are found
|
// increment layer count until no widget has remaining slices
|
||||||
for (;;) {
|
for (;;) {
|
||||||
// create list of mesh slice arrays with their platform offsets
|
// create list of mesh slice arrays with their platform offsets
|
||||||
for (meshIndex = 0; meshIndex < widgets.length; meshIndex++) {
|
for (meshIndex = 0; meshIndex < widgets.length; meshIndex++) {
|
||||||
|
|
@ -614,22 +613,30 @@ let gs_kiri_fdm = exports;
|
||||||
|
|
||||||
// iterate over layer slices, find closest widget, print, eliminate
|
// iterate over layer slices, find closest widget, print, eliminate
|
||||||
for (;;) {
|
for (;;) {
|
||||||
found = 0;
|
|
||||||
closest = null;
|
closest = null;
|
||||||
mindist = Infinity;
|
mindist = Infinity;
|
||||||
// TODO must select slices of the same extruder type first
|
let order = [];
|
||||||
// instead of just finding closest, create sorted list and
|
// select slices of the same extruder type first then distance
|
||||||
// next is draw from list
|
|
||||||
for (meshIndex = 0; meshIndex < slices.length; meshIndex++) {
|
for (meshIndex = 0; meshIndex < slices.length; meshIndex++) {
|
||||||
sliceEntry = slices[meshIndex];
|
sliceEntry = slices[meshIndex];
|
||||||
if (!sliceEntry) continue;
|
if (sliceEntry) {
|
||||||
find = sliceEntry.slice.findClosestPointTo(printPoint.sub(sliceEntry.offset));
|
find = sliceEntry.slice.findClosestPointTo(printPoint.sub(sliceEntry.offset));
|
||||||
if (find && (!closest || find.distance < mindist)) {
|
if (find) {
|
||||||
closest = sliceEntry;
|
let ext = sliceEntry.slice.extruder;
|
||||||
mindist = find.distance;
|
let lex = lastOut ? lastOut.extruder : ext;
|
||||||
minidx = meshIndex;
|
let dst = Math.abs(find.distance);
|
||||||
|
if (ext !== lex) dst *= 10000;
|
||||||
|
order.push({dst,sliceEntry,meshIndex});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
found++;
|
}
|
||||||
|
order.sort((a,b) => {
|
||||||
|
return a.dst - b.dst;
|
||||||
|
});
|
||||||
|
if (order.length) {
|
||||||
|
let find = order.shift();
|
||||||
|
closest = find.sliceEntry;
|
||||||
|
minidx = find.meshIndex;
|
||||||
}
|
}
|
||||||
if (!closest) {
|
if (!closest) {
|
||||||
if (sliceEntry) lastOut = sliceEntry.slice;
|
if (sliceEntry) lastOut = sliceEntry.slice;
|
||||||
|
|
|
||||||
|
|
@ -1060,7 +1060,7 @@ var gs_kiri_init = exports;
|
||||||
});
|
});
|
||||||
SPACE.platform.onMove(API.conf.save);
|
SPACE.platform.onMove(API.conf.save);
|
||||||
SPACE.platform.setRound(true);
|
SPACE.platform.setRound(true);
|
||||||
SPACE.useDefaultKeys(API.feature.on_key === undefined);
|
SPACE.useDefaultKeys(API.feature.on_key === undefined || API.feature.on_key_defaults);
|
||||||
|
|
||||||
UC.setCompact(compact);
|
UC.setCompact(compact);
|
||||||
|
|
||||||
|
|
@ -1640,7 +1640,7 @@ var gs_kiri_init = exports;
|
||||||
|
|
||||||
// SPACE.mouse.onHover(function(d,me) {
|
// SPACE.mouse.onHover(function(d,me) {
|
||||||
// if (d) {
|
// if (d) {
|
||||||
// console.log(d,d.object.widget.id,d.face.materialIndex)
|
// // console.log(d,d.object.widget.id,d.face.materialIndex)
|
||||||
// // d.object.material.vertexColors = true;
|
// // d.object.material.vertexColors = true;
|
||||||
// // d.object.material.needsUpdate = true;
|
// // d.object.material.needsUpdate = true;
|
||||||
// // d.face.vertexColors = [
|
// // d.face.vertexColors = [
|
||||||
|
|
|
||||||
|
|
@ -1583,6 +1583,7 @@ self.kiri.copyright = exports.COPYRIGHT;
|
||||||
["print","help","local"].forEach(function(modal) {
|
["print","help","local"].forEach(function(modal) {
|
||||||
UI[modal].style.display = (modal === which ? 'block' : 'none');
|
UI[modal].style.display = (modal === which ? 'block' : 'none');
|
||||||
});
|
});
|
||||||
|
if (which) API.event.emit('modal.show', which);
|
||||||
}
|
}
|
||||||
|
|
||||||
function hideDialog() {
|
function hideDialog() {
|
||||||
|
|
@ -1598,6 +1599,7 @@ self.kiri.copyright = exports.COPYRIGHT;
|
||||||
let style = UI[dialog].style;
|
let style = UI[dialog].style;
|
||||||
style.display = (dialog === which && (force || style.display !== 'flex') ? 'flex' : 'none');
|
style.display = (dialog === which && (force || style.display !== 'flex') ? 'flex' : 'none');
|
||||||
});
|
});
|
||||||
|
if (which) API.event.emit('dialog.show', which);
|
||||||
}
|
}
|
||||||
|
|
||||||
function showCatalog() {
|
function showCatalog() {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue