diff --git a/src/libslic3r/GCode/ExtrusionProcessor.hpp b/src/libslic3r/GCode/ExtrusionProcessor.hpp index 2402a086e..b392018cf 100644 --- a/src/libslic3r/GCode/ExtrusionProcessor.hpp +++ b/src/libslic3r/GCode/ExtrusionProcessor.hpp @@ -269,7 +269,20 @@ public: speed_sections.push_back({distance, speed}); } std::sort(speed_sections.begin(), speed_sections.end(), - [](const std::pair &a, const std::pair &b) { return a.first < b.first; }); + [](const std::pair &a, const std::pair &b) { + if (a.first == b.first) { + return a.second > b.second; + } + return a.first < b.first; }); + + std::pair last_section{INFINITY, 0}; + for (auto §ion : speed_sections) { + if (section.first == last_section.first) { + section.second = last_section.second; + } else { + last_section = section; + } + } std::vector extended_points = estimate_points_properties(path.polyline.points, prev_layer_boundaries[current_object], path.width);