From 86dd466359075acbca74ba273f8c547c75a63f79 Mon Sep 17 00:00:00 2001 From: SoftFever Date: Thu, 7 May 2026 20:11:15 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20manual=20filament=20change=20not=20emitt?= =?UTF-8?q?ing=20MANUAL=5FTOOL=5FCHANGE=20for=20BBL=20printers=20BBL-speci?= =?UTF-8?q?fic=20M1020=20S=20handling=20in=20toolchange()=20bypassed=20too?= =?UTF-8?q?lchange=5Fprefix(),so=20manual=5Ffilament=5Fchange=20had=20no?= =?UTF-8?q?=20effect=20=E2=80=94=20M1020=20was=20always=20emitted=20regard?= =?UTF-8?q?less=20of=20the=20setting.=20Move=20the=20BBL=20logic=20into=20?= =?UTF-8?q?toolchange=5Fprefix()=20so=20all=20callers=20respect=20the=20op?= =?UTF-8?q?tion=20consistently.=20Fixes=20#11795?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/libslic3r/GCodeWriter.cpp | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/src/libslic3r/GCodeWriter.cpp b/src/libslic3r/GCodeWriter.cpp index 270de27a2c..6ca28f2fc1 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,7 @@ 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 + gcode << this->toolchange_prefix() << filament_id; if (GCodeWriter::full_gcode_comment) gcode << " ; change extruder"; gcode << "\n";