From 90097a19266401b38d52142cac055489038cbe36 Mon Sep 17 00:00:00 2001 From: Ioannis Giannakas <59056762+igiannakas@users.noreply.github.com> Date: Fri, 22 Dec 2023 00:54:03 +0000 Subject: [PATCH] ENH: PR: Alternate extra wall (#3196) * ENH: PR: Alternate extra wall * Updated tooltip * Tooltip spelling correction * Introduce dialog box to disable ensure vertical shell thickness * Alternate Extra Wall - automatically disable for Vase mode and revert vase mode toggles * Corrected invalid push --------- Co-authored-by: SoftFever --- src/libslic3r/PerimeterGenerator.cpp | 4 ++++ src/libslic3r/Preset.cpp | 2 +- src/libslic3r/PrintConfig.cpp | 9 +++++++++ src/libslic3r/PrintConfig.hpp | 1 + src/libslic3r/PrintObject.cpp | 1 + src/slic3r/GUI/ConfigManipulation.cpp | 26 ++++++++++++++++++++++++-- src/slic3r/GUI/Plater.cpp | 6 ++++++ src/slic3r/GUI/Tab.cpp | 1 + src/slic3r/Utils/CalibUtils.cpp | 5 ++++- 9 files changed, 51 insertions(+), 4 deletions(-) diff --git a/src/libslic3r/PerimeterGenerator.cpp b/src/libslic3r/PerimeterGenerator.cpp index 4adf705665..4774d5fae2 100644 --- a/src/libslic3r/PerimeterGenerator.cpp +++ b/src/libslic3r/PerimeterGenerator.cpp @@ -1505,6 +1505,8 @@ void PerimeterGenerator::process_classic() const Surface &surface = this->slices->surfaces[surface_order[order_idx]]; // detect how many perimeters must be generated for this island int loop_number = this->config->wall_loops + surface.extra_perimeters - 1; // 0-indexed loops + if (this->config->alternate_extra_wall && this->layer_id % 2 == 1 && !m_spiral_vase) // add alternating extra wall + loop_number++; if (this->layer_id == 0 && this->config->only_one_wall_first_layer) loop_number = 0; // Set the topmost layer to be one wall @@ -1937,6 +1939,8 @@ void PerimeterGenerator::process_arachne() coord_t bead_width_0 = ext_perimeter_spacing; // detect how many perimeters must be generated for this island int loop_number = this->config->wall_loops + surface.extra_perimeters - 1; // 0-indexed loops + if (this->config->alternate_extra_wall && this->layer_id % 2 == 1 && !m_spiral_vase) // add alternating extra wall + loop_number++; if (this->layer_id == 0 && this->config->only_one_wall_first_layer) loop_number = 0; // Orca: set the topmost layer to be one wall according to the config diff --git a/src/libslic3r/Preset.cpp b/src/libslic3r/Preset.cpp index 3f18aa8443..127dc7aa57 100644 --- a/src/libslic3r/Preset.cpp +++ b/src/libslic3r/Preset.cpp @@ -766,7 +766,7 @@ bool Preset::has_cali_lines(PresetBundle* preset_bundle) } static std::vector s_Preset_print_options { - "layer_height", "initial_layer_print_height", "wall_loops", "slice_closing_radius", "spiral_mode", "spiral_mode_smooth", "spiral_mode_max_xy_smoothing", "slicing_mode", + "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_crossing_wall", "detect_thin_wall", "detect_overhang_wall", "overhang_reverse", "overhang_reverse_threshold","overhang_reverse_internal_only", "seam_position", "staggered_inner_seams", "wall_sequence", "is_infill_first", "sparse_infill_density", "sparse_infill_pattern", "top_surface_pattern", "bottom_surface_pattern", diff --git a/src/libslic3r/PrintConfig.cpp b/src/libslic3r/PrintConfig.cpp index f31620f17e..c3fafc6cb8 100644 --- a/src/libslic3r/PrintConfig.cpp +++ b/src/libslic3r/PrintConfig.cpp @@ -3001,6 +3001,13 @@ def = this->add("filament_loading_speed", coFloats); def->max = 1000; def->set_default_value(new ConfigOptionInt(2)); + def = this->add("alternate_extra_wall", coBool); + def->label = L("Alternate extra wall"); + def->category = L("Strength"); + def->tooltip = L("This setting adds an extra wall to every other layer. This way the infill gets wedged vertically between the walls, resulting in stronger prints. \n\nWhen this option is enabled, the ensure vertical shell thickness option needs to be disabled. \n\nUsing lightning infill together with this option is not recommended as there is limited infill to anchor the extra perimeters to."); + def->mode = comAdvanced; + def->set_default_value(new ConfigOptionBool(false)); + def = this->add("post_process", coStrings); def->label = L("Post-processing Scripts"); def->tooltip = L("If you want to process the output G-code through custom scripts, " @@ -5494,6 +5501,7 @@ void DynamicPrintConfig::normalize_fdm(int used_filaments) } { this->opt("wall_loops", true)->value = 1; + this->opt("alternate_extra_wall", true)->value = false; this->opt("top_shell_layers", true)->value = 0; this->opt("sparse_infill_density", true)->value = 0; } @@ -5566,6 +5574,7 @@ void DynamicPrintConfig::normalize_fdm_1() } { this->opt("wall_loops", true)->value = 1; + this->opt("alternate_extra_wall", true)->value = false; this->opt("top_shell_layers", true)->value = 0; this->opt("sparse_infill_density", true)->value = 0; } diff --git a/src/libslic3r/PrintConfig.hpp b/src/libslic3r/PrintConfig.hpp index 8738d13247..91993d3180 100644 --- a/src/libslic3r/PrintConfig.hpp +++ b/src/libslic3r/PrintConfig.hpp @@ -853,6 +853,7 @@ PRINT_CONFIG_CLASS_DEFINE( ((ConfigOptionFloat, inner_wall_speed)) // Total number of perimeters. ((ConfigOptionInt, wall_loops)) + ((ConfigOptionBool, alternate_extra_wall)) ((ConfigOptionFloat, minimum_sparse_infill_area)) ((ConfigOptionInt, solid_infill_filament)) ((ConfigOptionFloatOrPercent, internal_solid_infill_line_width)) diff --git a/src/libslic3r/PrintObject.cpp b/src/libslic3r/PrintObject.cpp index a7ebfdc7f9..866d9224a8 100644 --- a/src/libslic3r/PrintObject.cpp +++ b/src/libslic3r/PrintObject.cpp @@ -911,6 +911,7 @@ bool PrintObject::invalidate_state_by_config_options( } } else if ( opt_key == "wall_loops" + || opt_key == "alternate_extra_wall" || opt_key == "top_one_wall_type" || opt_key == "min_width_top_surface" || opt_key == "only_one_wall_first_layer" diff --git a/src/slic3r/GUI/ConfigManipulation.cpp b/src/slic3r/GUI/ConfigManipulation.cpp index bb0ced4406..947a6a09d1 100644 --- a/src/slic3r/GUI/ConfigManipulation.cpp +++ b/src/slic3r/GUI/ConfigManipulation.cpp @@ -277,7 +277,6 @@ void ConfigManipulation::update_print_fff_config(DynamicPrintConfig* config, con sparse_infill_density == 0 && ! config->opt_bool("enable_support") && config->opt_int("enforce_support_layers") == 0 && - config->opt_bool("ensure_vertical_shell_thickness") && ! config->opt_bool("detect_thin_wall") && ! config->opt_bool("overhang_reverse") && config->opt_enum("timelapse_type") == TimelapseType::tlTraditional)) @@ -305,7 +304,6 @@ void ConfigManipulation::update_print_fff_config(DynamicPrintConfig* config, con new_conf.set_key_value("sparse_infill_density", new ConfigOptionPercent(0)); new_conf.set_key_value("enable_support", new ConfigOptionBool(false)); new_conf.set_key_value("enforce_support_layers", new ConfigOptionInt(0)); - new_conf.set_key_value("ensure_vertical_shell_thickness", new ConfigOptionBool(true)); new_conf.set_key_value("detect_thin_wall", new ConfigOptionBool(false)); new_conf.set_key_value("overhang_reverse", new ConfigOptionBool(false)); new_conf.set_key_value("timelapse_type", new ConfigOptionEnum(tlTraditional)); @@ -326,6 +324,30 @@ 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")) + { + wxString msg_text = _(L("Alternate extra wall only works with ensure vertical shell thickness disabled. ")); + + if (is_global_config) + msg_text += "\n\n" + _(L("Change these settings automatically? \n" + "Yes - Disable ensure vertical shell thickness and enable alternate extra wall\n" + "No - Dont use alternate extra wall")); + + MessageDialog dialog(m_msg_dlg_parent, msg_text, "", + wxICON_WARNING | (is_global_config ? wxYES | wxNO : wxOK)); + 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("alternate_extra_wall", new ConfigOptionBool(true)); + } + else { + new_conf.set_key_value("ensure_vertical_shell_thickness", new ConfigOptionBool(true)); + new_conf.set_key_value("alternate_extra_wall", new ConfigOptionBool(false)); + } + apply(config, &new_conf); + } // BBS int filament_cnt = wxGetApp().preset_bundle->filament_presets.size(); diff --git a/src/slic3r/GUI/Plater.cpp b/src/slic3r/GUI/Plater.cpp index 030231efb4..cc393f86c1 100644 --- a/src/slic3r/GUI/Plater.cpp +++ b/src/slic3r/GUI/Plater.cpp @@ -8968,6 +8968,7 @@ void Plater::_calib_pa_tower(const Calib_Params& params) { const double nozzle_diameter = printer_config->option("nozzle_diameter")->get_at(0); filament_config->set_key_value("slow_down_layer_time", new ConfigOptionFloats{ 1.0f }); + print_config->set_key_value("alternate_extra_wall", new ConfigOptionBool(false)); print_config->set_key_value("default_jerk", new ConfigOptionFloat(1.0f)); print_config->set_key_value("outer_wall_jerk", new ConfigOptionFloat(1.0f)); print_config->set_key_value("inner_wall_jerk", new ConfigOptionFloat(1.0f)); @@ -9096,6 +9097,7 @@ void Plater::calib_flowrate(int pass) { } print_config->set_key_value("layer_height", new ConfigOptionFloat(layer_height)); + print_config->set_key_value("alternate_extra_wall", new ConfigOptionBool(false)); print_config->set_key_value("initial_layer_print_height", new ConfigOptionFloat(first_layer_height)); print_config->set_key_value("reduce_crossing_wall", new ConfigOptionBool(true)); //filament_config->set_key_value("filament_max_volumetric_speed", new ConfigOptionFloats{ 9. }); @@ -9123,6 +9125,7 @@ void Plater::calib_temp(const Calib_Params& params) { model().objects[0]->config.set_key_value("brim_type", new ConfigOptionEnum(btOuterOnly)); model().objects[0]->config.set_key_value("brim_width", new ConfigOptionFloat(5.0)); model().objects[0]->config.set_key_value("brim_object_gap", new ConfigOptionFloat(0.0)); + model().objects[0]->config.set_key_value("alternate_extra_wall", new ConfigOptionBool(false)); changed_objects({ 0 }); wxGetApp().get_tab(Preset::TYPE_PRINT)->update_dirty(); @@ -9191,6 +9194,7 @@ void Plater::calib_max_vol_speed(const Calib_Params& params) print_config->set_key_value("enable_overhang_speed", new ConfigOptionBool { false }); print_config->set_key_value("timelapse_type", new ConfigOptionEnum(tlTraditional)); print_config->set_key_value("wall_loops", new ConfigOptionInt(1)); + print_config->set_key_value("alternate_extra_wall", new ConfigOptionBool(false)); print_config->set_key_value("top_shell_layers", new ConfigOptionInt(0)); print_config->set_key_value("bottom_shell_layers", new ConfigOptionInt(0)); print_config->set_key_value("sparse_infill_density", new ConfigOptionPercent(0)); @@ -9256,6 +9260,7 @@ void Plater::calib_retraction(const Calib_Params& params) obj->config.set_key_value("sparse_infill_density", new ConfigOptionPercent(0)); obj->config.set_key_value("initial_layer_print_height", new ConfigOptionFloat(layer_height)); obj->config.set_key_value("layer_height", new ConfigOptionFloat(layer_height)); + obj->config.set_key_value("alternate_extra_wall", new ConfigOptionBool(false)); changed_objects({ 0 }); @@ -9285,6 +9290,7 @@ void Plater::calib_VFA(const Calib_Params& params) print_config->set_key_value("enable_overhang_speed", new ConfigOptionBool { false }); print_config->set_key_value("timelapse_type", new ConfigOptionEnum(tlTraditional)); print_config->set_key_value("wall_loops", new ConfigOptionInt(1)); + print_config->set_key_value("alternate_extra_wall", new ConfigOptionBool(false)); print_config->set_key_value("top_shell_layers", new ConfigOptionInt(0)); print_config->set_key_value("bottom_shell_layers", new ConfigOptionInt(1)); print_config->set_key_value("sparse_infill_density", new ConfigOptionPercent(0)); diff --git a/src/slic3r/GUI/Tab.cpp b/src/slic3r/GUI/Tab.cpp index 8ede9c756a..402a7ebeda 100644 --- a/src/slic3r/GUI/Tab.cpp +++ b/src/slic3r/GUI/Tab.cpp @@ -1973,6 +1973,7 @@ void TabPrint::build() page = add_options_page(L("Strength"), "empty"); optgroup = page->new_optgroup(L("Walls"), L"param_wall"); optgroup->append_single_option_line("wall_loops"); + optgroup->append_single_option_line("alternate_extra_wall"); optgroup->append_single_option_line("detect_thin_wall"); optgroup = page->new_optgroup(L("Top/bottom shells"), L"param_shell"); diff --git a/src/slic3r/Utils/CalibUtils.cpp b/src/slic3r/Utils/CalibUtils.cpp index 95dae8aef9..2e16aba025 100644 --- a/src/slic3r/Utils/CalibUtils.cpp +++ b/src/slic3r/Utils/CalibUtils.cpp @@ -539,7 +539,7 @@ void CalibUtils::calib_flowrate(int pass, const CalibInfo &calib_info, wxString auto modifier = stof(obj_name); _obj->config.set_key_value("print_flow_ratio", new ConfigOptionFloat(1.0f + modifier / 100.f)); } - + print_config.set_key_value("alternate_extra_wall", new ConfigOptionBool(false)); print_config.set_key_value("layer_height", new ConfigOptionFloat(layer_height)); print_config.set_key_value("initial_layer_print_height", new ConfigOptionFloat(first_layer_height)); print_config.set_key_value("reduce_crossing_wall", new ConfigOptionBool(true)); @@ -748,6 +748,7 @@ void CalibUtils::calib_max_vol_speed(const CalibInfo &calib_info, wxString &erro print_config.set_key_value("enable_overhang_speed", new ConfigOptionBool{false}); print_config.set_key_value("timelapse_type", new ConfigOptionEnum(tlTraditional)); print_config.set_key_value("wall_loops", new ConfigOptionInt(1)); + print_config.set_key_value("alternate_extra_wall", new ConfigOptionBool(false)); print_config.set_key_value("top_shell_layers", new ConfigOptionInt(0)); print_config.set_key_value("bottom_shell_layers", new ConfigOptionInt(1)); print_config.set_key_value("sparse_infill_density", new ConfigOptionPercent(0)); @@ -807,6 +808,7 @@ void CalibUtils::calib_VFA(const CalibInfo &calib_info, wxString &error_message) print_config.set_key_value("enable_overhang_speed", new ConfigOptionBool{false}); print_config.set_key_value("timelapse_type", new ConfigOptionEnum(tlTraditional)); print_config.set_key_value("wall_loops", new ConfigOptionInt(1)); + print_config.set_key_value("alternate_extra_wall", new ConfigOptionBool(false)); print_config.set_key_value("top_shell_layers", new ConfigOptionInt(0)); print_config.set_key_value("bottom_shell_layers", new ConfigOptionInt(1)); print_config.set_key_value("sparse_infill_density", new ConfigOptionPercent(0)); @@ -864,6 +866,7 @@ void CalibUtils::calib_retraction(const CalibInfo &calib_info, wxString &error_m filament_config.set_key_value("curr_bed_type", new ConfigOptionEnum(calib_info.bed_type)); obj->config.set_key_value("wall_loops", new ConfigOptionInt(2)); + obj->config.set_key_value("alternate_extra_wall", new ConfigOptionBool(false)); obj->config.set_key_value("top_shell_layers", new ConfigOptionInt(0)); obj->config.set_key_value("bottom_shell_layers", new ConfigOptionInt(3)); obj->config.set_key_value("sparse_infill_density", new ConfigOptionPercent(0));