From 1e0fb1a0ae81100d5afd2afc5b3cfdf0ba6e2f69 Mon Sep 17 00:00:00 2001 From: SoftFever Date: Mon, 3 Aug 2026 15:22:15 +0800 Subject: [PATCH] Fix the gap-route early-out to test the tower body, not the brim envelope An approach starting over the first-layer brim ring skipped routing and travelled straight across the printed wall; only starts over the tower body itself may go direct. --- src/libslic3r/GCode.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/libslic3r/GCode.cpp b/src/libslic3r/GCode.cpp index 97100d274c..205c758640 100644 --- a/src/libslic3r/GCode.cpp +++ b/src/libslic3r/GCode.cpp @@ -956,7 +956,15 @@ static std::vector get_path_of_change_filament(const Print& print) for (auto& p : avoid_points.points) p = wipe_tower_point_to_object_point(gcodegen, transform_wt2_pt(unscale(p).cast()) + plate_origin_2d); BoundingBox avoid_bbx(avoid_points.points); - if (avoid_bbx.contains(route_start)) + // The avoid envelope covers the first-layer brim (and rib flare), which a travel + // may cross freely: early-out only when the approach already starts over the + // tower body itself, so a start between the wall and the brim edge still gets + // routed in through the wall opening. + const float body_width = gcodegen.m_config.wipe_tower_wall_type.value == WipeTowerWallType::wtwRib ? m_wipe_tower_depth : m_right; + Polygon body_points = scaled(BoundingBoxf(Vec2d(0., 0.), Vec2d(body_width, m_wipe_tower_depth))).polygon(); + for (auto& p : body_points.points) + p = wipe_tower_point_to_object_point(gcodegen, transform_wt2_pt(unscale(p).cast()) + plate_origin_2d); + if (BoundingBox(body_points.points).contains(route_start)) return {}; const Polygons bed_polygons = printer_travel_polygons(gcodegen); // The router inflates the avoid box by wipe_tower_routing_clearance and refuses