mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-08-12 21:39:02 +08:00
SPE-1922: Place M600 after unretract to prevent printer returns at the position that was already printed with the previous color.
This fixes #2672 caused by the default implementation of M600 that returns back to XY position before M600.
This commit is contained in:
parent
76bbfbad5f
commit
540b800a5c
@ -2249,7 +2249,13 @@ LayerResult GCodeGenerator::process_layer(
|
||||
|
||||
if (single_object_instance_idx == size_t(-1)) {
|
||||
// Normal (non-sequential) print.
|
||||
gcode += ProcessLayer::emit_custom_gcode_per_print_z(*this, layer_tools.custom_gcode, m_writer.extruder()->id(), first_extruder_id, print.config());
|
||||
std::string custom_gcode = ProcessLayer::emit_custom_gcode_per_print_z(*this, layer_tools.custom_gcode, m_writer.extruder()->id(), first_extruder_id, print.config());
|
||||
if (layer_tools.custom_gcode != nullptr && layer_tools.custom_gcode->type == CustomGCode::ColorChange) {
|
||||
// We have a color change to do on this layer, but we want to do it immediately before the first extrusion instead of now, in order to fix GH #2672
|
||||
m_pending_pre_extrusion_gcode = custom_gcode;
|
||||
} else {
|
||||
gcode += custom_gcode;
|
||||
}
|
||||
}
|
||||
// Extrude skirt at the print_z of the raft layers and normal object layers
|
||||
// not at the print_z of the interlaced support material layers.
|
||||
@ -3010,6 +3016,12 @@ std::string GCodeGenerator::_extrude(
|
||||
// compensate retraction
|
||||
gcode += this->unretract();
|
||||
|
||||
if (!m_pending_pre_extrusion_gcode.empty()) {
|
||||
// There is G-Code that is due to be inserted before an extrusion starts. Insert it.
|
||||
gcode += m_pending_pre_extrusion_gcode;
|
||||
m_pending_pre_extrusion_gcode.clear();
|
||||
}
|
||||
|
||||
// adjust acceleration
|
||||
if (m_config.default_acceleration.value > 0) {
|
||||
double acceleration;
|
||||
|
@ -458,6 +458,8 @@ private:
|
||||
bool m_brim_done;
|
||||
// Flag indicating whether the nozzle temperature changes from 1st to 2nd layer were performed.
|
||||
bool m_second_layer_things_done;
|
||||
// G-code that is due to be written before the next extrusion
|
||||
std::string m_pending_pre_extrusion_gcode;
|
||||
// Pointer to currently exporting PrintObject and instance index.
|
||||
GCode::PrintObjectInstance m_current_instance;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user