Print bridges at bridge speed when slowing down for curled perimeters (#17144)

With slowdown_for_curled_perimeters on, the fully unsupported entry of the overhang speed table was overhang_4_4_speed for every role. Since #14735 samples the inside of a line, the unsupported middle of an anchored bridge strand got that speed. Bridge infill now uses bridge_speed there, like the branch without curled slowdown. Other roles keep their old speeds.

(cherry picked from commit 533d4c3e9e)
This commit is contained in:
Rodrigo Faselli authored and SoftFever committed 2026-11-07 02:14:51 +08:00
1 parent bf21673469
commit 44f792dbc3
2 files changed
+70 -3

No files matched your search

@@ -19,6 +19,7 @@
#include <cstdint>
#include <cstring>
#include <functional>
#include <limits>
#include "libslic3r/Line.hpp"
#include "libslic3r/Point.hpp"
#include <cstddef>
@@ -128,6 +129,44 @@ template<typename KeepLine> std::vector<double> outer_wall_feed_rates(const std:
return feed_rates;
}
std::vector<double> bridge_center_feed_rates(const std::string& gcode)
{
struct BridgeMove { double start_x, end_x, speed; };
std::vector<BridgeMove> 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<double>::max();
double max_x = std::numeric_limits<double>::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<double> 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<double> 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<std::vector<ConfigBase::SetDeserializeItem>> overrides{