From 525c0464a3f2cbfb15e6460580f60b29c5a27c48 Mon Sep 17 00:00:00 2001 From: "qing.zhang" Date: Tue, 24 Oct 2023 12:29:16 +0800 Subject: [PATCH] FIX: add skip label before tool change Jira: 5074 github: 2776 Signed-off-by: qing.zhang Change-Id: Icaafd3b45da1e78c1a82e7d17d7505d9439b9100 --- src/libslic3r/GCode.cpp | 8 ++++++-- src/libslic3r/GCode.hpp | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/libslic3r/GCode.cpp b/src/libslic3r/GCode.cpp index 4ca3f8ff5..e506d8ac6 100644 --- a/src/libslic3r/GCode.cpp +++ b/src/libslic3r/GCode.cpp @@ -2130,7 +2130,7 @@ void GCode::_do_export(Print& print, GCodeOutputStream &file, ThumbnailsGenerato if (m_writer.need_toolchange(initial_extruder_id)) { const PrintObjectConfig &object_config = object.config(); coordf_t initial_layer_print_height = print.config().initial_layer_print_height.value; - file.write(this->set_extruder(initial_extruder_id, initial_layer_print_height)); + file.write(this->set_extruder(initial_extruder_id, initial_layer_print_height, true)); prime_extruder = true; } else { file.write(this->retract()); @@ -4782,7 +4782,7 @@ std::string GCode::retract(bool toolchange, bool is_last_retraction, LiftType li return gcode; } -std::string GCode::set_extruder(unsigned int extruder_id, double print_z) +std::string GCode::set_extruder(unsigned int extruder_id, double print_z, bool by_object) { if (!m_writer.need_toolchange(extruder_id)) return ""; @@ -4816,6 +4816,10 @@ std::string GCode::set_extruder(unsigned int extruder_id, double print_z) // Always reset the extrusion path, even if the tool change retract is set to zero. m_wipe.reset_path(); + // BBS: insert skip object label before change filament while by object + if (by_object) + m_writer.add_object_change_labels(gcode); + if (m_writer.extruder() != nullptr) { // Process the custom filament_end_gcode. set_extruder() is only called if there is no wipe tower // so it should not be injected twice. diff --git a/src/libslic3r/GCode.hpp b/src/libslic3r/GCode.hpp index fb78689ff..36ce758fd 100644 --- a/src/libslic3r/GCode.hpp +++ b/src/libslic3r/GCode.hpp @@ -414,7 +414,7 @@ private: // BBS LiftType to_lift_type(ZHopType z_hop_types); - std::string set_extruder(unsigned int extruder_id, double print_z); + std::string set_extruder(unsigned int extruder_id, double print_z, bool by_object=false); std::set m_objsWithBrim; // indicates the objs with brim std::set m_objSupportsWithBrim; // indicates the objs' supports with brim // Cache for custom seam enforcers/blockers for each layer.