Skip to content

Commit

Permalink
Print lower fractional layer heights before full ones, pt 2.
Browse files Browse the repository at this point in the history
Take care of the order optimizer w.r.t. partially fractional-height support-layers.

part of CURA-10407
  • Loading branch information
rburema committed Oct 17, 2023
1 parent 7c02094 commit bd1b634
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/FffGcodeWriter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#include "utils/math.h"
#include "utils/orderOptimizer.h"

#include <range/v3/view/concat.hpp>
#include <range/v3/view/sliding.hpp>
#include <range/v3/view/transform.hpp>
#include <range/v3/view/zip.hpp>
Expand Down Expand Up @@ -3148,11 +3149,13 @@ bool FffGcodeWriter::processSupportInfill(const SliceDataStorage& storage, Layer
const auto zag_skip_count = infill_extruder.settings.get<size_t>("support_zag_skip_count");

// create a list of outlines and use PathOrderOptimizer to optimize the travel move
PathOrderOptimizer<const SupportInfillPart*> island_order_optimizer_initial(gcode_layer.getLastPlannedPositionOrStartingPosition());
PathOrderOptimizer<const SupportInfillPart*> island_order_optimizer(gcode_layer.getLastPlannedPositionOrStartingPosition());
for (const SupportInfillPart& part : support_layer.support_infill_parts)
{
island_order_optimizer.addPolygon(&part);
(part.use_fractional_config ? island_order_optimizer_initial : island_order_optimizer).addPolygon(&part);
}
island_order_optimizer_initial.optimize();
island_order_optimizer.optimize();

const auto support_connect_zigzags = infill_extruder.settings.get<bool>("support_connect_zigzags");
Expand All @@ -3165,7 +3168,7 @@ bool FffGcodeWriter::processSupportInfill(const SliceDataStorage& storage, Layer
bool need_travel_to_end_of_last_spiral = true;

// Print the thicker infill lines first. (double or more layer thickness, infill combined with previous layers)
for (const PathOrdering<const SupportInfillPart*>& path : island_order_optimizer.paths)
for (const PathOrdering<const SupportInfillPart*>& path : ranges::views::concat(island_order_optimizer_initial.paths, island_order_optimizer.paths))
{
const SupportInfillPart& part = *path.vertices;
const auto& configs = part.use_fractional_config ? gcode_layer.configs_storage.support_fractional_infill_config : gcode_layer.configs_storage.support_infill_config;
Expand Down

0 comments on commit bd1b634

Please sign in to comment.