From 7b7c4beabe7073926e2e962e852a3bd375585999 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20=C5=A0ach?= Date: Mon, 8 Jul 2024 13:29:34 +0200 Subject: [PATCH] Fix skirt previous position and skirt M486 --- src/libslic3r/GCode.cpp | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/src/libslic3r/GCode.cpp b/src/libslic3r/GCode.cpp index 3ccc2fb7a3..88cc28f052 100644 --- a/src/libslic3r/GCode.cpp +++ b/src/libslic3r/GCode.cpp @@ -2363,8 +2363,8 @@ std::vector GCodeGenerator::get_sorte using GCode::ExtrusionOrder::ExtruderExtrusions; using GCode::ExtrusionOrder::get_extrusions; - const std::optional previous_position{ - this->last_position ? std::optional{this->point_to_gcode(*this->last_position)} : + const std::optional previous_position{ + this->last_position ? std::optional{scaled(this->point_to_gcode(*this->last_position))} : std::nullopt}; std::vector extrusions{ get_extrusions( @@ -2584,18 +2584,25 @@ LayerResult GCodeGenerator::process_layer( gcode += ProcessLayer::emit_custom_gcode_per_print_z(*this, *layer_tools.custom_gcode, m_writer.extruder()->id(), first_extruder_id, print.config()); } + if (!this->m_config.complete_objects.value && + (!extruder_extrusions.skirt.empty() || !extruder_extrusions.brim.empty())) { + gcode += m_label_objects.maybe_stop_instance(); + this->m_label_objects.update(nullptr); + } + if (!moved_to_first_point) { const Vec3crd point{to_3d(first_point, scaled(print_z))}; - gcode += this->travel_to_first_position(point, print_z, ExtrusionRole::Mixed, [this](){ - return m_writer.multiple_extruders ? "" : m_label_objects.maybe_change_instance(m_writer); + + gcode += this->travel_to_first_position(point, print_z, ExtrusionRole::Mixed, [this]() { + if (m_writer.multiple_extruders) { + return std::string{""}; + } + return m_label_objects.maybe_change_instance(m_writer); }); moved_to_first_point = true; } if (!extruder_extrusions.skirt.empty()) { - if (!this->m_config.complete_objects.value) { - gcode += this->m_label_objects.maybe_stop_instance(); - } this->m_label_objects.update(nullptr); m_avoid_crossing_perimeters.use_external_mp(); @@ -2616,12 +2623,6 @@ LayerResult GCodeGenerator::process_layer( } if (!extruder_extrusions.brim.empty()) { - - if (!this->m_config.complete_objects.value) { - gcode += this->m_label_objects.maybe_stop_instance(); - } - this->m_label_objects.update(nullptr); - m_avoid_crossing_perimeters.use_external_mp(); for (const GCode::ExtrusionOrder::BrimPath &brim_path : extruder_extrusions.brim) {