From 1c2e3aed746c7279633e44ee4e1264ebf9ba0e7d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20=C5=A0ach?= Date: Wed, 6 Mar 2024 15:42:31 +0100 Subject: [PATCH] Fix reset on layer change by keeping it all the time --- src/libslic3r/GCode.cpp | 10 +++++++--- src/libslic3r/GCode.hpp | 2 +- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/libslic3r/GCode.cpp b/src/libslic3r/GCode.cpp index 8e0d403742..bbf2870968 100644 --- a/src/libslic3r/GCode.cpp +++ b/src/libslic3r/GCode.cpp @@ -2816,8 +2816,9 @@ std::string GCodeGenerator::change_layer( std::optional{to_3d(this->point_to_gcode(*this->last_position), previous_layer_z)} : std::nullopt; gcode += GCodeProcessor::reserved_tag(GCodeProcessor::ETags::Layer_Change_Retraction_Start); - gcode += this->retract_and_wipe(); + gcode += this->retract_and_wipe(false, false); gcode += GCodeProcessor::reserved_tag(GCodeProcessor::ETags::Layer_Change_Retraction_End); + gcode += m_writer.reset_e(); } Vec3d new_position = this->writer().get_position(); @@ -3589,7 +3590,7 @@ std::string GCodeGenerator::travel_to( return wipe_retract_gcode + generate_travel_gcode(travel, comment, insert_gcode); } -std::string GCodeGenerator::retract_and_wipe(bool toolchange) +std::string GCodeGenerator::retract_and_wipe(bool toolchange, bool reset_e) { std::string gcode; @@ -3607,7 +3608,10 @@ std::string GCodeGenerator::retract_and_wipe(bool toolchange) methods even if we performed wipe, since this will ensure the entire retraction length is honored in case wipe path was too short. */ gcode += toolchange ? m_writer.retract_for_toolchange() : m_writer.retract(); - gcode += m_writer.reset_e(); + + if (reset_e) { + gcode += m_writer.reset_e(); + } return gcode; } diff --git a/src/libslic3r/GCode.hpp b/src/libslic3r/GCode.hpp index 165b974873..5e6df97590 100644 --- a/src/libslic3r/GCode.hpp +++ b/src/libslic3r/GCode.hpp @@ -340,7 +340,7 @@ private: bool needs_retraction(const Polyline &travel, ExtrusionRole role = ExtrusionRole::None); - std::string retract_and_wipe(bool toolchange = false); + std::string retract_and_wipe(bool toolchange = false, bool reset_e = true); std::string unretract() { return m_writer.unretract(); } std::string set_extruder(unsigned int extruder_id, double print_z); bool line_distancer_is_required(const std::vector& extruder_ids);