mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-05-18 19:12:17 +00:00
Fix: modify the rules of get_wall_filament_for_all_layer
jira: none Change-Id: I6e8655105470dc3eef291d4b6ac1c4447092b21a (cherry picked from commit 81ad7bdde0db5c7bc22951843c2c226496d7b2c0)
This commit is contained in:
@@ -3613,15 +3613,30 @@ int WipeTower::get_wall_filament_for_all_layer()
|
|||||||
{
|
{
|
||||||
std::map<int, int> category_counts;
|
std::map<int, int> category_counts;
|
||||||
std::map<int, int> filament_counts;
|
std::map<int, int> filament_counts;
|
||||||
|
int current_tool = m_current_tool;
|
||||||
for (const auto &layer : m_plan) {
|
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) {
|
for (size_t i = 0; i < layer.tool_changes.size(); ++i) {
|
||||||
if (i == 0) {
|
if (i == 0) {
|
||||||
filament_counts[layer.tool_changes[i].old_tool]++;
|
filament_counts[layer.tool_changes[i].old_tool]++;
|
||||||
category_counts[get_filament_category(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]++;
|
if (!used_category.count(get_filament_category(layer.tool_changes[i].new_tool)))
|
||||||
category_counts[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;
|
// std::vector<std::pair<int, int>> category_counts_vec;
|
||||||
|
|||||||
Reference in New Issue
Block a user