From cdcd4da809fe6d78e9618200ea9e52ccf188131b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20=C5=A0ach?= Date: Thu, 29 Feb 2024 14:51:19 +0100 Subject: [PATCH] Add offset to the finalize wipe tower move --- src/libslic3r/GCode/WipeTowerIntegration.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/libslic3r/GCode/WipeTowerIntegration.cpp b/src/libslic3r/GCode/WipeTowerIntegration.cpp index d0237c39e3..5340dd5208 100644 --- a/src/libslic3r/GCode/WipeTowerIntegration.cpp +++ b/src/libslic3r/GCode/WipeTowerIntegration.cpp @@ -266,9 +266,10 @@ std::string WipeTowerIntegration::tool_change(GCodeGenerator &gcodegen, int extr std::string WipeTowerIntegration::finalize(GCodeGenerator &gcodegen) { std::string gcode; - if (std::abs(gcodegen.writer().get_position().z() - m_final_purge.print_z) > EPSILON) + const double purge_z{m_final_purge.print_z + gcodegen.config().z_offset.value}; + if (std::abs(gcodegen.writer().get_position().z() - purge_z) > EPSILON) gcode += gcodegen.generate_travel_gcode( - {{gcodegen.last_position->x(), gcodegen.last_position->y(), scaled(m_final_purge.print_z)}}, + {{gcodegen.last_position->x(), gcodegen.last_position->y(), scaled(purge_z)}}, "move to safe place for purging", [](){return "";} ); gcode += append_tcr(gcodegen, m_final_purge, -1);