diff options
author | Lukas Matena <lukasmatena@seznam.cz> | 2019-07-16 14:06:58 +0300 |
---|---|---|
committer | Lukas Matena <lukasmatena@seznam.cz> | 2019-07-16 14:10:09 +0300 |
commit | 52ab8a5f19892af2874a670f19e93b8bcd94a00e (patch) | |
tree | f3ee9e4900009553e36eb6221ea1978984d898da /src | |
parent | 4865240a9cd79069cc9e72bfa2e44451c55ef5c6 (diff) |
Wipe tower fix (do not skip the first toolchange when printing without the wipe tower)
Also, test multi.t updated so it matches new logic of inserting custom gcodes
Diffstat (limited to 'src')
-rw-r--r-- | src/libslic3r/GCode.cpp | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/src/libslic3r/GCode.cpp b/src/libslic3r/GCode.cpp index cd0f8142d..37a14d42c 100644 --- a/src/libslic3r/GCode.cpp +++ b/src/libslic3r/GCode.cpp @@ -2811,17 +2811,16 @@ std::string GCode::set_extruder(unsigned int extruder_id, double print_z) gcode += m_ooze_prevention.pre_toolchange(*this); const std::string& toolchange_gcode = m_config.toolchange_gcode.value; - if (m_writer.extruder() != nullptr) { - // Process the custom toolchange_gcode. If it is empty, insert just a Tn command. - if (!toolchange_gcode.empty()) { - DynamicConfig config; - config.set_key_value("previous_extruder", new ConfigOptionInt((int)m_writer.extruder()->id())); - config.set_key_value("next_extruder", new ConfigOptionInt((int)extruder_id)); - config.set_key_value("layer_num", new ConfigOptionInt(m_layer_index)); - config.set_key_value("layer_z", new ConfigOptionFloat(print_z)); - gcode += placeholder_parser_process("toolchange_gcode", toolchange_gcode, extruder_id, &config); - check_add_eol(gcode); - } + + // Process the custom toolchange_gcode. If it is empty, insert just a Tn command. + if (!toolchange_gcode.empty()) { + DynamicConfig config; + config.set_key_value("previous_extruder", new ConfigOptionInt((int)(m_writer.extruder() != nullptr ? m_writer.extruder()->id() : -1 ))); + config.set_key_value("next_extruder", new ConfigOptionInt((int)extruder_id)); + config.set_key_value("layer_num", new ConfigOptionInt(m_layer_index)); + config.set_key_value("layer_z", new ConfigOptionFloat(print_z)); + gcode += placeholder_parser_process("toolchange_gcode", toolchange_gcode, extruder_id, &config); + check_add_eol(gcode); } // We inform the writer about what is happening, but we may not use the resulting gcode. |