From fd3ab55197eea98f71ea2e2e22ac76fbb5ca5f8a Mon Sep 17 00:00:00 2001 From: Lukas Matena Date: Thu, 26 Jan 2023 20:44:38 +0100 Subject: [PATCH] MMU: Fixed missing travel to the wipe tower in one more case --- src/libslic3r/GCode.cpp | 6 +++--- src/libslic3r/GCode/WipeTower.cpp | 4 +++- src/libslic3r/GCode/WipeTower.hpp | 2 ++ 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/libslic3r/GCode.cpp b/src/libslic3r/GCode.cpp index 07031d7e46..a793a35678 100644 --- a/src/libslic3r/GCode.cpp +++ b/src/libslic3r/GCode.cpp @@ -236,10 +236,11 @@ namespace Slic3r { const bool needs_toolchange = gcodegen.writer().need_toolchange(new_extruder_id); const bool will_go_down = ! is_approx(z, current_z); - - if (! needs_toolchange || (gcodegen.config().single_extruder_multi_material && ! tcr.priming)) { + if (tcr.force_travel || ! needs_toolchange || (gcodegen.config().single_extruder_multi_material && ! tcr.priming)) { // Move over the wipe tower. If this is not single-extruder MM, the first wipe tower move following the // toolchange will travel there anyway (if there is a toolchange). + // FIXME: It would be better if the wipe tower set the force_travel flag for all toolchanges, + // then we could simplify the condition and make it more readable. gcode += gcodegen.retract(); gcodegen.m_avoid_crossing_perimeters.use_external_mp_once(); gcode += gcodegen.travel_to( @@ -265,7 +266,6 @@ namespace Slic3r { deretraction_str = gcodegen.unretract(); } - diff --git a/src/libslic3r/GCode/WipeTower.cpp b/src/libslic3r/GCode/WipeTower.cpp index 04fab3fcdb..6397399678 100644 --- a/src/libslic3r/GCode/WipeTower.cpp +++ b/src/libslic3r/GCode/WipeTower.cpp @@ -1387,8 +1387,10 @@ void WipeTower::generate(std::vector> & layer_result.emplace_back(std::move(finish_layer_tcr)); } else { - if (idx == -1) + if (idx == -1) { layer_result[0] = merge_tcr(finish_layer_tcr, layer_result[0]); + layer_result[0].force_travel = true; + } else layer_result[idx] = merge_tcr(layer_result[idx], finish_layer_tcr); } diff --git a/src/libslic3r/GCode/WipeTower.hpp b/src/libslic3r/GCode/WipeTower.hpp index ab3af507d3..7f4a6bf9aa 100644 --- a/src/libslic3r/GCode/WipeTower.hpp +++ b/src/libslic3r/GCode/WipeTower.hpp @@ -82,6 +82,8 @@ public: } return e_length; } + + bool force_travel = false; }; struct box_coordinates