diff --git a/include/PrimeTower.h b/include/PrimeTower.h index 3ea546efa6..8164e01e70 100644 --- a/include/PrimeTower.h +++ b/include/PrimeTower.h @@ -152,7 +152,7 @@ class PrimeTower * \param line_width The actual line width of the extruder * \param actual_extruder_nr The actual extruder to be used */ - ExtrusionMoves generatePath_sparseInfill( + Polygons generatePath_sparseInfill( const size_t first_extruder, const size_t last_extruder, const std::vector& rings_radii, diff --git a/src/FffGcodeWriter.cpp b/src/FffGcodeWriter.cpp index 414eac2a8d..f569b66a9d 100644 --- a/src/FffGcodeWriter.cpp +++ b/src/FffGcodeWriter.cpp @@ -1061,7 +1061,7 @@ LayerPlan& FffGcodeWriter::processLayer(const SliceDataStorage& storage, LayerIn // later in the print a prime tower is needed. // - prime tower is already printed this layer (only applicable for more than 2 extruders). // The setExtruder_addPrime takes care of this. - if (extruder_nr != extruder_order.front() || (extruder_order.size() == 1 && layer_nr >= 0) || extruder_nr == 0) + if (extruder_nr != extruder_order.front().extruder_nr || (extruder_order.size() == 1 && layer_nr >= 0) || extruder_nr == 0) { setExtruder_addPrime(storage, gcode_layer, extruder_nr); } @@ -1092,7 +1092,7 @@ LayerPlan& FffGcodeWriter::processLayer(const SliceDataStorage& storage, LayerIn // Always print a prime tower before switching extruder. Unless: // - The prime tower is already printed this layer (setExtruder_addPrime takes care of this). // - this is the last extruder of the layer, since the next layer will start with the same extruder. - if (extruder_nr != extruder_order.back() && layer_nr >= 0) + if (extruder_nr != extruder_order.back().extruder_nr && layer_nr >= 0) { setExtruder_addPrime(storage, gcode_layer, extruder_nr); } @@ -1403,9 +1403,7 @@ std::vector // Make a temp list with the potential ordered extruders std::vector ordered_extruders; ordered_extruders.push_back(start_extruder); - - // The outermost prime tower extruder is always used if there is a prime tower, apart on layers with negative index (e.g. for the raft) - if (mesh_group_settings.get("prime_tower_enable") && /*layer_nr >= 0 &&*/ layer_nr <= storage.max_print_height_second_to_last_extruder) + for (size_t extruder_nr = 0; extruder_nr < extruder_count; extruder_nr++) { if (extruder_nr != start_extruder) { diff --git a/src/PrimeTower.cpp b/src/PrimeTower.cpp index 7c634c4651..56ef14dc06 100644 --- a/src/PrimeTower.cpp +++ b/src/PrimeTower.cpp @@ -246,10 +246,10 @@ void PrimeTower::generatePaths_sparseInfill(const std::vector& cumulati extruders_combination |= (1 << extruder_nr); } - std::map infills_for_combination; + std::map infills_for_combination; for (const ActualExtruder& actual_extruder : actual_extruders) { - ExtrusionMoves infill = generatePath_sparseInfill(first_extruder, last_extruder, rings_radii, actual_extruder.line_width, actual_extruder.number); + Polygons infill = generatePath_sparseInfill(first_extruder, last_extruder, rings_radii, actual_extruder.line_width, actual_extruder.number); infills_for_combination[actual_extruder.number] = infill; } @@ -259,7 +259,7 @@ void PrimeTower::generatePaths_sparseInfill(const std::vector& cumulati } } -PrimeTower::ExtrusionMoves PrimeTower::generatePath_sparseInfill( +Polygons PrimeTower::generatePath_sparseInfill( const size_t first_extruder, const size_t last_extruder, const std::vector& rings_radii, @@ -277,7 +277,7 @@ PrimeTower::ExtrusionMoves PrimeTower::generatePath_sparseInfill( const size_t nb_rings = std::ceil(static_cast(radius_delta) / max_bridging_distance); const coord_t actual_radius_step = radius_delta / nb_rings; - ExtrusionMoves pattern; + Polygons pattern; for (size_t i = 0; i < nb_rings; ++i) { const coord_t ring_inner_radius = (inner_radius + i * actual_radius_step) + semi_line_width; @@ -285,7 +285,7 @@ PrimeTower::ExtrusionMoves PrimeTower::generatePath_sparseInfill( const size_t semi_nb_spokes = std::ceil((M_PI * ring_outer_radius) / max_bridging_distance); - pattern.polygons.add(PolygonUtils::makeWheel(middle, ring_inner_radius, ring_outer_radius, semi_nb_spokes, ARC_RESOLUTION)); + pattern.add(PolygonUtils::makeWheel(middle, ring_inner_radius, ring_outer_radius, semi_nb_spokes, ARC_RESOLUTION)); } return pattern; @@ -479,12 +479,12 @@ void PrimeTower::addToGcode_optimizedInfill(LayerPlan& gcode_layer, const std::v auto iterator_combination = sparse_pattern_per_extruders.find(mask); if (iterator_combination != sparse_pattern_per_extruders.end()) { - const std::map& infill_for_combination = iterator_combination->second; + const std::map& infill_for_combination = iterator_combination->second; auto iterator_extruder_nr = infill_for_combination.find(current_extruder); if (iterator_extruder_nr != infill_for_combination.end()) { - gcode_layer.addPolygonsByOptimizer(iterator_extruder_nr->second.polygons, config); + gcode_layer.addPolygonsByOptimizer(iterator_extruder_nr->second, config); } else {