@@ -2846,6 +2846,7 @@ void LayerPlan::writeGCode(GCodeExport& gcode)
28462846 const ExtruderTrain& extruder = Application::getInstance ().current_slice_ ->scene .extruders [extruder_nr];
28472847
28482848 bool update_extrusion_offset = true ;
2849+ bool spiralize_finisher = false ;
28492850
28502851 double cumulative_path_time = 0 .; // Time in seconds.
28512852 const std::function<void (const double , const int64_t )> insertTempOnTime = [&](const double to_add, const int64_t path_idx)
@@ -3008,7 +3009,7 @@ void LayerPlan::writeGCode(GCodeExport& gcode)
30083009 gcode.writeComment (ss.str ());
30093010 }
30103011
3011- if (! path.spiralize && path.travel_to_z && (! path.retract || ! path.perform_z_hop ) && (z_ + path.z_offset + path.points .front ().z_ != gcode.getPositionZ ())
3012+ if (! ( path.spiralize || spiralize_finisher) && path.travel_to_z && (! path.retract || ! path.perform_z_hop ) && (z_ + path.z_offset + path.points .front ().z_ != gcode.getPositionZ ())
30123013 && (path_idx > 0 || layer_nr_ > 0 ))
30133014 {
30143015 // First move to desired height to then make a plain horizontal move
@@ -3054,22 +3055,27 @@ void LayerPlan::writeGCode(GCodeExport& gcode)
30543055 }
30553056 if (! coasting) // not same as 'else', cause we might have changed [coasting] in the line above...
30563057 { // normal path to gcode algorithm
3058+ const coord_t extra_z_offset = spiralize_finisher ? layer_thickness_ : 0 ;
3059+
30573060 Point3LL prev_point = gcode.getPosition ();
30583061 for (unsigned int point_idx = 0 ; point_idx < path.points .size (); point_idx++)
30593062 {
3060- const auto [_, time] = extruder_plan.getPointToPointTime (prev_point, path.points [point_idx], path);
3063+ Point3LL& pt = path.points [point_idx];
3064+ pt.z_ += extra_z_offset;
3065+
3066+ const auto [_, time] = extruder_plan.getPointToPointTime (prev_point, pt, path);
30613067 insertTempOnTime (time, path_idx);
30623068
30633069 const double extrude_speed = speed * path.speed_back_pressure_factor ;
30643070 writeExtrusionRelativeZ (
30653071 gcode,
3066- path. points [point_idx] ,
3072+ pt ,
30673073 extrude_speed,
30683074 path.z_offset ,
30693075 path.getExtrusionMM3perMM (),
30703076 path.config .type ,
30713077 update_extrusion_offset);
3072- sendLineTo (path, path. points [point_idx] , extrude_speed);
3078+ sendLineTo (path, pt , extrude_speed);
30733079
30743080 prev_point = path.points [point_idx];
30753081 }
@@ -3118,6 +3124,7 @@ void LayerPlan::writeGCode(GCodeExport& gcode)
31183124 sendLineTo (spiral_path, Point3LL (p1.x_ , p1.y_ , z_offset), extrude_speed, layer_thickness_);
31193125 }
31203126 }
3127+ spiralize_finisher = true ;
31213128 path_idx--; // the last path_idx didnt spiralize, so it's not part of the current spiralize path
31223129 }
31233130 } // paths for this extruder /\ .
0 commit comments