From b965d420cf1ccbf3feed5453fb55c1b00ee14b20 Mon Sep 17 00:00:00 2001 From: Arthur Date: Thu, 24 Apr 2025 17:27:51 +0800 Subject: [PATCH] ENH: do not reverse wipe for supports This might help improve the quality and strength of supports. jira: STUDIO-11985 Change-Id: I51644c84b9ede018a08a0f2b8fdca5d271d69991 (cherry picked from commit ba5dbc544b65276d772834305fcca6b5f7536d6e) --- src/libslic3r/GCode.cpp | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/libslic3r/GCode.cpp b/src/libslic3r/GCode.cpp index f65b8ab93d..34806b89a5 100644 --- a/src/libslic3r/GCode.cpp +++ b/src/libslic3r/GCode.cpp @@ -5480,8 +5480,20 @@ std::string GCode::extrude_path(ExtrusionPath path, std::string description, dou // description += ExtrusionEntity::role_to_string(path.role()); std::string gcode = this->_extrude(path, description, speed); if (m_wipe.enable && FILAMENT_CONFIG(wipe)) { - m_wipe.path = std::move(path.polyline); - m_wipe.path.reverse(); + m_wipe.path = path.polyline; + if (is_tree(this->config().support_type) && (path.role() == erSupportMaterial || path.role() == erSupportMaterialInterface || path.role() == erSupportTransition)) { + if ((m_wipe.path.first_point() - m_wipe.path.last_point()).cast().norm() > scale_(0.2)) { + double min_dist = scale_(0.2); + int i = 0; + for (; i < path.polyline.points.size(); i++) { + double dist = (path.polyline.points[i] - path.last_point()).cast().norm(); + if (dist < min_dist) min_dist = dist; + if (min_dist < scale_(0.2) && dist > min_dist) break; + } + m_wipe.path = Polyline(Points(path.polyline.points.begin() + i - 1, path.polyline.points.end())); + } + } else + m_wipe.path.reverse(); } return gcode;