diff --git a/src/libslic3r/GCode.cpp b/src/libslic3r/GCode.cpp index d1119e6f2..ee8759102 100644 --- a/src/libslic3r/GCode.cpp +++ b/src/libslic3r/GCode.cpp @@ -4944,8 +4944,20 @@ std::string GCode::extrude_path(ExtrusionPath path, std::string description, dou bool flag = path.get_customize_flag() == CustomizeFlag::cfFloatingVerticalShell; std::string gcode = this->_extrude(path, description, speed,flag); 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(); } //BBS: don't reset acceleration when printing first layer. During first layer, acceleration is always same value. if (!this->on_first_layer()) {