fix shell output in prints

This commit is contained in:
Stewart Allen 2020-11-08 11:09:15 -05:00
commit 15ea39e849
3 changed files with 9 additions and 10 deletions

View file

@ -340,7 +340,6 @@
};
PRO.render = function(stack) {
console.log({print_render: this.output});
this.output.forEach(layer => {
stack.add(layer);
});
@ -862,13 +861,13 @@
}
} else {
// top object
let bounds = POLY.flatten(next.shellsAtDepth(0));
let bounds = POLY.flatten(next.shellsAtDepth(0).clone(true));
let dir = -1; // 1 == inside out, -1 == outside-in
// output inner polygons
if (dir === 1)
outputTraces([].appendAll(next.innerTraces() || []));
outputTraces([].appendAll(next.innerShells() || []));
// sort perimeter polygon by length to go out-to-in or in-to-out
(next.shells || []).sort(function(a,b) {
@ -879,7 +878,7 @@
// output outer polygons
if (dir === -1)
outputTraces([].appendAll(next.innerTraces() || []));
outputTraces([].appendAll(next.innerShells() || []));
// output thin fill
outputFills(next.thin_fill, {near: true});

View file

@ -59,10 +59,10 @@
* return innermost traces under a given top. for FDM, this represents
* the outline shell that the fill touches. used by Print, Laser
*/
Top.prototype.innerTraces = function() {
let traces = this.traces,
Top.prototype.innerShells = function() {
let shells = this.shells,
array = [];
if (traces) traces.forEach(function(p) {
if (shells) shells.forEach(function(p) {
if (p.inner) array.appendAll(p.inner);
});
return array;

View file

@ -359,7 +359,7 @@
// notify progress
layerout.layer = layer++;
update(layer / maxLayers);
update((layer / maxLayers) * 0.5);
// retract after last layer
if (layer === maxLayers && layerout.length) {
@ -372,14 +372,13 @@
}
print.output = render(output, progress => {
// console.log({render: progress});
update(0.5 + progress * 0.5);
}, device.extruders);
};
function render(output, update, tools) {
const layers = [];
output.forEach((level, index) => {
update(index / output.length);
const prints = {};
const moves = [];
const pushPrint = (tool, poly) => {
@ -425,6 +424,7 @@
Object.values(prints).forEach(array => {
out.setLayer('print', 0x888800).addPolys(array, { offset: array.width, height })
})
update(index / output.length);
});
return layers;