mirror of
https://git.mirrors.martin98.com/https://github.com/bambulab/BambuStudio.git
synced 2025-09-29 00:13:12 +08:00
Fix: modify the rules of get_wall_filament_for_all_layer
jira: none Change-Id: I6e8655105470dc3eef291d4b6ac1c4447092b21a
This commit is contained in:
parent
b9d07f402e
commit
81ad7bdde0
@ -3620,15 +3620,30 @@ int WipeTower::get_wall_filament_for_all_layer()
|
||||
{
|
||||
std::map<int, int> category_counts;
|
||||
std::map<int, int> filament_counts;
|
||||
int current_tool = m_current_tool;
|
||||
for (const auto &layer : m_plan) {
|
||||
if (layer.tool_changes.empty()){
|
||||
filament_counts[current_tool]++;
|
||||
category_counts[get_filament_category(current_tool)]++;
|
||||
continue;
|
||||
}
|
||||
std::unordered_set<int> used_tools;
|
||||
std::unordered_set<int> used_category;
|
||||
for (size_t i = 0; i < layer.tool_changes.size(); ++i) {
|
||||
if (i == 0) {
|
||||
filament_counts[layer.tool_changes[i].old_tool]++;
|
||||
category_counts[get_filament_category(layer.tool_changes[i].old_tool)]++;
|
||||
used_tools.insert(layer.tool_changes[i].old_tool);
|
||||
used_category.insert(get_filament_category(layer.tool_changes[i].old_tool));
|
||||
}
|
||||
filament_counts[layer.tool_changes[i].new_tool]++;
|
||||
category_counts[get_filament_category(layer.tool_changes[i].new_tool)]++;
|
||||
if (!used_category.count(get_filament_category(layer.tool_changes[i].new_tool)))
|
||||
category_counts[get_filament_category(layer.tool_changes[i].new_tool)]++;
|
||||
if (!used_tools.count(layer.tool_changes[i].new_tool))
|
||||
filament_counts[layer.tool_changes[i].new_tool]++;
|
||||
used_tools.insert(layer.tool_changes[i].new_tool);
|
||||
used_category.insert(get_filament_category(layer.tool_changes[i].new_tool));
|
||||
}
|
||||
current_tool = layer.tool_changes.empty()?current_tool:layer.tool_changes.back().new_tool;
|
||||
}
|
||||
|
||||
// std::vector<std::pair<int, int>> category_counts_vec;
|
||||
|
Loading…
x
Reference in New Issue
Block a user