diff --git a/src/libslic3r/GCode.cpp b/src/libslic3r/GCode.cpp index a793a3567..e3eafaafd 100644 --- a/src/libslic3r/GCode.cpp +++ b/src/libslic3r/GCode.cpp @@ -140,7 +140,7 @@ namespace Slic3r { int OozePrevention::_get_temp(const GCode& gcodegen) const { - return (gcodegen.layer() != nullptr && gcodegen.layer()->id() == 0) + return (gcodegen.layer() == nullptr || gcodegen.layer()->id() == 0) ? gcodegen.config().first_layer_temperature.get_at(gcodegen.writer().extruder()->id()) : gcodegen.config().temperature.get_at(gcodegen.writer().extruder()->id()); } @@ -1196,6 +1196,10 @@ void GCode::_do_export(Print& print, GCodeOutputStream &file, ThumbnailsGenerato is_extruder_used[extruder_id] = true; m_placeholder_parser.set("is_extruder_used", new ConfigOptionBools(is_extruder_used)); } + + // Enable ooze prevention if configured so. + DoExport::init_ooze_prevention(print, m_ooze_prevention); + std::string start_gcode = this->placeholder_parser_process("start_gcode", print.config().start_gcode.value, initial_extruder_id); // Set bed temperature if the start G-code does not contain any bed temp control G-codes. this->_print_first_layer_bed_temperature(file, print, start_gcode, initial_extruder_id, true); @@ -1214,9 +1218,6 @@ void GCode::_do_export(Print& print, GCodeOutputStream &file, ThumbnailsGenerato // Set other general things. file.write(this->preamble()); - // Enable ooze prevention if configured so. - DoExport::init_ooze_prevention(print, m_ooze_prevention); - print.throw_if_canceled(); // Collect custom seam data from all objects. @@ -1747,7 +1748,7 @@ void GCode::_print_first_layer_extruder_temperatures(GCodeOutputStream &file, Pr m_writer.set_temperature(temp, wait, first_printing_extruder_id); } else { // Custom G-code does not set the extruder temperature. Do it now. - if (print.config().single_extruder_multi_material.value || m_ooze_prevention.enable) { + if (print.config().single_extruder_multi_material.value) { // Set temperature of the first printing extruder only. int temp = print.config().first_layer_temperature.get_at(first_printing_extruder_id); if (temp > 0) @@ -1756,8 +1757,14 @@ void GCode::_print_first_layer_extruder_temperatures(GCodeOutputStream &file, Pr // Set temperatures of all the printing extruders. for (unsigned int tool_id : print.extruders()) { int temp = print.config().first_layer_temperature.get_at(tool_id); - if (print.config().ooze_prevention.value) - temp += print.config().standby_temperature_delta.value; + + if (print.config().ooze_prevention.value && tool_id != first_printing_extruder_id) { + if (print.config().idle_temperature.is_nil(tool_id)) + temp += print.config().standby_temperature_delta.value; + else + temp = print.config().idle_temperature.get_at(tool_id); + } + if (temp > 0) file.write(m_writer.set_temperature(temp, wait, tool_id)); }