trigger solid layer on large projections. add flat call stack limit fallback method

This commit is contained in:
Stewart Allen 2022-02-27 15:00:59 -05:00
commit 67bdbf9125
3 changed files with 28 additions and 1 deletions

View file

@ -19,6 +19,7 @@
* `C` abstract file loading (onshape import, mesh replace, etc) * `C` abstract file loading (onshape import, mesh replace, etc)
* `C` enable/disable ray intersect path on feature state change * `C` enable/disable ray intersect path on feature state change
* `C` new and updated device profiles: Prusa MK2S/MK3S+, Ender 3 * `C` new and updated device profiles: Prusa MK2S/MK3S+, Ender 3
* `C` trigger solid layer when transitions lead to 50% projected areas
* `P` limit non-manifold solution search depth (parameterize) * `P` limit non-manifold solution search depth (parameterize)
* `P` refactor slicers to use single improved slice core (cnc tbd) * `P` refactor slicers to use single improved slice core (cnc tbd)
* `P` template vars: nozzles used and layers until next use (IDEX) * `P` template vars: nozzles used and layers until next use (IDEX)

View file

@ -9,7 +9,16 @@ let AP = {};
if (!AP.flat) { if (!AP.flat) {
AP.flat = function() { AP.flat = function() {
return [].concat.apply([], this); try {
return [].concat.apply([], this);
} catch (e) {
// console.log({flat_error: e});
let out = [];
for (let e of this.slice()) {
out.push(...e);
}
return out;
}
}; };
} }

View file

@ -1150,8 +1150,10 @@ function doSolidsFill(slice, spacing, angle, minArea, fillQ) {
slice.solids = solids = trims; slice.solids = solids = trims;
// parent each solid polygon inside the smallest bounding top // parent each solid polygon inside the smallest bounding top
let make_solid_layer = false;
for (let solid of solids) { for (let solid of solids) {
for (let top of tops) { for (let top of tops) {
let stop = [];
if (top.poly.overlaps(solid)) { if (top.poly.overlaps(solid)) {
if (!solid.parent || solid.parent.area() > top.poly.area()) { if (!solid.parent || solid.parent.area() > top.poly.area()) {
if (solid.areaDeep() < minarea) { if (solid.areaDeep() < minarea) {
@ -1160,10 +1162,25 @@ function doSolidsFill(slice, spacing, angle, minArea, fillQ) {
} }
solid.parent = top.poly; solid.parent = top.poly;
top.solids.push(solid); top.solids.push(solid);
stop.push(solid);
} }
} }
let top_area = top.poly.areaDeep();
let stop_area = stop.map(p => p.areaDeep()).reduce((a,v) => a + v);
if (stop_area / top_area > 0.5) {
make_solid_layer = true;
}
} }
} }
// if 50% of top is filled with solids, trigger layer conversion to solid
// in future, this should be limited to a specific top, not entire layer
if (make_solid_layer) {
for (let top of tops) {
top.solids = [];
}
doSolidLayerFill(slice, spacing, angle);
return;
}
// for SLA to bypass line infill // for SLA to bypass line infill
if (isSLA) { if (isSLA) {