Automatic dense infill in large areas now falls back to the Enlarge algorithm rather than being omitted altogether (Fixes #928)

This commit is contained in:
Oliver Mattos 2021-01-30 15:44:18 +00:00 committed by remi durand
parent eb2fa94aed
commit d25f1bffa1

View File

@ -1082,26 +1082,21 @@ namespace Slic3r {
intersection_ex(sparse_polys, { upp.expolygon }, true)
, (float)-layerm->flow(frInfill).scaled_width(), (float)layerm->flow(frInfill).scaled_width());
if (!intersect.empty()) {
if (layerm->region()->config().infill_dense_algo == dfaEnlarged) {
//expand the area a bit
intersect = offset_ex(intersect, double(scale_(layerm->region()->config().external_infill_margin.get_abs_value(
region->config().perimeters == 0 ? 0 : (layerm->flow(frExternalPerimeter).width + layerm->flow(frPerimeter).spacing() * (region->config().perimeters - 1))))));
} else if (layerm->region()->config().infill_dense_algo == dfaAutoNotFull
|| layerm->region()->config().infill_dense_algo == dfaAutomatic) {
//check if area isn't too big for autonotfull
double area_intersect = 0;
// calculate area to decide if area is small enough for autofill
if (layerm->region()->config().infill_dense_algo == dfaAutoNotFull)
for (ExPolygon poly_inter : intersect)
area_intersect += poly_inter.area();
//like intersect.empty() but more resilient
if (layerm->region()->config().infill_dense_algo == dfaAutomatic
|| surf.area() > area_intersect * COEFF_SPLIT) {
if (layerm->region()->config().infill_dense_algo == dfaEnlarged
|| (layerm->region()->config().infill_dense_algo == dfaAutoNotFull && surf.area() <= area_intersect * COEFF_SPLIT)) {
//expand the area a bit
intersect = offset_ex(intersect, double(scale_(layerm->region()->config().external_infill_margin.get_abs_value(
region->config().perimeters == 0 ? 0 : (layerm->flow(frExternalPerimeter).width + layerm->flow(frPerimeter).spacing() * (region->config().perimeters - 1))))));
} else {
ExPolygons cover_intersect;
// it will be a dense infill, split the surface if needed
//ExPolygons cover_intersect;
for (ExPolygon& expoly_tocover : intersect) {
ExPolygons temp = dense_fill_fit_to_size(
expoly_tocover,
@ -1112,9 +1107,6 @@ namespace Slic3r {
cover_intersect.insert(cover_intersect.end(), temp.begin(), temp.end());
}
intersect = cover_intersect;
} else {
intersect.clear();
}
}
if (!intersect.empty()) {
ExPolygons sparse_surfaces = diff_ex(sparse_polys, intersect, true);