From 762c935fb0c4714990b15b8329b607f1ebc0257e Mon Sep 17 00:00:00 2001 From: SoftFever Date: Fri, 8 May 2026 00:31:35 +0800 Subject: [PATCH] Fixed regression bug that MANUAL_TOOL_CHANGE not working for BBL printers (#13516) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix: manual filament change not emitting MANUAL_TOOL_CHANGE for BBL printers BBL-specific M1020 S handling in toolchange() bypassed toolchange_prefix(),so manual_filament_change had no effect — M1020 was always emitted regardless of the setting. Move the BBL logic into toolchange_prefix() so all callers respect the option consistently. Fixes #11795 * add comment --- src/libslic3r/GCodeWriter.cpp | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/src/libslic3r/GCodeWriter.cpp b/src/libslic3r/GCodeWriter.cpp index 270de27a2c..a5e1c6abf1 100644 --- a/src/libslic3r/GCodeWriter.cpp +++ b/src/libslic3r/GCodeWriter.cpp @@ -506,9 +506,20 @@ std::string GCodeWriter::update_progress(unsigned int num, unsigned int tot, boo std::string GCodeWriter::toolchange_prefix() const { - return config.manual_filament_change ? ";" + GCodeProcessor::reserved_tag(GCodeProcessor::ETags::Manual_Tool_Change) + "T": - FLAVOR_IS(gcfMakerWare) ? "M135 T" : - FLAVOR_IS(gcfSailfish) ? "M108 T" : "T"; + std::string gcode = "T"; + if (config.manual_filament_change) + gcode = ";" + GCodeProcessor::reserved_tag(GCodeProcessor::ETags::Manual_Tool_Change) + "T"; + else { + if (m_is_bbl_printers) + gcode = "M1020 S"; + else { + if (FLAVOR_IS(gcfMakerWare)) + gcode = "M135 T"; + else if (FLAVOR_IS(gcfSailfish)) + gcode = "M108 T"; + } + } + return gcode; } std::string GCodeWriter::toolchange(unsigned int filament_id) @@ -523,12 +534,8 @@ std::string GCodeWriter::toolchange(unsigned int filament_id) // if we are running a single-extruder setup, just set the extruder and return nothing std::ostringstream gcode; if (this->multiple_extruders || (this->config.filament_diameter.values.size() > 1 && !is_bbl_printers())) { - // BBS - if (this->m_is_bbl_printers) - gcode << "M1020 S" << filament_id; - else - gcode << this->toolchange_prefix() << filament_id; - //BBS + // Orca: call toolchange_prefix() to get the correct command prefix based on the configuration and flavor. + gcode << this->toolchange_prefix() << filament_id; if (GCodeWriter::full_gcode_comment) gcode << " ; change extruder"; gcode << "\n";