ENH: auto-arranging allows more filaments together

Auto-arranging allows more filaments to be printed on the same plate

Only HighTemp and LowTemp filaments are not allowed on the same plate.

Jira: https://jira.bambooolab.com/browse/STUDIO-4682
Change-Id: I1bd4966e6aaa55a6dd9dff05f0bd94f2795a62b0
(cherry picked from commit 965040912af0555ca190702e7c7ac92e177a2922)
This commit is contained in:
Arthur 2023-10-08 21:06:25 +08:00 committed by Lane.Wei
parent 7b93986dfa
commit d64031a054
7 changed files with 159 additions and 91 deletions

View file

@ -930,6 +930,44 @@ bool Print::check_multi_filaments_compatibility(const std::vector<std::string>&
return true;
}
bool Print::is_filaments_compatible(const std::vector<int>& filament_types)
{
bool has_high_temperature_filament = false;
bool has_low_temperature_filament = false;
for (const auto& type : filament_types) {
if (type == FilamentTempType::HighTemp)
has_high_temperature_filament = true;
else if (type == FilamentTempType::LowTemp)
has_low_temperature_filament = true;
}
if (has_high_temperature_filament && has_low_temperature_filament)
return false;
return true;
}
int Print::get_compatible_filament_type(const std::set<int>& filament_types)
{
bool has_high_temperature_filament = false;
bool has_low_temperature_filament = false;
for (const auto& type : filament_types) {
if (type == FilamentTempType::HighTemp)
has_high_temperature_filament = true;
else if (type == FilamentTempType::LowTemp)
has_low_temperature_filament = true;
}
if (has_high_temperature_filament && has_low_temperature_filament)
return HighLowCompatible;
else if (has_high_temperature_filament)
return HighTemp;
else if (has_low_temperature_filament)
return LowTemp;
return HighLowCompatible;
}
//BBS: this function is used to check whether multi filament can be printed
StringObjectException Print::check_multi_filament_valid(const Print& print)
{