mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-07 23:17:35 -06:00
FIX: modify reorder extruders time
Change-Id: Ib72faf039dee6a08770617c4c2f341079d7e02e9 (cherry picked from commit 5e9d479bd7d7ef54bcafe7181dcdd8c03adaae51)
This commit is contained in:
parent
c2b2c75bf2
commit
d7a8219a8f
3 changed files with 73 additions and 50 deletions
|
@ -38,54 +38,6 @@ PrintRegion::PrintRegion(PrintRegionConfig &&config) : PrintRegion(std::move(con
|
|||
//BBS
|
||||
float Print::min_skirt_length = 0;
|
||||
|
||||
void dfs_get_all_sorted_extruders(const std::vector<std::vector<float>>& wipe_volumes,
|
||||
const std::vector<unsigned int>& all_extruders,
|
||||
std::vector<unsigned int> & sorted_extruders,
|
||||
float flush_volume,
|
||||
std::map<float, std::vector<unsigned int>> & volumes_to_extruder_order)
|
||||
{
|
||||
if (sorted_extruders.size() == all_extruders.size()) {
|
||||
volumes_to_extruder_order.insert(std::pair(flush_volume, sorted_extruders));
|
||||
return;
|
||||
}
|
||||
|
||||
for (auto extruder_id : all_extruders) {
|
||||
if (sorted_extruders.empty()) {
|
||||
sorted_extruders.push_back(extruder_id);
|
||||
dfs_get_all_sorted_extruders(wipe_volumes, all_extruders, sorted_extruders, flush_volume, volumes_to_extruder_order);
|
||||
sorted_extruders.pop_back();
|
||||
} else {
|
||||
auto itor = std::find(sorted_extruders.begin(), sorted_extruders.end(), extruder_id);
|
||||
if (itor == sorted_extruders.end()) {
|
||||
float delta_flush_volume = wipe_volumes[sorted_extruders.back()][extruder_id];
|
||||
flush_volume += delta_flush_volume;
|
||||
sorted_extruders.push_back(extruder_id);
|
||||
dfs_get_all_sorted_extruders(wipe_volumes, all_extruders, sorted_extruders, flush_volume, volumes_to_extruder_order);
|
||||
flush_volume -= delta_flush_volume;
|
||||
sorted_extruders.pop_back();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
std::vector<unsigned int> get_extruders_order(const std::vector<std::vector<float>> &wipe_volumes,
|
||||
std::vector<unsigned int> all_extruders,
|
||||
unsigned int start_extruder_id)
|
||||
{
|
||||
if (all_extruders.size() > 1) {
|
||||
std::vector<unsigned int> sorted_extruders;
|
||||
auto iter = std::find(all_extruders.begin(), all_extruders.end(), start_extruder_id);
|
||||
if (iter != all_extruders.end()) {
|
||||
sorted_extruders.push_back(start_extruder_id);
|
||||
}
|
||||
std::map<float, std::vector<unsigned int>> volumes_to_extruder_order;
|
||||
dfs_get_all_sorted_extruders(wipe_volumes, all_extruders, sorted_extruders, 0, volumes_to_extruder_order);
|
||||
if(volumes_to_extruder_order.size() > 0)
|
||||
return volumes_to_extruder_order.begin()->second;
|
||||
}
|
||||
return all_extruders;
|
||||
}
|
||||
|
||||
void Print::clear()
|
||||
{
|
||||
std::scoped_lock<std::mutex> lock(this->state_mutex());
|
||||
|
@ -1896,8 +1848,6 @@ void Print::_make_wipe_tower()
|
|||
bool first_layer = &layer_tools == &m_wipe_tower_data.tool_ordering.front();
|
||||
wipe_tower.plan_toolchange((float)layer_tools.print_z, (float)layer_tools.wipe_tower_layer_height, current_extruder_id, current_extruder_id, false);
|
||||
|
||||
layer_tools.extruders = get_extruders_order(wipe_volumes, layer_tools.extruders, current_extruder_id);
|
||||
|
||||
for (const auto extruder_id : layer_tools.extruders) {
|
||||
// BBS: priming logic is removed, so no need to do toolchange for first extruder
|
||||
if (/*(first_layer && extruder_id == m_wipe_tower_data.tool_ordering.all_extruders().back()) || */extruder_id != current_extruder_id) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue