diff --git a/src/libslic3r/GCode.cpp b/src/libslic3r/GCode.cpp index 4312271a03..da95469a18 100644 --- a/src/libslic3r/GCode.cpp +++ b/src/libslic3r/GCode.cpp @@ -9620,6 +9620,11 @@ std::string GCode::_extrude(const ExtrusionPath &path, const std::string &path_d fan_overlap_threshold = overhang_fan_overlap_threshold(FILAMENT_CONFIG(overhang_fan_threshold)); if (NOZZLE_CONFIG(slowdown_for_curled_perimeters)){ + const FloatOrPercent fully_unsupported_speed = path.role() == erBridgeInfill ? + FloatOrPercent{NOZZLE_CONFIG(bridge_speed) * 100 / ref_speed, true} : + (NOZZLE_CONFIG(overhang_4_4_speed).get_abs_value(ref_speed) < 0.5 ? + FloatOrPercent{100, true} : + FloatOrPercent{NOZZLE_CONFIG(overhang_4_4_speed).get_abs_value(ref_speed) * 100 / ref_speed, true}); ConfigOptionFloatsOrPercents dynamic_overhang_speeds( {FloatOrPercent{100, true}, (NOZZLE_CONFIG(overhang_1_4_speed).get_abs_value(ref_speed) < 0.5) ? @@ -9634,9 +9639,7 @@ std::string GCode::_extrude(const ExtrusionPath &path, const std::string &path_d (NOZZLE_CONFIG(overhang_4_4_speed).get_abs_value(ref_speed) < 0.5) ? FloatOrPercent{100, true} : FloatOrPercent{NOZZLE_CONFIG(overhang_4_4_speed).get_abs_value(ref_speed) * 100 / ref_speed, true}, - (NOZZLE_CONFIG(overhang_4_4_speed).get_abs_value(ref_speed) < 0.5) ? - FloatOrPercent{100, true} : - FloatOrPercent{NOZZLE_CONFIG(overhang_4_4_speed).get_abs_value(ref_speed) * 100 / ref_speed, true}}); + fully_unsupported_speed}); new_points = m_extrusion_quality_estimator.estimate_extrusion_quality(path, overhang_overlap_levels, dynamic_overhang_speeds, ref_speed, speed, NOZZLE_CONFIG(slowdown_for_curled_perimeters), diff --git a/tests/fff_print/test_extrusion_processor.cpp b/tests/fff_print/test_extrusion_processor.cpp index b1e192cde8..452f5fe430 100644 --- a/tests/fff_print/test_extrusion_processor.cpp +++ b/tests/fff_print/test_extrusion_processor.cpp @@ -19,6 +19,7 @@ #include #include #include +#include #include "libslic3r/Line.hpp" #include "libslic3r/Point.hpp" #include @@ -128,6 +129,44 @@ template std::vector outer_wall_feed_rates(const std: return feed_rates; } +std::vector bridge_center_feed_rates(const std::string& gcode) +{ + struct BridgeMove { double start_x, end_x, speed; }; + std::vector bridge_moves; + bool bridge = false; + GCodeReader parser; + parser.parse_buffer(gcode, [&bridge_moves, &bridge](GCodeReader& self, const GCodeReader::GCodeLine& line) { + const std::string_view comment = line.comment(); + if (comment.find("FEATURE:") != std::string_view::npos || comment.find("TYPE:") != std::string_view::npos) + bridge = comment.find("Bridge") != std::string_view::npos && comment.find("Internal Bridge") == std::string_view::npos; + + const double start_x = self.x(); + const double end_x = line.new_X(self); + if (bridge && line.extruding(self) && std::abs(line.new_Z(self) - 5.2) < 0.01 && + std::abs(end_x - start_x) > 1.0) + bridge_moves.push_back({start_x, end_x, line.new_F(self) / MM_PER_MIN}); + }); + + if (bridge_moves.empty()) + return {}; + + double min_x = std::numeric_limits::max(); + double max_x = std::numeric_limits::lowest(); + for (const BridgeMove& move : bridge_moves) { + min_x = std::min({min_x, move.start_x, move.end_x}); + max_x = std::max({max_x, move.start_x, move.end_x}); + } + + const double center_margin = 0.25 * (max_x - min_x); + std::vector feed_rates; + for (const BridgeMove& move : bridge_moves) { + const double mid_x = 0.5 * (move.start_x + move.end_x); + if (mid_x > min_x + center_margin && mid_x < max_x - center_margin) + feed_rates.push_back(move.speed); + } + return feed_rates; +} + // The caged 45 degree overhang: outer walls crossing the sloped face for most of its width, on the // layers where the face genuinely overhangs. // Both ends are tested against the slope plane rather than requiring a constant Y. Arachne's @@ -729,6 +768,31 @@ TEST_CASE("Curled walls are estimated only when overhang speed and the slowdown CHECK(has_curled_lines(*cage.object) == estimated); } +TEST_CASE("Bridge infill keeps bridge speed with curled perimeter slowdown", "[ExtrusionProcessor][Regression]") +{ + DynamicPrintConfig config = DynamicPrintConfig::full_print_config(); + config.set_deserialize_strict({ + {"initial_layer_print_height", "0.2"}, + {"layer_height", "0.2"}, + {"enable_overhang_speed", "1"}, + {"slowdown_for_curled_perimeters", "1"}, + {"overhang_1_4_speed", "0"}, + {"overhang_2_4_speed", "50"}, + {"overhang_3_4_speed", "30"}, + {"overhang_4_4_speed", "10"}, + {"bridge_speed", "45"}, + {"filament_max_volumetric_speed", "1000"}, + {"slow_down_for_layer_cooling", "0"}, + {"slow_down_layers", "0"}, + }); + + const std::vector feed_rates = bridge_center_feed_rates(slice({TestMesh::bridge}, config)); + + REQUIRE_FALSE(feed_rates.empty()); + for (const double feed_rate : feed_rates) + CHECK_THAT(feed_rate, Catch::Matchers::WithinAbs(45.0, 0.5)); +} + TEST_CASE("Curled walls are estimated when overhang speed and the slowdown for curled perimeters are on in different objects", "[ExtrusionProcessor]") { const std::vector> overrides{