diff --git a/src/libslic3r/GCode.cpp b/src/libslic3r/GCode.cpp index b322be3b0..54254213c 100644 --- a/src/libslic3r/GCode.cpp +++ b/src/libslic3r/GCode.cpp @@ -2874,21 +2874,20 @@ std::string GCode::_extrude(const ExtrusionPath &path, const std::string_view de !this->on_first_layer() && path.role().is_perimeter()) { std::vector> overhangs_with_speeds = {{100, ConfigOptionFloatOrPercent{speed, false}}}; if (this->m_config.enable_dynamic_overhang_speeds) { - std::vector> overhangs_with_speeds = {{0, m_config.overhang_speed_0}, - {25, m_config.overhang_speed_1}, - {50, m_config.overhang_speed_2}, - {75, m_config.overhang_speed_3}, - {100, - ConfigOptionFloatOrPercent{speed, false}}}; + overhangs_with_speeds = {{0, m_config.overhang_speed_0}, + {25, m_config.overhang_speed_1}, + {50, m_config.overhang_speed_2}, + {75, m_config.overhang_speed_3}, + {100, ConfigOptionFloatOrPercent{speed, false}}}; } std::vector> overhang_w_fan_speeds = {{100, ConfigOptionInts{0}}}; if (this->m_config.enable_dynamic_fan_speeds.get_at(m_writer.extruder()->id())) { - std::vector> overhang_w_fan_speeds = {{0, m_config.overhang_fan_speed_0}, - {25, m_config.overhang_fan_speed_1}, - {50, m_config.overhang_fan_speed_2}, - {75, m_config.overhang_fan_speed_3}, - {100, ConfigOptionInts{0}}}; + overhang_w_fan_speeds = {{0, m_config.overhang_fan_speed_0}, + {25, m_config.overhang_fan_speed_1}, + {50, m_config.overhang_fan_speed_2}, + {75, m_config.overhang_fan_speed_3}, + {100, ConfigOptionInts{0}}}; } double external_perim_reference_speed = std::min(m_config.get_abs_value("external_perimeter_speed"), diff --git a/src/libslic3r/GCode/ExtrusionProcessor.hpp b/src/libslic3r/GCode/ExtrusionProcessor.hpp index 3273e31ff..1b1748827 100644 --- a/src/libslic3r/GCode/ExtrusionProcessor.hpp +++ b/src/libslic3r/GCode/ExtrusionProcessor.hpp @@ -17,6 +17,7 @@ #include #include #include +#include #include #include #include @@ -293,13 +294,13 @@ public: auto interpolate_speed = [](const std::map &values, float distance) { auto upper_dist = values.lower_bound(distance); if (upper_dist == values.end()) { - return values.rend()->second; + return values.rbegin()->second; } if (upper_dist == values.begin()) { return upper_dist->second; } - auto lower_dist = --upper_dist; + auto lower_dist = std::prev(upper_dist); float t = (distance - lower_dist->first) / (upper_dist->first - lower_dist->first); return (1.0f - t) * lower_dist->second + t * upper_dist->second; }; diff --git a/src/slic3r/GUI/ConfigManipulation.cpp b/src/slic3r/GUI/ConfigManipulation.cpp index e6316e913..9a0cf3881 100644 --- a/src/slic3r/GUI/ConfigManipulation.cpp +++ b/src/slic3r/GUI/ConfigManipulation.cpp @@ -224,7 +224,7 @@ void ConfigManipulation::toggle_print_fff_options(DynamicPrintConfig* config) "perimeter_speed", "small_perimeter_speed", "external_perimeter_speed", "enable_dynamic_overhang_speeds"}) toggle_field(el, have_perimeters); - for (size_t i = 0; i < 5; i++) { + for (size_t i = 0; i < 4; i++) { toggle_field("overhang_speed_" + std::to_string(i), config->opt_bool("enable_dynamic_overhang_speeds")); } diff --git a/src/slic3r/GUI/Search.cpp b/src/slic3r/GUI/Search.cpp index 02e322bca..d63a46d16 100644 --- a/src/slic3r/GUI/Search.cpp +++ b/src/slic3r/GUI/Search.cpp @@ -98,6 +98,10 @@ void OptionsSearcher::append_options(DynamicPrintConfig* config, Preset::Type ty suffix_local = " " + _(suffix); suffix = " " + suffix; } + else if (gc.group == "Dynamic overhang speed" && id >= 0) { + suffix = " " + std::to_string(id+1); + suffix_local = suffix; + } if (!label.IsEmpty()) options.emplace_back(Option{ boost::nowide::widen(key), type,