Optimize ensure vertical feature's UX (#4402)

* Change ensure_vertical_shell_thickness to enum value type. Allow users to turn off this feature completely

* add warning to the tooltip for None option
This commit is contained in:
SoftFever 2024-03-10 21:16:02 +08:00 committed by GitHub
parent 922d465605
commit 879c3924c9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 57 additions and 40 deletions

View file

@ -770,7 +770,7 @@ bool Preset::has_cali_lines(PresetBundle* preset_bundle)
static std::vector<std::string> s_Preset_print_options {
"layer_height", "initial_layer_print_height", "wall_loops", "alternate_extra_wall", "slice_closing_radius", "spiral_mode", "spiral_mode_smooth", "spiral_mode_max_xy_smoothing", "slicing_mode",
"top_shell_layers", "top_shell_thickness", "bottom_shell_layers", "bottom_shell_thickness",
"extra_perimeters_on_overhangs", "ensure_vertical_shell_thickness","reduce_wall_solid_infill", "reduce_crossing_wall", "detect_thin_wall", "detect_overhang_wall", "overhang_reverse", "overhang_reverse_threshold","overhang_reverse_internal_only", "wall_direction",
"extra_perimeters_on_overhangs", "ensure_vertical_shell_thickness", "reduce_crossing_wall", "detect_thin_wall", "detect_overhang_wall", "overhang_reverse", "overhang_reverse_threshold","overhang_reverse_internal_only", "wall_direction",
"seam_position", "staggered_inner_seams", "wall_sequence", "is_infill_first", "sparse_infill_density", "sparse_infill_pattern", "top_surface_pattern", "bottom_surface_pattern",
"infill_direction", "counterbole_hole_bridging",
"minimum_sparse_infill_area", "reduce_infill_retraction","internal_solid_infill_pattern","gap_fill_target",

View file

@ -272,6 +272,15 @@ static t_config_enum_values s_keys_map_SeamScarfType{
};
CONFIG_OPTION_ENUM_DEFINE_STATIC_MAPS(SeamScarfType)
// Orca
static t_config_enum_values s_keys_map_EnsureVerticalShellThickness{
{ "none", int(EnsureVerticalShellThickness::vsNone) },
{ "ensure_critical_only", int(EnsureVerticalShellThickness::evstCriticalOnly) },
{ "ensure_moderate", int(EnsureVerticalShellThickness::evstModerate) },
{ "ensure_all", int(EnsureVerticalShellThickness::evstAll) },
};
CONFIG_OPTION_ENUM_DEFINE_STATIC_MAPS(EnsureVerticalShellThickness)
// Orca
static t_config_enum_values s_keys_map_InternalBridgeFilter {
{ "disabled", ibfDisabled },
@ -1382,24 +1391,25 @@ void PrintConfigDef::init_fff_params()
def->mode = comAdvanced;
def->set_default_value(new ConfigOptionStrings { " " });
def = this->add("ensure_vertical_shell_thickness", coBool);
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->tooltip = L(
"Add solid infill near sloping surfaces to guarantee the vertical shell thickness (top+bottom solid layers)\nNone: No solid infill "
"will be added anywhere. Caution: Use this option carefully if your model has sloped surfaces\nCritical Only: Avoid adding solid infill for walls\nModerate: Add solid infill for heavily "
"sloping surfaces only\nAll: Add solid infill for all suitable sloping surfaces\nDefault value is All.");
def->enum_keys_map = &ConfigOptionEnum<EnsureVerticalShellThickness>::get_enum_values();
def->enum_values.push_back("none");
def->enum_values.push_back("ensure_critical_only");
def->enum_values.push_back("ensure_moderate");
def->enum_values.push_back("ensure_all");
def->enum_labels.push_back(L("None"));
def->enum_labels.push_back(L("Critical Only"));
def->enum_labels.push_back(L("Moderate"));
def->enum_labels.push_back(L("All"));
def->mode = comAdvanced;
def->set_default_value(new ConfigOptionBool(true));
def->set_default_value(new ConfigOptionEnum<EnsureVerticalShellThickness>(EnsureVerticalShellThickness::evstAll));
def = this->add("reduce_wall_solid_infill", coBool);
def->label = L("Further reduce solid infill on walls (beta)");
def->category = L("Strength");
def->tooltip = L("Further reduces any solid infill applied to walls. As there will be very limited infill supporting"
" solid surfaces, make sure that you are using adequate number of walls to support the part on sloping surfaces.\n\n"
"For heavily sloped surfaces this option is not suitable as it will generate too thin of a top layer "
"and should be disabled.");
def->mode = comAdvanced;
def->set_default_value(new ConfigOptionBool(false));
auto def_top_fill_pattern = def = this->add("top_surface_pattern", coEnum);
def->label = L("Top surface pattern");
def->category = L("Strength");
@ -5710,6 +5720,14 @@ void PrintConfigDef::handle_legacy(t_config_option_key &opt_key, std::string &va
} else if(opt_key == "single_extruder_multi_material") {
value = "1";
}
else if(opt_key == "ensure_vertical_shell_thickness") {
if(value == "1") {
value = "ensure_all";
}
else if (value == "0"){
value = "ensure_moderate";
}
}
else if (opt_key == "sparse_infill_anchor") {
opt_key = "infill_anchor";
}
@ -5737,9 +5755,8 @@ void PrintConfigDef::handle_legacy(t_config_option_key &opt_key, std::string &va
static std::set<std::string> ignore = {
"acceleration", "scale", "rotate", "duplicate", "duplicate_grid",
"bed_size",
"print_center", "g0", "wipe_tower_per_color_wipe"
// BBS
, "support_sharp_tails","support_remove_small_overhangs", "support_with_sheath",
"print_center", "g0", "wipe_tower_per_color_wipe",
"support_sharp_tails","support_remove_small_overhangs", "support_with_sheath",
"tree_support_collision_resolution", "tree_support_with_infill",
"max_volumetric_speed", "max_print_speed",
"support_closing_radius",
@ -5748,7 +5765,7 @@ void PrintConfigDef::handle_legacy(t_config_option_key &opt_key, std::string &va
"can_switch_nozzle_type", "can_add_auxiliary_fan", "extra_flush_volume", "spaghetti_detector", "adaptive_layer_height",
"z_hop_type", "z_lift_type", "bed_temperature_difference",
"extruder_type",
"internal_bridge_support_thickness","extruder_clearance_max_radius", "top_area_threshold"
"internal_bridge_support_thickness","extruder_clearance_max_radius", "top_area_threshold", "reduce_wall_solid_infill"
};
if (ignore.find(opt_key) != ignore.end()) {

View file

@ -176,6 +176,14 @@ enum class SeamScarfType {
All,
};
// Orca
enum EnsureVerticalShellThickness {
vsNone,
evstCriticalOnly,
evstModerate,
evstAll,
};
//Orca
enum InternalBridgeFilter {
ibfDisabled, ibfLimited, ibfNofilter
@ -859,8 +867,7 @@ PRINT_CONFIG_CLASS_DEFINE(
((ConfigOptionFloat, internal_bridge_flow))
((ConfigOptionFloat, bridge_speed))
((ConfigOptionFloatOrPercent, internal_bridge_speed))
((ConfigOptionBool, ensure_vertical_shell_thickness))
((ConfigOptionBool, reduce_wall_solid_infill))
((ConfigOptionEnum<EnsureVerticalShellThickness>, ensure_vertical_shell_thickness))
((ConfigOptionEnum<InfillPattern>, top_surface_pattern))
((ConfigOptionEnum<InfillPattern>, bottom_surface_pattern))
((ConfigOptionEnum<InfillPattern>, internal_solid_infill_pattern))

View file

@ -1564,7 +1564,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 == evstAll) {
has_extra_layers = true;
break;
}
@ -1642,7 +1642,7 @@ void PrintObject::discover_vertical_shells()
for (size_t region_id = 0; region_id < this->num_printing_regions(); ++ region_id) {
const PrintRegion &region = this->printing_region(region_id);
if (! region.config().ensure_vertical_shell_thickness.value)
if (region.config().ensure_vertical_shell_thickness.value != evstAll )
// This region will be handled by discover_horizontal_shells().
continue;
@ -3184,7 +3184,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 == evstAll || region_config.ensure_vertical_shell_thickness.value == vsNone)
continue;
coordf_t print_z = layer->print_z;
@ -3258,7 +3258,7 @@ void PrintObject::discover_horizontal_shells()
// Orca: Also use the same strategy if the user has selected to further reduce
// the amount of solid infill on walls.
if (region_config.sparse_infill_density.value == 0 || region_config.reduce_wall_solid_infill) {
if (region_config.sparse_infill_density.value == 0 || region_config.ensure_vertical_shell_thickness.value == evstCriticalOnly) {
// 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
@ -3271,7 +3271,7 @@ void PrintObject::discover_horizontal_shells()
}
}
if (region_config.sparse_infill_density.value == 0 || region_config.reduce_wall_solid_infill) {
if (region_config.sparse_infill_density.value == 0 || region_config.ensure_vertical_shell_thickness.value == evstCriticalOnly) {
// if we're printing a hollow object we discard any solid shell thinner
// than a perimeter width, since it's probably just crossing a sloping wall
// and it's not wanted in a hollow print even if it would make sense when
@ -3283,7 +3283,7 @@ void PrintObject::discover_horizontal_shells()
// filtering. This is an arbitrary value to make this option safe
// by ensuring that top surfaces, especially slanted ones dont go **completely** unsupported
// especially when using single perimeter top layers.
float margin = region_config.reduce_wall_solid_infill? float(neighbor_layerm->flow(frExternalPerimeter).scaled_width()) * 0.2f : float(neighbor_layerm->flow(frExternalPerimeter).scaled_width());
float margin = region_config.ensure_vertical_shell_thickness.value == evstCriticalOnly? float(neighbor_layerm->flow(frExternalPerimeter).scaled_width()) * 0.2f : float(neighbor_layerm->flow(frExternalPerimeter).scaled_width());
Polygons too_narrow = diff(
new_internal_solid,
opening(new_internal_solid, margin, margin + ClipperSafetyOffset, jtMiter, 5));

View file

@ -7,6 +7,7 @@
#include "I18N.hpp"
#include "GUI_App.hpp"
#include "format.hpp"
#include "libslic3r/Config.hpp"
#include "libslic3r/Model.hpp"
#include "libslic3r/PresetBundle.hpp"
#include "MsgDialog.hpp"
@ -326,9 +327,9 @@ void ConfigManipulation::update_print_fff_config(DynamicPrintConfig* config, con
}
is_msg_dlg_already_exist = false;
}
if (config->opt_bool("alternate_extra_wall") && config->opt_bool("ensure_vertical_shell_thickness"))
{
if (config->opt_bool("alternate_extra_wall") &&
(config->opt_enum<EnsureVerticalShellThickness>("ensure_vertical_shell_thickness") == evstAll)) {
wxString msg_text = _(L("Alternate extra wall only works with ensure vertical shell thickness disabled. "));
if (is_global_config)
@ -341,11 +342,11 @@ void ConfigManipulation::update_print_fff_config(DynamicPrintConfig* config, con
DynamicPrintConfig new_conf = *config;
auto answer = dialog.ShowModal();
if (!is_global_config || answer == wxID_YES) {
new_conf.set_key_value("ensure_vertical_shell_thickness", new ConfigOptionBool(false));
new_conf.set_key_value("ensure_vertical_shell_thickness", new ConfigOptionEnum<EnsureVerticalShellThickness>(vsNone));
new_conf.set_key_value("alternate_extra_wall", new ConfigOptionBool(true));
}
else {
new_conf.set_key_value("ensure_vertical_shell_thickness", new ConfigOptionBool(true));
new_conf.set_key_value("ensure_vertical_shell_thickness", new ConfigOptionEnum<EnsureVerticalShellThickness>(evstAll));
new_conf.set_key_value("alternate_extra_wall", new ConfigOptionBool(false));
}
apply(config, &new_conf);
@ -516,13 +517,6 @@ void ConfigManipulation::toggle_print_fff_options(DynamicPrintConfig *config, co
bool have_gap_fill = config->opt_enum<GapFillTarget>("gap_fill_target") != gftNowhere;
toggle_line("filter_out_gap_fill", have_gap_fill);
bool have_ensure_vertical_thickness = config->opt_bool("ensure_vertical_shell_thickness");
if(have_ensure_vertical_thickness) {
DynamicPrintConfig new_conf = *config;
new_conf.set_key_value("reduce_wall_solid_infill", new ConfigOptionBool(false));
apply(config, &new_conf);
}
toggle_line("reduce_wall_solid_infill",!have_ensure_vertical_thickness);
bool have_perimeters = config->opt_int("wall_loops") > 0;
for (auto el : { "extra_perimeters_on_overhangs", "ensure_vertical_shell_thickness", "detect_thin_wall", "detect_overhang_wall",

View file

@ -2094,7 +2094,6 @@ void TabPrint::build()
optgroup->append_single_option_line("infill_combination");
optgroup->append_single_option_line("detect_narrow_internal_solid_infill");
optgroup->append_single_option_line("ensure_vertical_shell_thickness");
optgroup->append_single_option_line("reduce_wall_solid_infill");
page = add_options_page(L("Speed"), "empty");
optgroup = page->new_optgroup(L("Initial layer speed"), L"param_speed_first", 15);