Forced pattern , separed to > 9 extruder

This commit is contained in:
Ian Bassi
2026-06-01 11:40:31 -03:00
parent 84c7186674
commit 42b506ad85
7 changed files with 219 additions and 303 deletions
+19 -10
View File
@@ -4,6 +4,8 @@
#include <boost/log/trivial.hpp>
#include <cfloat>
#include <limits>
#include <sstream>
namespace Slic3r {
@@ -1140,16 +1142,23 @@ static void append_mixed_component_extruders(const MixedFilamentManager &mixed_m
append_unique_painted_extruder(painting_extruders, unsigned(token - '0'), num_physical_extruders);
}
for (char token : mixed_row->manual_pattern) {
unsigned int extruder_id = 0;
if (token == '1')
extruder_id = mixed_row->component_a;
else if (token == '2')
extruder_id = mixed_row->component_b;
else if (token >= '3' && token <= '9')
extruder_id = unsigned(token - '0');
append_unique_painted_extruder(painting_extruders, extruder_id, num_physical_extruders);
const std::string normalized_pattern = MixedFilamentManager::normalize_manual_pattern(mixed_row->manual_pattern);
if (!normalized_pattern.empty()) {
std::stringstream ss(normalized_pattern);
std::string token;
while (std::getline(ss, token, ',')) {
if (token.empty())
continue;
try {
size_t consumed = 0;
const unsigned long value = std::stoul(token, &consumed);
if (consumed != token.size() || value == 0 || value > std::numeric_limits<unsigned int>::max())
continue;
append_unique_painted_extruder(painting_extruders, static_cast<unsigned int>(value), num_physical_extruders);
} catch (...) {
continue;
}
}
}
}