From 8f192b67b56f97f3b730355d1f7556f6b3097e97 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20=C5=A0ach?= Date: Tue, 13 Feb 2024 17:10:02 +0100 Subject: [PATCH] Fix retract only if travel is long enough and add wipe --- 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 f448919df9..81730128d5 100644 --- a/src/libslic3r/GCode.cpp +++ b/src/libslic3r/GCode.cpp @@ -2143,8 +2143,8 @@ std::string GCodeGenerator::get_layer_change_gcode(const Vec3d& from, const Vec3 )}; std::string travel_gcode; - if (this->m_config.retract_before_travel.get_at(extruder_id) > xy_path.length()) { - travel_gcode += this->writer().retract(); + if (this->m_config.retract_before_travel.get_at(extruder_id) < (to - from).norm()) { + travel_gcode += this->retract_and_wipe(); } Vec3d previous_point{this->point_to_gcode(travel.front())}; for (const Vec3crd& point : tcb::span{travel}.subspan(1)) { @@ -3036,7 +3036,7 @@ std::string GCodeGenerator::travel_to_first_position(const Vec3crd& point) { if (!this->last_position || EXTRUDER_CONFIG(retract_before_travel) < (this->point_to_gcode(*this->last_position) - gcode_point.head<2>()).norm()) { - gcode += this->writer().retract(); + gcode += this->retract_and_wipe(); } } this->last_position = point.head<2>();