Browse Source

Fix wipe tower deretraction string.

Return the previous behaviour for non priming toolchanges and
handle priming toolchanges separately.
Martin Šach 1 year ago
parent
commit
4481525169
1 changed files with 2 additions and 1 deletions
  1. 2 1
      src/libslic3r/GCode/WipeTowerIntegration.cpp

+ 2 - 1
src/libslic3r/GCode/WipeTowerIntegration.cpp

@@ -93,7 +93,8 @@ std::string WipeTowerIntegration::append_tcr(GCodeGenerator &gcodegen, const Wip
             gcodegen.m_wipe.reset_path(); // We don't want wiping on the ramming lines.
         toolchange_gcode_str = gcodegen.set_extruder(new_extruder_id, tcr.print_z); // TODO: toolchange_z vs print_z
         if (gcodegen.config().wipe_tower) {
-            deretraction_str += gcodegen.writer().get_travel_to_z_gcode(tcr.print_z, "restore layer Z");
+            const double retract_to_z = tcr.priming ? tcr.print_z + gcodegen.config().z_offset.value : z;
+            deretraction_str += gcodegen.writer().get_travel_to_z_gcode(retract_to_z, "restore layer Z");
             deretraction_str += gcodegen.unretract();
         }
     }