ENH: alternate multi-head printing sequence
jira:NEW Signed-off-by: xun.zhang <xun.zhang@bambulab.com> Change-Id: I739438e8c411b638571d5291f3e5ad3d54650a73
This commit is contained in:
parent
f1b0805ed1
commit
1ab2964ee3
|
@ -145,12 +145,9 @@ int reorder_filaments_for_minimum_flush_volume(const std::vector<unsigned int>&f
|
|||
{
|
||||
int cost = 0;
|
||||
|
||||
if (filament_sequences) {
|
||||
filament_sequences->clear();
|
||||
filament_sequences->resize(layer_filaments.size());
|
||||
}
|
||||
|
||||
//TODO: handle case with custom sequence
|
||||
std::vector<std::set<int>>groups(2);
|
||||
std::vector<std::vector<std::vector<unsigned>>> layer_sequences(2);
|
||||
for (int i = 0; i < filament_maps.size(); ++i) {
|
||||
if (filament_maps[i] == 0)
|
||||
groups[0].insert(filament_lists[i]);
|
||||
|
@ -175,7 +172,7 @@ int reorder_filaments_for_minimum_flush_volume(const std::vector<unsigned int>&f
|
|||
}
|
||||
assert(lf.size() == unsign_custom_extruder_seq.size());
|
||||
if (filament_sequences)
|
||||
(*filament_sequences)[layer] = unsign_custom_extruder_seq;
|
||||
layer_sequences[idx].emplace_back(unsign_custom_extruder_seq);
|
||||
|
||||
current_extruder_id = unsign_custom_extruder_seq.back();
|
||||
continue;
|
||||
|
@ -192,7 +189,7 @@ int reorder_filaments_for_minimum_flush_volume(const std::vector<unsigned int>&f
|
|||
assert(sequence.size()==filament_used_in_group.size());
|
||||
|
||||
if (filament_sequences)
|
||||
(*filament_sequences)[layer].insert((*filament_sequences)[layer].end(), sequence.begin(), sequence.end());
|
||||
layer_sequences[idx].emplace_back(sequence);
|
||||
|
||||
if (!sequence.empty())
|
||||
current_extruder_id = sequence.back();
|
||||
|
@ -201,6 +198,22 @@ int reorder_filaments_for_minimum_flush_volume(const std::vector<unsigned int>&f
|
|||
}
|
||||
}
|
||||
|
||||
if (filament_sequences) {
|
||||
filament_sequences->clear();
|
||||
filament_sequences->resize(layer_filaments.size());
|
||||
for (size_t layer = 0; layer < layer_filaments.size(); ++layer) {
|
||||
auto& curr_layer_seq = (*filament_sequences)[layer];
|
||||
if (layer & 1) {
|
||||
curr_layer_seq.insert(curr_layer_seq.end(), layer_sequences[1][layer].begin(), layer_sequences[1][layer].end());
|
||||
curr_layer_seq.insert(curr_layer_seq.end(), layer_sequences[0][layer].begin(), layer_sequences[0][layer].end());
|
||||
}
|
||||
else {
|
||||
curr_layer_seq.insert(curr_layer_seq.end(), layer_sequences[0][layer].begin(), layer_sequences[0][layer].end());
|
||||
curr_layer_seq.insert(curr_layer_seq.end(), layer_sequences[1][layer].begin(), layer_sequences[1][layer].end());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return cost;
|
||||
}
|
||||
|
||||
|
|
|
@ -9,8 +9,8 @@
|
|||
|
||||
#include <boost/container/small_vector.hpp>
|
||||
#include "../FilamentGroup.hpp"
|
||||
#include "ExtrusionEntity.hpp"
|
||||
#include "PrintConfig.hpp"
|
||||
#include "../ExtrusionEntity.hpp"
|
||||
#include "../PrintConfig.hpp"
|
||||
|
||||
namespace Slic3r {
|
||||
|
||||
|
|
Loading…
Reference in New Issue