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
This commit is contained in:
parent
4865240a9c
commit
52ab8a5f19
@ -2811,18 +2811,17 @@ std::string GCode::set_extruder(unsigned int extruder_id, double print_z)
|
|||||||
gcode += m_ooze_prevention.pre_toolchange(*this);
|
gcode += m_ooze_prevention.pre_toolchange(*this);
|
||||||
|
|
||||||
const std::string& toolchange_gcode = m_config.toolchange_gcode.value;
|
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.
|
// Process the custom toolchange_gcode. If it is empty, insert just a Tn command.
|
||||||
if (!toolchange_gcode.empty()) {
|
if (!toolchange_gcode.empty()) {
|
||||||
DynamicConfig config;
|
DynamicConfig config;
|
||||||
config.set_key_value("previous_extruder", new ConfigOptionInt((int)m_writer.extruder()->id()));
|
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("next_extruder", new ConfigOptionInt((int)extruder_id));
|
||||||
config.set_key_value("layer_num", new ConfigOptionInt(m_layer_index));
|
config.set_key_value("layer_num", new ConfigOptionInt(m_layer_index));
|
||||||
config.set_key_value("layer_z", new ConfigOptionFloat(print_z));
|
config.set_key_value("layer_z", new ConfigOptionFloat(print_z));
|
||||||
gcode += placeholder_parser_process("toolchange_gcode", toolchange_gcode, extruder_id, &config);
|
gcode += placeholder_parser_process("toolchange_gcode", toolchange_gcode, extruder_id, &config);
|
||||||
check_add_eol(gcode);
|
check_add_eol(gcode);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// We inform the writer about what is happening, but we may not use the resulting gcode.
|
// We inform the writer about what is happening, but we may not use the resulting gcode.
|
||||||
std::string toolchange_command = m_writer.toolchange(extruder_id);
|
std::string toolchange_command = m_writer.toolchange(extruder_id);
|
||||||
|
@ -25,7 +25,9 @@ use Slic3r::Test;
|
|||||||
$config->set('extruder_offset', [ [0,0], [20,0], [0,20], [20,20] ]);
|
$config->set('extruder_offset', [ [0,0], [20,0], [0,20], [20,20] ]);
|
||||||
$config->set('temperature', [200, 180, 170, 160]);
|
$config->set('temperature', [200, 180, 170, 160]);
|
||||||
$config->set('first_layer_temperature', [206, 186, 166, 156]);
|
$config->set('first_layer_temperature', [206, 186, 166, 156]);
|
||||||
$config->set('toolchange_gcode', ';toolchange'); # test that it doesn't crash when this is supplied
|
$config->set('toolchange_gcode', 'T[next_extruder] ;toolchange'); # test that it doesn't crash when this is supplied
|
||||||
|
# Since July 2019, PrusaSlicer only emits automatic Tn command in case that the toolchange_gcode is empty
|
||||||
|
# The "T[next_extruder]" is therefore needed in this test.
|
||||||
|
|
||||||
my $print = Slic3r::Test::init_print('20mm_cube', config => $config);
|
my $print = Slic3r::Test::init_print('20mm_cube', config => $config);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user