diff --git a/src/libslic3r/PrintConfig.cpp b/src/libslic3r/PrintConfig.cpp index 018872c94..6b8ebab1c 100644 --- a/src/libslic3r/PrintConfig.cpp +++ b/src/libslic3r/PrintConfig.cpp @@ -187,6 +187,13 @@ static t_config_enum_values s_keys_map_WallSequence { }; CONFIG_OPTION_ENUM_DEFINE_STATIC_MAPS(WallSequence) +static t_config_enum_values s_keys_map_EnsureVerticalThicknessLevel { + { "disabled", int(EnsureVerticalThicknessLevel::evtDisabled) }, + { "partial", int(EnsureVerticalThicknessLevel::evtPartial) }, + { "enabled", int(EnsureVerticalThicknessLevel::evtEnabled)} +}; +CONFIG_OPTION_ENUM_DEFINE_STATIC_MAPS(EnsureVerticalThicknessLevel) + //BBS static t_config_enum_values s_keys_map_PrintSequence { { "by layer", int(PrintSequence::ByLayer) }, @@ -1330,6 +1337,21 @@ void PrintConfigDef::init_fff_params() def->mode = comAdvanced; def->set_default_value(new ConfigOptionBool(true)); + def = this->add("ensure_vertical_shell_thickness", coEnum); + def->label = L("Ensure vertical shell thickness"); + def->category = L("Strength"); + def->tooltip = L("Add solid infill near sloping surfaces to guarantee the vertical shell thickness " + "(top+bottom solid layers)"); + def->mode = comAdvanced; + def->enum_keys_map = &ConfigOptionEnum::get_enum_values(); + def->enum_values.push_back("disabled"); + def->enum_values.push_back("partial"); + def->enum_values.push_back("enabled"); + def->enum_labels.push_back(L("Disabled")); + def->enum_labels.push_back(L("Partial")); + def->enum_labels.push_back(L("Enabled")); + def->set_default_value(new ConfigOptionEnum(EnsureVerticalThicknessLevel::evtEnabled)); + def = this->add("internal_bridge_support_thickness", coFloat); def->label = L("Internal bridge support thickness"); def->category = L("Strength"); @@ -5378,6 +5400,14 @@ void PrintConfigDef::handle_legacy(t_config_option_key &opt_key, std::string &va else if (opt_key == "extruder_type") { ReplaceString(value, "DirectDrive", "Direct Drive"); } + else if (opt_key == "ensure_vertical_shell_thickness") { + auto kvmap=ConfigOptionEnum::get_enum_names(); + // handle old values + if (value == "1") + value = ConfigOptionEnum::get_enum_names()[EnsureVerticalThicknessLevel::evtEnabled]; + else if (value == "0") + value = ConfigOptionEnum::get_enum_names()[EnsureVerticalThicknessLevel::evtPartial]; + } // Ignore the following obsolete configuration keys: static std::set ignore = { diff --git a/src/libslic3r/PrintConfig.hpp b/src/libslic3r/PrintConfig.hpp index 1a96a4eb6..0e96a12f6 100644 --- a/src/libslic3r/PrintConfig.hpp +++ b/src/libslic3r/PrintConfig.hpp @@ -58,6 +58,12 @@ enum InfillPattern : int { ipCount, }; +enum EnsureVerticalThicknessLevel{ + evtDisabled, + evtPartial, + evtEnabled +}; + enum class IroningType { NoIroning, TopSurfaces, @@ -883,7 +889,7 @@ PRINT_CONFIG_CLASS_DEFINE( ((ConfigOptionFloat, bridge_flow)) ((ConfigOptionFloatsNullable, overhang_totally_speed)) ((ConfigOptionFloatsNullable, bridge_speed)) - ((ConfigOptionBool, ensure_vertical_shell_thickness)) + ((ConfigOptionEnum, ensure_vertical_shell_thickness)) ((ConfigOptionEnum, top_surface_pattern)) ((ConfigOptionEnum, bottom_surface_pattern)) ((ConfigOptionEnum, internal_solid_infill_pattern)) diff --git a/src/libslic3r/PrintObject.cpp b/src/libslic3r/PrintObject.cpp index 40ef136eb..26ee5035d 100644 --- a/src/libslic3r/PrintObject.cpp +++ b/src/libslic3r/PrintObject.cpp @@ -1525,7 +1525,7 @@ void PrintObject::discover_vertical_shells() bool has_extra_layers = false; for (size_t region_id = 0; region_id < this->num_printing_regions(); ++region_id) { const PrintRegionConfig &config = this->printing_region(region_id).config(); - if (config.ensure_vertical_shell_thickness.value) { + if (config.ensure_vertical_shell_thickness.value!=EnsureVerticalThicknessLevel::evtDisabled) { has_extra_layers = true; break; } @@ -1604,7 +1604,7 @@ void PrintObject::discover_vertical_shells() for (size_t region_id = 0; region_id < this->num_printing_regions(); ++ region_id) { //FIXME Improve the heuristics for a grain size. const PrintRegion ®ion = this->printing_region(region_id); - if (!region.config().ensure_vertical_shell_thickness.value) + if (region.config().ensure_vertical_shell_thickness.value==EnsureVerticalThicknessLevel::evtDisabled) // This region will be handled by discover_horizontal_shells(). continue; @@ -1724,7 +1724,9 @@ void PrintObject::discover_vertical_shells() ++ i) { at_least_one_top_projected = true; const DiscoverVerticalShellsCacheEntry &cache = cache_top_botom_regions[i]; - combine_holes(cache.holes); + if (region_config.ensure_vertical_shell_thickness.value != EnsureVerticalThicknessLevel::evtPartial) { + combine_holes(cache.holes); + } combine_shells(cache.top_surfaces); } if (!at_least_one_top_projected && i < int(cache_top_botom_regions.size())) { @@ -1753,7 +1755,9 @@ void PrintObject::discover_vertical_shells() -- i) { at_least_one_bottom_projected = true; const DiscoverVerticalShellsCacheEntry &cache = cache_top_botom_regions[i]; - combine_holes(cache.holes); + if (region_config.ensure_vertical_shell_thickness.value != EnsureVerticalThicknessLevel::evtPartial) { + combine_holes(cache.holes); + } combine_shells(cache.bottom_surfaces); } @@ -3304,7 +3308,7 @@ void PrintObject::discover_horizontal_shells() } #endif // If ensure_vertical_shell_thickness, then the rest has already been performed by discover_vertical_shells(). - if (region_config.ensure_vertical_shell_thickness.value) + if (region_config.ensure_vertical_shell_thickness.value!=EnsureVerticalThicknessLevel::evtDisabled) continue; coordf_t print_z = layer->print_z; @@ -3375,7 +3379,7 @@ void PrintObject::discover_horizontal_shells() // No internal solid needed on this layer. In order to decide whether to continue // searching on the next neighbor (thus enforcing the configured number of solid // layers, use different strategies according to configured infill density: - if (region_config.sparse_infill_density.value == 0) { + if (region_config.sparse_infill_density.value == 0 || region_config.ensure_vertical_shell_thickness.value == EnsureVerticalThicknessLevel::evtDisabled) { // If user expects the object to be void (for example a hollow sloping vase), // don't continue the search. In this case, we only generate the external solid // shell if the object would otherwise show a hole (gap between perimeters of