From 5ac0dd19d04d90fc25e3d50d51f15febe04f0ca5 Mon Sep 17 00:00:00 2001 From: harrierpigeon Date: Fri, 2 Oct 2026 12:46:44 -0500 Subject: [PATCH] Belt brim: no near-duplicate lines in a narrow lattice band A band barely wider than one line got a second line almost on top of the first, and lattice rows could repeat within half a pitch. --- src/libslic3r/BeltBrim.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/libslic3r/BeltBrim.cpp b/src/libslic3r/BeltBrim.cpp index 92877ef0aa..45ef5d14c9 100644 --- a/src/libslic3r/BeltBrim.cpp +++ b/src/libslic3r/BeltBrim.cpp @@ -253,7 +253,10 @@ static void belt_brim_band_paths(const BeltBrimContext &bc, std::vector us; double uniform_clearance = 0.; // 0 => derive per line from its own position double line_pitch = bc.in_plane_pitch; - if (band_in_plane <= bc.in_plane_pitch + EPSILON) { + // One line also serves a band up to half a bead wider than the nominal pitch (a 0.3 mm + // first layer at 45 degrees): its flow is matched to the band, so the bead is that much + // wider. Two lattice lines in such a band would land almost on top of each other. + if (band_in_plane <= 1.5 * bc.in_plane_pitch + EPSILON) { // Steep belt, which is the normal case: the band is narrower than one bead, so // exactly one line fits. Place it at a FIXED fraction of the band rather than // on a nominal-spacing lattice. On a lattice each line lands at an arbitrary @@ -307,8 +310,9 @@ static void belt_brim_band_paths(const BeltBrimContext &bc, } clearance = std::min(clearance, height); } - // Two lattice lines moved to the same place are one line. - if (u == u_prev) + // A line moved uphill can land on, or almost on, its neighbour; two beads closer + // than half a pitch would be laid into the same cell. + if (u_prev != std::numeric_limits::min() && std::abs(u - u_prev) < bc.pitch_u / 2) continue; u_prev = u;