mirror of
https://git.mirrors.martin98.com/https://github.com/slic3r/Slic3r.git
synced 2025-07-16 07:41:51 +08:00
Automatic dense infill falls back to the Enlarge algorithm in a new option (now new default)
This commit is contained in:
parent
d25f1bffa1
commit
605a4323e6
@ -2048,12 +2048,14 @@ void PrintConfigDef::init_fff_params()
|
||||
def->enum_keys_map = &ConfigOptionEnum<DenseInfillAlgo>::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<DenseInfillAlgo>(dfaAutoNotFull));
|
||||
def->set_default_value(new ConfigOptionEnum<DenseInfillAlgo>(dfaAutoOrEnlarged));
|
||||
|
||||
def = this->add("infill_extruder", coInt);
|
||||
def->label = L("Infill extruder");
|
||||
|
@ -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<DenseInfillAlgo>:
|
||||
static const t_config_enum_values keys_map = {
|
||||
{ "automatic", dfaAutomatic },
|
||||
{ "autosmall", dfaAutoNotFull },
|
||||
{ "autoenlarged", dfaAutoOrEnlarged },
|
||||
{ "enlarged", dfaEnlarged }
|
||||
};
|
||||
return keys_map;
|
||||
|
@ -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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user