From 12755cd374811ea3b7a0fcde82505cf97edd8ab5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20=C5=A0ach?= Date: Wed, 14 Feb 2024 17:51:10 +0100 Subject: [PATCH] Fix layer change smoothing --- src/libslic3r/GCode.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/libslic3r/GCode.cpp b/src/libslic3r/GCode.cpp index d53605f3ca..b088fc5bce 100644 --- a/src/libslic3r/GCode.cpp +++ b/src/libslic3r/GCode.cpp @@ -2124,8 +2124,10 @@ std::string GCodeGenerator::get_layer_change_gcode(const Vec3d& from, const Vec3 elevation_params.lift_height = std::max(z_change, elevation_params.lift_height); const double path_length = unscaled(xy_path.length()); - const double lift_at_travel_end = - (elevation_params.lift_height / elevation_params.slope_end * path_length); + const double lift_at_travel_end = std::min( + elevation_params.lift_height, + elevation_params.lift_height / elevation_params.slope_end * path_length + ); if (lift_at_travel_end < z_change) { elevation_params.lift_height = z_change; elevation_params.slope_end = path_length;