From 0657ad9e589a554d7df2775f13edbf7507b2f9e9 Mon Sep 17 00:00:00 2001 From: SoftFever Date: Fri, 28 Jul 2023 00:19:08 +0800 Subject: [PATCH] Overhang tweaks: 1. Revert back to classic overhang 2. Support percent for overhang speed --- src/libslic3r/GCode.cpp | 12 ++++++++---- src/libslic3r/PrintConfig.cpp | 34 +++++++++++++++++++--------------- src/libslic3r/PrintConfig.hpp | 8 ++++---- 3 files changed, 31 insertions(+), 23 deletions(-) diff --git a/src/libslic3r/GCode.cpp b/src/libslic3r/GCode.cpp index eea1dd9ccc..e1bcafe03b 100644 --- a/src/libslic3r/GCode.cpp +++ b/src/libslic3r/GCode.cpp @@ -2959,11 +2959,13 @@ GCode::LayerResult GCode::process_layer( Skirt::make_skirt_loops_per_extruder_1st_layer(print, layer_tools, m_skirt_done) : Skirt::make_skirt_loops_per_extruder_other_layers(print, layer_tools, m_skirt_done); - for (const auto& layer_to_print : layers) { - m_extrusion_quality_estimator.prepare_for_new_layer(layer_to_print.original_object, layer_to_print.object_layer); + if (m_config.enable_overhang_speed && !m_config.overhang_speed_classic) { + for (const auto &layer_to_print : layers) { + m_extrusion_quality_estimator.prepare_for_new_layer(layer_to_print.original_object, + layer_to_print.object_layer); + } } - // Group extrusions by an extruder, then by an object, an island and a region. std::map> by_extruder; bool is_anything_overridden = const_cast(layer_tools).wiping_extrusions().is_anything_overridden(); @@ -3275,7 +3277,9 @@ GCode::LayerResult GCode::process_layer( // ref to: https://github.com/SoftFever/OrcaSlicer/pull/205/commits/7f1fe0bd544077626080aa1a9a0576aa735da1a4#r1083470162 if (reset_e && !m_config.use_relative_e_distances) gcode += m_writer.reset_e(true); - m_extrusion_quality_estimator.set_current_object(&instance_to_print.print_object); + + if (m_config.enable_overhang_speed && !m_config.overhang_speed_classic) + m_extrusion_quality_estimator.set_current_object(&instance_to_print.print_object); // When starting a new object, use the external motion planner for the first travel move. const Point &offset = inst.shift; diff --git a/src/libslic3r/PrintConfig.cpp b/src/libslic3r/PrintConfig.cpp index 60cd78e1ce..13f55b83b0 100644 --- a/src/libslic3r/PrintConfig.cpp +++ b/src/libslic3r/PrintConfig.cpp @@ -759,8 +759,8 @@ void PrintConfigDef::init_fff_params() def->label = L("Classic mode"); def->category = L("Speed"); def->tooltip = L("Enable this option to use classic mode"); - def->mode = comAdvanced; - def->set_default_value(new ConfigOptionBool{ false }); + def->mode = comDevelop; + def->set_default_value(new ConfigOptionBool{ true }); def = this->add("enable_overhang_speed", coBool); def->label = L("Slow down for overhang"); @@ -769,47 +769,51 @@ void PrintConfigDef::init_fff_params() def->mode = comAdvanced; def->set_default_value(new ConfigOptionBool{ true }); - def = this->add("overhang_1_4_speed", coFloat); + def = this->add("overhang_1_4_speed", coFloatOrPercent); def->label = "(10%, 25%)"; def->category = L("Speed"); def->full_label = "(10%, 25%)"; //def->tooltip = L("Speed for line of wall which has degree of overhang between 10% and 25% line width. " // "0 means using original wall speed"); - def->sidetext = L("mm/s"); + def->sidetext = L("mm/s or %"); + def->ratio_over = "outer_wall_speed"; def->min = 0; def->mode = comAdvanced; - def->set_default_value(new ConfigOptionFloat(0)); + def->set_default_value(new ConfigOptionFloatOrPercent(0, false)); - def = this->add("overhang_2_4_speed", coFloat); + def = this->add("overhang_2_4_speed", coFloatOrPercent); def->label = "[25%, 50%)"; def->category = L("Speed"); def->full_label = "[25%, 50%)"; //def->tooltip = L("Speed for line of wall which has degree of overhang between 25% and 50% line width. " // "0 means using original wall speed"); - def->sidetext = L("mm/s"); + def->sidetext = L("mm/s or %"); + def->ratio_over = "outer_wall_speed"; def->min = 0; def->mode = comAdvanced; - def->set_default_value(new ConfigOptionFloat(0)); + def->set_default_value(new ConfigOptionFloatOrPercent(0, false)); - def = this->add("overhang_3_4_speed", coFloat); + def = this->add("overhang_3_4_speed", coFloatOrPercent); def->label = "[50%, 75%)"; def->category = L("Speed"); def->full_label = "[50%, 75%)"; //def->tooltip = L("Speed for line of wall which has degree of overhang between 50% and 75% line width. 0 means using original wall speed"); - def->sidetext = L("mm/s"); + def->sidetext = L("mm/s or %"); + def->ratio_over = "outer_wall_speed"; def->min = 0; def->mode = comAdvanced; - def->set_default_value(new ConfigOptionFloat(0)); + def->set_default_value(new ConfigOptionFloatOrPercent(0, false)); - def = this->add("overhang_4_4_speed", coFloat); + def = this->add("overhang_4_4_speed", coFloatOrPercent); def->label = "[75%, 100%)"; def->category = L("Speed"); def->full_label = "[75%, 100%)"; //def->tooltip = L("Speed for line of wall which has degree of overhang between 75% and 100% line width. 0 means using original wall speed"); - def->sidetext = L("mm/s"); + def->sidetext = L("mm/s or %"); + def->ratio_over = "outer_wall_speed"; def->min = 0; def->mode = comAdvanced; - def->set_default_value(new ConfigOptionFloat(0)); + def->set_default_value(new ConfigOptionFloatOrPercent(0, false)); def = this->add("bridge_speed", coFloat); def->label = L("Bridge"); @@ -4476,7 +4480,7 @@ void PrintConfigDef::handle_legacy(t_config_option_key &opt_key, std::string &va "remove_freq_sweep", "remove_bed_leveling", "remove_extrusion_calibration", "support_transition_line_width", "support_transition_speed", "bed_temperature", "bed_temperature_initial_layer", "can_switch_nozzle_type", "can_add_auxiliary_fan", "extra_flush_volume", "spaghetti_detector", "adaptive_layer_height", - "z_hop_type", "z_lift_type" + "z_hop_type", "z_lift_type", "overhang_speed_classic" }; if (ignore.find(opt_key) != ignore.end()) { diff --git a/src/libslic3r/PrintConfig.hpp b/src/libslic3r/PrintConfig.hpp index 6de2b12b6e..0f90ddac51 100644 --- a/src/libslic3r/PrintConfig.hpp +++ b/src/libslic3r/PrintConfig.hpp @@ -766,10 +766,10 @@ PRINT_CONFIG_CLASS_DEFINE( ((ConfigOptionFloat, top_surface_speed)) //BBS ((ConfigOptionBool, enable_overhang_speed)) - ((ConfigOptionFloat, overhang_1_4_speed)) - ((ConfigOptionFloat, overhang_2_4_speed)) - ((ConfigOptionFloat, overhang_3_4_speed)) - ((ConfigOptionFloat, overhang_4_4_speed)) + ((ConfigOptionFloatOrPercent, overhang_1_4_speed)) + ((ConfigOptionFloatOrPercent, overhang_2_4_speed)) + ((ConfigOptionFloatOrPercent, overhang_3_4_speed)) + ((ConfigOptionFloatOrPercent, overhang_4_4_speed)) ((ConfigOptionBool, only_one_wall_top)) //SoftFever