mirror of
https://git.mirrors.martin98.com/https://github.com/slic3r/Slic3r.git
synced 2025-09-17 01:23:17 +08:00
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:
parent
eb2fa94aed
commit
d25f1bffa1
@ -1082,39 +1082,31 @@ namespace Slic3r {
|
|||||||
intersection_ex(sparse_polys, { upp.expolygon }, true)
|
intersection_ex(sparse_polys, { upp.expolygon }, true)
|
||||||
, (float)-layerm->flow(frInfill).scaled_width(), (float)layerm->flow(frInfill).scaled_width());
|
, (float)-layerm->flow(frInfill).scaled_width(), (float)layerm->flow(frInfill).scaled_width());
|
||||||
if (!intersect.empty()) {
|
if (!intersect.empty()) {
|
||||||
|
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();
|
||||||
|
|
||||||
if (layerm->region()->config().infill_dense_algo == dfaEnlarged) {
|
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
|
//expand the area a bit
|
||||||
intersect = offset_ex(intersect, double(scale_(layerm->region()->config().external_infill_margin.get_abs_value(
|
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))))));
|
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
|
} else {
|
||||||
|| layerm->region()->config().infill_dense_algo == dfaAutomatic) {
|
ExPolygons cover_intersect;
|
||||||
|
|
||||||
//check if area isn't too big for autonotfull
|
// it will be a dense infill, split the surface if needed
|
||||||
double area_intersect = 0;
|
for (ExPolygon& expoly_tocover : intersect) {
|
||||||
if (layerm->region()->config().infill_dense_algo == dfaAutoNotFull)
|
ExPolygons temp = dense_fill_fit_to_size(
|
||||||
for (ExPolygon poly_inter : intersect)
|
expoly_tocover,
|
||||||
area_intersect += poly_inter.area();
|
diff_ex(offset_ex(layerm->fill_no_overlap_expolygons, double(layerm->flow(frInfill).scaled_width())), offset_ex(layerm->fill_no_overlap_expolygons, double(-layerm->flow(frInfill).scaled_width()))),
|
||||||
//like intersect.empty() but more resilient
|
surf.expolygon,
|
||||||
if (layerm->region()->config().infill_dense_algo == dfaAutomatic
|
4 * layerm->flow(frInfill).scaled_width(),
|
||||||
|| surf.area() > area_intersect * COEFF_SPLIT) {
|
0.01f);
|
||||||
ExPolygons cover_intersect;
|
cover_intersect.insert(cover_intersect.end(), temp.begin(), temp.end());
|
||||||
|
|
||||||
// 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,
|
|
||||||
diff_ex(offset_ex(layerm->fill_no_overlap_expolygons, double(layerm->flow(frInfill).scaled_width())), offset_ex(layerm->fill_no_overlap_expolygons, double(-layerm->flow(frInfill).scaled_width()))),
|
|
||||||
surf.expolygon,
|
|
||||||
4 * layerm->flow(frInfill).scaled_width(),
|
|
||||||
0.01f);
|
|
||||||
cover_intersect.insert(cover_intersect.end(), temp.begin(), temp.end());
|
|
||||||
}
|
|
||||||
intersect = cover_intersect;
|
|
||||||
} else {
|
|
||||||
intersect.clear();
|
|
||||||
}
|
}
|
||||||
|
intersect = cover_intersect;
|
||||||
}
|
}
|
||||||
if (!intersect.empty()) {
|
if (!intersect.empty()) {
|
||||||
ExPolygons sparse_surfaces = diff_ex(sparse_polys, intersect, true);
|
ExPolygons sparse_surfaces = diff_ex(sparse_polys, intersect, true);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user