ENH: new filament group algorithm

1.When n<10, calc all case cost
2.When n>10, first k-medoids algorithm first
3.Enable setting group size

jira:NEW

Signed-off-by: xun.zhang <xun.zhang@bambulab.com>
Change-Id: I625f47e0235c70e440c6d489b052a156fbffca3f
(cherry picked from commit 9ec276d3d7114fff7a33213c3b47ce88df85f2ee)
This commit is contained in:
xun.zhang
2024-07-08 21:31:28 +08:00
committed by Noisyfox
parent 2ff3b46a7e
commit 0ad75a223b
5 changed files with 516 additions and 306 deletions

View File

@@ -8,6 +8,9 @@
#include <utility>
#include <boost/container/small_vector.hpp>
#include "FilamentGroup.hpp"
#include "ExtrusionEntity.hpp"
#include "PrintConfig.hpp"
namespace Slic3r {
@@ -17,6 +20,13 @@ class LayerTools;
namespace CustomGCode { struct Item; }
class PrintRegion;
int reorder_filaments_for_minimum_flush_volume(const std::vector<unsigned int>& filament_lists,
const std::vector<int>& filament_maps,
const std::vector<std::vector<unsigned int>>& layer_filaments,
const std::vector<FlushMatrix>& flush_matrix,
std::optional<std::function<bool(int, std::vector<int>&)>> get_custom_seq,
std::vector<std::vector<unsigned int>>* filament_sequences);
// Object of this class holds information about whether an extrusion is printed immediately
// after a toolchange (as part of infill/perimeter wiping) or not. One extrusion can be a part
// of several copies - this has to be taken into account.
@@ -200,7 +210,6 @@ private:
void collect_extruder_statistics(bool prime_multi_material);
std::vector<int> get_recommended_filament_maps();
void reorder_extruders_for_minimum_flush_volume();
void reorder_extruders_for_minimum_flush_volume_multi_extruder(const std::vector<int> &filament_maps);
// BBS
std::vector<unsigned int> generate_first_layer_tool_order(const Print& print);