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;