fix shell output in prints
This commit is contained in:
parent
37e32ebedf
commit
15ea39e849
3 changed files with 9 additions and 10 deletions
|
|
@ -340,7 +340,6 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
PRO.render = function(stack) {
|
PRO.render = function(stack) {
|
||||||
console.log({print_render: this.output});
|
|
||||||
this.output.forEach(layer => {
|
this.output.forEach(layer => {
|
||||||
stack.add(layer);
|
stack.add(layer);
|
||||||
});
|
});
|
||||||
|
|
@ -862,13 +861,13 @@
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// top object
|
// 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
|
let dir = -1; // 1 == inside out, -1 == outside-in
|
||||||
|
|
||||||
// output inner polygons
|
// output inner polygons
|
||||||
if (dir === 1)
|
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
|
// sort perimeter polygon by length to go out-to-in or in-to-out
|
||||||
(next.shells || []).sort(function(a,b) {
|
(next.shells || []).sort(function(a,b) {
|
||||||
|
|
@ -879,7 +878,7 @@
|
||||||
|
|
||||||
// output outer polygons
|
// output outer polygons
|
||||||
if (dir === -1)
|
if (dir === -1)
|
||||||
outputTraces([].appendAll(next.innerTraces() || []));
|
outputTraces([].appendAll(next.innerShells() || []));
|
||||||
|
|
||||||
// output thin fill
|
// output thin fill
|
||||||
outputFills(next.thin_fill, {near: true});
|
outputFills(next.thin_fill, {near: true});
|
||||||
|
|
|
||||||
|
|
@ -59,10 +59,10 @@
|
||||||
* return innermost traces under a given top. for FDM, this represents
|
* return innermost traces under a given top. for FDM, this represents
|
||||||
* the outline shell that the fill touches. used by Print, Laser
|
* the outline shell that the fill touches. used by Print, Laser
|
||||||
*/
|
*/
|
||||||
Top.prototype.innerTraces = function() {
|
Top.prototype.innerShells = function() {
|
||||||
let traces = this.traces,
|
let shells = this.shells,
|
||||||
array = [];
|
array = [];
|
||||||
if (traces) traces.forEach(function(p) {
|
if (shells) shells.forEach(function(p) {
|
||||||
if (p.inner) array.appendAll(p.inner);
|
if (p.inner) array.appendAll(p.inner);
|
||||||
});
|
});
|
||||||
return array;
|
return array;
|
||||||
|
|
|
||||||
|
|
@ -359,7 +359,7 @@
|
||||||
|
|
||||||
// notify progress
|
// notify progress
|
||||||
layerout.layer = layer++;
|
layerout.layer = layer++;
|
||||||
update(layer / maxLayers);
|
update((layer / maxLayers) * 0.5);
|
||||||
|
|
||||||
// retract after last layer
|
// retract after last layer
|
||||||
if (layer === maxLayers && layerout.length) {
|
if (layer === maxLayers && layerout.length) {
|
||||||
|
|
@ -372,14 +372,13 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
print.output = render(output, progress => {
|
print.output = render(output, progress => {
|
||||||
// console.log({render: progress});
|
update(0.5 + progress * 0.5);
|
||||||
}, device.extruders);
|
}, device.extruders);
|
||||||
};
|
};
|
||||||
|
|
||||||
function render(output, update, tools) {
|
function render(output, update, tools) {
|
||||||
const layers = [];
|
const layers = [];
|
||||||
output.forEach((level, index) => {
|
output.forEach((level, index) => {
|
||||||
update(index / output.length);
|
|
||||||
const prints = {};
|
const prints = {};
|
||||||
const moves = [];
|
const moves = [];
|
||||||
const pushPrint = (tool, poly) => {
|
const pushPrint = (tool, poly) => {
|
||||||
|
|
@ -425,6 +424,7 @@
|
||||||
Object.values(prints).forEach(array => {
|
Object.values(prints).forEach(array => {
|
||||||
out.setLayer('print', 0x888800).addPolys(array, { offset: array.width, height })
|
out.setLayer('print', 0x888800).addPolys(array, { offset: array.width, height })
|
||||||
})
|
})
|
||||||
|
update(index / output.length);
|
||||||
});
|
});
|
||||||
|
|
||||||
return layers;
|
return layers;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue