From 9968c68eb694e032eed43f7c78a5b1137edee773 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20=C5=A0ach?= Date: Mon, 17 Mar 2025 14:30:50 +0100 Subject: [PATCH] SPE-2719 Use writer z instead of print z for first layer travel (#14298) print_z does not make sense on first layer of sequentialy printed object as the first travel is not on the same layer, rather it is from the last layer of the previous object to the first layer of the current one --- src/libslic3r/GCode.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/libslic3r/GCode.cpp b/src/libslic3r/GCode.cpp index 90da4aa8d0..ae21cb96e9 100644 --- a/src/libslic3r/GCode.cpp +++ b/src/libslic3r/GCode.cpp @@ -2762,7 +2762,11 @@ LayerResult GCodeGenerator::process_layer( if (m_current_instance != next_instance) { m_avoid_crossing_perimeters.use_external_mp_once = true; } - gcode += this->travel_to_first_position(first_point - to_3d(shift, 0), print_z, ExtrusionRole::Mixed, [this]() { + + const double writer_z{m_writer.get_position().z()}; + const double previous_z{writer_z <= std::numeric_limits::epsilon() ? print_z : writer_z}; + + gcode += this->travel_to_first_position(first_point - to_3d(shift, 0), previous_z, ExtrusionRole::Mixed, [this]() { if (m_writer.multiple_extruders) { return std::string{""}; }