optimze/reduce tower allocated space
This commit is contained in:
parent
e8fd141a27
commit
5f00e7ac9c
1 changed files with 12 additions and 15 deletions
|
|
@ -251,12 +251,13 @@
|
||||||
let blokpos, walkpos, blok;
|
let blokpos, walkpos, blok;
|
||||||
|
|
||||||
function mkblok(w,h) {
|
function mkblok(w,h) {
|
||||||
|
let count = extcount - 1;
|
||||||
let gap = nozzle;
|
let gap = nozzle;
|
||||||
if (isBelt) {
|
if (isBelt) {
|
||||||
let step = w + gap;
|
let step = w + gap;
|
||||||
let mp = (bounds.max.y + bounds.min.y) / 2; // part y midpoint
|
let mp = (bounds.max.y + bounds.min.y) / 2; // part y midpoint
|
||||||
let sp = (bounds.max.y - bounds.min.y); // part y span
|
let sp = (bounds.max.y - bounds.min.y); // part y span
|
||||||
let ts = (w * extcount) + (gap * (extcount - 1)); // tower y span
|
let ts = (w * count) + (gap * (count - 1)); // tower y span
|
||||||
let ty = -ts + w/2 - gap/2; // tower start y
|
let ty = -ts + w/2 - gap/2; // tower start y
|
||||||
blokpos = { y:ty, x: bounds.max.x + 2 + h / 2}; // first block pos
|
blokpos = { y:ty, x: bounds.max.x + 2 + h / 2}; // first block pos
|
||||||
walkpos = { y:step, x:0 };
|
walkpos = { y:step, x:0 };
|
||||||
|
|
@ -265,7 +266,7 @@
|
||||||
let step = h + gap;
|
let step = h + gap;
|
||||||
let mp = (bounds.max.x + bounds.min.x) / 2; // part y midpoint
|
let mp = (bounds.max.x + bounds.min.x) / 2; // part y midpoint
|
||||||
let sp = (bounds.max.x - bounds.min.x); // part y span
|
let sp = (bounds.max.x - bounds.min.x); // part y span
|
||||||
let ts = (h * extcount) + (gap * (extcount - 1)); // tower y span
|
let ts = (h * count) + (gap * (count - 1)); // tower y span
|
||||||
let tx = mp - ts / 2 + step / 2; // tower start y
|
let tx = mp - ts / 2 + step / 2; // tower start y
|
||||||
blokpos = { x:tx, y: bounds.max.y + 2 + w / 2}; // first block pos
|
blokpos = { x:tx, y: bounds.max.y + 2 + w / 2}; // first block pos
|
||||||
walkpos = { x:step, y:0 };
|
walkpos = { x:step, y:0 };
|
||||||
|
|
@ -274,7 +275,7 @@
|
||||||
let step = w + gap;
|
let step = w + gap;
|
||||||
let mp = (bounds.max.y + bounds.min.y) / 2; // part y midpoint
|
let mp = (bounds.max.y + bounds.min.y) / 2; // part y midpoint
|
||||||
let sp = (bounds.max.y - bounds.min.y); // part y span
|
let sp = (bounds.max.y - bounds.min.y); // part y span
|
||||||
let ts = (w * extcount) + (gap * (extcount - 1)); // tower y span
|
let ts = (w * count) + (gap * (count - 1)); // tower y span
|
||||||
let ty = mp - ts / 2 + step / 2; // tower start y
|
let ty = mp - ts / 2 + step / 2; // tower start y
|
||||||
blokpos = { y:ty, x: bounds.max.x + 2 + h / 2}; // first block pos
|
blokpos = { y:ty, x: bounds.max.x + 2 + h / 2}; // first block pos
|
||||||
walkpos = { y:step, x:0 };
|
walkpos = { y:step, x:0 };
|
||||||
|
|
@ -305,8 +306,8 @@
|
||||||
|
|
||||||
mkblok(blokw, blokh);
|
mkblok(blokw, blokh);
|
||||||
|
|
||||||
// replace extruders array with object array containing more info
|
// allocate tower space for extruders-1 locations
|
||||||
extruders = extruders.map((ext,i) => {
|
let towers = extruders.slice(1).map((ext,i) => {
|
||||||
return ext ? mkrec(i) : ext;
|
return ext ? mkrec(i) : ext;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -335,7 +336,7 @@
|
||||||
if (!purgeTower || extcount < 2) {
|
if (!purgeTower || extcount < 2) {
|
||||||
return start;
|
return start;
|
||||||
}
|
}
|
||||||
let rec = track[nozzle];
|
let rec = track.shift();
|
||||||
let thin = using >= 0 || lastPurgeTool === nozzle;
|
let thin = using >= 0 || lastPurgeTool === nozzle;
|
||||||
let tool = using >= 0 ? using : nozzle;
|
let tool = using >= 0 ? using : nozzle;
|
||||||
let first = isBelt ? !purgedFirst && layer.slice.index >= 0 : layer.slice.index === 0;
|
let first = isBelt ? !purgedFirst && layer.slice.index >= 0 : layer.slice.index === 0;
|
||||||
|
|
@ -343,7 +344,6 @@
|
||||||
let wipe = true;
|
let wipe = true;
|
||||||
lastPurgeTool = tool;
|
lastPurgeTool = tool;
|
||||||
if (rec) {
|
if (rec) {
|
||||||
track[nozzle] = null;
|
|
||||||
if (layer.last()) {
|
if (layer.last()) {
|
||||||
layer.last().retract = true;
|
layer.last().retract = true;
|
||||||
}
|
}
|
||||||
|
|
@ -396,7 +396,7 @@
|
||||||
start.purgeOff = purgeOn;
|
start.purgeOff = purgeOn;
|
||||||
return start;
|
return start;
|
||||||
} else {
|
} else {
|
||||||
console.log({already_purged: nozzle, from: track, layer});
|
console.log({no_purge_tower_for: nozzle, using, track, layer});
|
||||||
return start;
|
return start;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -444,12 +444,12 @@
|
||||||
let firstExt;
|
let firstExt;
|
||||||
let lastWidget;
|
let lastWidget;
|
||||||
let lastExt;
|
let lastExt;
|
||||||
|
let lastOut;
|
||||||
|
|
||||||
// walk cake layers bottom up
|
// walk cake layers bottom up
|
||||||
for (let layer of cake) {
|
for (let layer of cake) {
|
||||||
// track purge blocks generated for each layer
|
// track purge blocks generated for each layer
|
||||||
let track = extruders.slice();
|
let track = towers.slice();
|
||||||
let lastOut;
|
|
||||||
|
|
||||||
// iterate over layer slices, find closest widget, print, eliminate
|
// iterate over layer slices, find closest widget, print, eliminate
|
||||||
for (;;) {
|
for (;;) {
|
||||||
|
|
@ -555,10 +555,8 @@
|
||||||
|
|
||||||
// if a declared extruder isn't used in a layer, use selected
|
// if a declared extruder isn't used in a layer, use selected
|
||||||
// extruder to fill the relevant purge blocks for later support
|
// extruder to fill the relevant purge blocks for later support
|
||||||
track.forEach(ext => {
|
track.slice().forEach(ext => {
|
||||||
if (ext && lastOut) {
|
printPoint = purge(ext.extruder, track, layerout, printPoint, lastOut.z, lastExt, lastOffset);
|
||||||
printPoint = purge(ext.extruder, track, layerout, printPoint, lastOut.z, lastExt, lastOffset);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// if layer produced output, append to output array
|
// if layer produced output, append to output array
|
||||||
|
|
@ -576,7 +574,6 @@
|
||||||
update((layerno / cake.length) * 0.5, "prepare");
|
update((layerno / cake.length) * 0.5, "prepare");
|
||||||
|
|
||||||
layerout = [];
|
layerout = [];
|
||||||
lastOut = undefined;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
print.output = output;
|
print.output = output;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue