From 307f264cc09475356eaaf64f6e771692400a6355 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luk=C3=A1=C5=A1=20Hejl?= Date: Thu, 18 Feb 2021 14:41:56 +0100 Subject: [PATCH] Fixed unnecessary travels after calling the avoid crossing perimeters when the wipe is enabled. When the avoid crossing perimeters was enabled, and the wipe was enabled, there were unnecessary travels in the opposite direction than the wipe travel. --- src/libslic3r/GCode.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/libslic3r/GCode.cpp b/src/libslic3r/GCode.cpp index 8c682b73add..6944d8ffef1 100644 --- a/src/libslic3r/GCode.cpp +++ b/src/libslic3r/GCode.cpp @@ -2853,10 +2853,10 @@ std::string GCode::travel_to(const Point &point, ExtrusionRole role, std::string Point last_post_before_retract = this->last_pos(); gcode += this->retract(); // When "Wipe while retracting" is enabled, then extruder moves to another position, and travel from this position can cross perimeters. - // Because of it, it is necessary to call avoid crossing perimeters for the path between previous last_post and last_post after calling retraction() + // Because of it, it is necessary to call avoid crossing perimeters again with new starting point after calling retraction() + // FIXME Lukas H.: Try to predict if this second calling of avoid crossing perimeters will be needed or not. It could save computations. if (last_post_before_retract != this->last_pos() && m_config.avoid_crossing_perimeters) { - Polyline retract_travel = m_avoid_crossing_perimeters.travel_to(*this, last_post_before_retract); - append(retract_travel.points, travel.points); + Polyline retract_travel = m_avoid_crossing_perimeters.travel_to(*this, point); travel = std::move(retract_travel); } } else