diff --git a/src/libslic3r/PrintConfig.cpp b/src/libslic3r/PrintConfig.cpp index 0be6108fa..69c2be255 100644 --- a/src/libslic3r/PrintConfig.cpp +++ b/src/libslic3r/PrintConfig.cpp @@ -2048,12 +2048,14 @@ void PrintConfigDef::init_fff_params() def->enum_keys_map = &ConfigOptionEnum::get_enum_values(); def->enum_values.push_back("automatic"); def->enum_values.push_back("autosmall"); + def->enum_values.push_back("autoenlarged"); def->enum_values.push_back("enlarged"); def->enum_labels.push_back(L("Automatic")); def->enum_labels.push_back(L("Automatic, only for small areas")); + def->enum_labels.push_back(L("Automatic, or anchored if too big")); def->enum_labels.push_back(L("Anchored")); def->mode = comAdvanced; - def->set_default_value(new ConfigOptionEnum(dfaAutoNotFull)); + def->set_default_value(new ConfigOptionEnum(dfaAutoOrEnlarged)); def = this->add("infill_extruder", coInt); def->label = L("Infill extruder"); diff --git a/src/libslic3r/PrintConfig.hpp b/src/libslic3r/PrintConfig.hpp index e6b836db5..41bb8273b 100644 --- a/src/libslic3r/PrintConfig.hpp +++ b/src/libslic3r/PrintConfig.hpp @@ -114,7 +114,7 @@ enum SLAMaterial { slamHeatResistant, }; enum DenseInfillAlgo { - dfaAutomatic, dfaAutoNotFull, dfaEnlarged, + dfaAutomatic, dfaAutoNotFull, dfaAutoOrEnlarged , dfaEnlarged, }; enum NoPerimeterUnsupportedAlgo { @@ -298,6 +298,7 @@ template<> inline const t_config_enum_values& ConfigOptionEnum: static const t_config_enum_values keys_map = { { "automatic", dfaAutomatic }, { "autosmall", dfaAutoNotFull }, + { "autoenlarged", dfaAutoOrEnlarged }, { "enlarged", dfaEnlarged } }; return keys_map; diff --git a/src/libslic3r/PrintObject.cpp b/src/libslic3r/PrintObject.cpp index f66ffd2ff..f2c9dc918 100644 --- a/src/libslic3r/PrintObject.cpp +++ b/src/libslic3r/PrintObject.cpp @@ -1084,29 +1084,38 @@ namespace Slic3r { 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) + if (layerm->region()->config().infill_dense_algo == dfaAutoNotFull || layerm->region()->config().infill_dense_algo == dfaAutoOrEnlarged) for (ExPolygon poly_inter : intersect) area_intersect += poly_inter.area(); if (layerm->region()->config().infill_dense_algo == dfaEnlarged - || (layerm->region()->config().infill_dense_algo == dfaAutoNotFull && surf.area() <= area_intersect * COEFF_SPLIT)) { + || (layerm->region()->config().infill_dense_algo == dfaAutoOrEnlarged && 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; + } else if (layerm->region()->config().infill_dense_algo == dfaAutoNotFull + || layerm->region()->config().infill_dense_algo == dfaAutomatic) { - // it will be a dense infill, split the surface if needed - 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()); + //like intersect.empty() but more resilient + if (layerm->region()->config().infill_dense_algo == dfaAutomatic + || surf.area() > area_intersect * COEFF_SPLIT) { + 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, + 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()) { ExPolygons sparse_surfaces = diff_ex(sparse_polys, intersect, true);