@@ -58,14 +58,15 @@ GCodePath* LayerPlan::getLatestPathWithConfig(
5858 {
5959 return &paths.back ();
6060 }
61- paths.emplace_back (GCodePath{ .z_offset = z_offset,
62- .config = config,
63- .mesh = current_mesh_,
64- .space_fill_type = space_fill_type,
65- .flow = flow,
66- .width_factor = width_factor,
67- .spiralize = spiralize,
68- .speed_factor = speed_factor });
61+ paths.emplace_back (
62+ GCodePath{ .z_offset = z_offset,
63+ .config = config,
64+ .mesh = current_mesh_,
65+ .space_fill_type = space_fill_type,
66+ .flow = flow,
67+ .width_factor = width_factor,
68+ .spiralize = spiralize,
69+ .speed_factor = speed_factor });
6970
7071 GCodePath* ret = &paths.back ();
7172 ret->skip_agressive_merge_hint = mode_skip_agressive_merge_;
@@ -2325,17 +2326,25 @@ TravelAntiOozing LayerPlan::computeAntiOozeAmount(
23252326 // Now loop over the segments of the travel move to find when and where the retraction/prime should stop/start
23262327 const Duration duration_during_travel = (anti_oozing.amount_while_travel - anti_oozing.z_hop .amount ) / speed;
23272328 Duration travel_duration;
2328- for (const auto & segment : points | ranges::views::sliding (2 ))
2329+ for (const auto & [index, segment] : points | ranges::views::sliding (2 ) | ranges::views::enumerate )
23292330 {
23302331 const Point2LL& segment_start = segment[0 ].toPoint2LL ();
23312332 const Point2LL& segment_end = segment[1 ].toPoint2LL ();
23322333
23332334 const Duration segment_duration = (vSize (segment_end - segment_start) / path.config .getSpeed ()) / 1000.0 ;
2334- if (travel_duration + segment_duration >= (duration_during_travel - 0 .001_s))
2335+ if (( travel_duration + segment_duration >= (duration_during_travel - 0 .001_s)) || index == points. size () - 2 )
23352336 {
23362337 // Retraction/prime ends/starts on this segment, so calculate the intermediate position and final/start amount
2337- const double segment_ratio = (duration_during_travel - travel_duration) / segment_duration;
2338- anti_oozing.segment_split_position = cura::lerp (segment_start, segment_end, segment_ratio).toPoint2LL ();
2338+ if (segment_duration > 0 .001_s)
2339+ {
2340+ const double segment_ratio = (duration_during_travel - travel_duration) / segment_duration;
2341+ anti_oozing.segment_split_position = cura::lerp (segment_start, segment_end, segment_ratio).toPoint2LL ();
2342+ }
2343+ else
2344+ {
2345+ anti_oozing.segment_split_position = segment_start;
2346+ }
2347+
23392348 if (reversed)
23402349 {
23412350 anti_oozing.amount_by_segment .insert (anti_oozing.amount_by_segment .begin (), anti_oozing.z_hop .amount );
0 commit comments