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
This commit is contained in:
Martin Šach 2025-03-17 14:30:50 +01:00 committed by Lukas Matena
parent 5aa70f17e4
commit 9968c68eb6

View File

@ -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<double>::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{""};
}