FIX: add skip label before tool change

Jira: 5074
github: 2776

Signed-off-by: qing.zhang <qing.zhang@bambulab.com>
Change-Id: Icaafd3b45da1e78c1a82e7d17d7505d9439b9100
This commit is contained in:
qing.zhang 2023-10-24 12:29:16 +08:00 committed by Lane.Wei
parent 90dd8bbe86
commit 525c0464a3
2 changed files with 7 additions and 3 deletions

View File

@ -2130,7 +2130,7 @@ void GCode::_do_export(Print& print, GCodeOutputStream &file, ThumbnailsGenerato
if (m_writer.need_toolchange(initial_extruder_id)) { if (m_writer.need_toolchange(initial_extruder_id)) {
const PrintObjectConfig &object_config = object.config(); const PrintObjectConfig &object_config = object.config();
coordf_t initial_layer_print_height = print.config().initial_layer_print_height.value; 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; prime_extruder = true;
} else { } else {
file.write(this->retract()); file.write(this->retract());
@ -4782,7 +4782,7 @@ std::string GCode::retract(bool toolchange, bool is_last_retraction, LiftType li
return gcode; 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)) if (!m_writer.need_toolchange(extruder_id))
return ""; 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. // Always reset the extrusion path, even if the tool change retract is set to zero.
m_wipe.reset_path(); 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) { if (m_writer.extruder() != nullptr) {
// Process the custom filament_end_gcode. set_extruder() is only called if there is no wipe tower // Process the custom filament_end_gcode. set_extruder() is only called if there is no wipe tower
// so it should not be injected twice. // so it should not be injected twice.

View File

@ -414,7 +414,7 @@ private:
// BBS // BBS
LiftType to_lift_type(ZHopType z_hop_types); 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<ObjectID> m_objsWithBrim; // indicates the objs with brim std::set<ObjectID> m_objsWithBrim; // indicates the objs with brim
std::set<ObjectID> m_objSupportsWithBrim; // indicates the objs' supports with brim std::set<ObjectID> m_objSupportsWithBrim; // indicates the objs' supports with brim
// Cache for custom seam enforcers/blockers for each layer. // Cache for custom seam enforcers/blockers for each layer.