mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-10-05 14:51:06 +00:00
Apply per-variant cooling, ramming and temperature range on nozzle-rack slices
Fan speeds, multi-tool ramming, the tower interface and flush temperature fallbacks and the custom G-code placeholders now use the extruder variant a filament prints with on each layer, instead of reading by filament id.
This commit is contained in:
@@ -1230,15 +1230,21 @@ void ToolOrdering::cal_most_used_extruder(const PrintConfig &config)
|
||||
|
||||
float ToolOrdering::cal_max_additional_fan(const PrintConfig &config)
|
||||
{
|
||||
// record
|
||||
std::set<unsigned int> used_filaments;
|
||||
for (const LayerTools &layer_tools : m_layer_tools)
|
||||
used_filaments.insert(layer_tools.extruders.begin(), layer_tools.extruders.end());
|
||||
if (used_filaments.empty())
|
||||
return 0;
|
||||
|
||||
// Orca: additional_cooling_fan_speed can hold one value per extruder variant a filament prints with;
|
||||
// filament_self_index maps such a column to its filament.
|
||||
const std::vector<int> &self_index = config.filament_self_index.values;
|
||||
const size_t columns = std::max(config.additional_cooling_fan_speed.size(), size_t(*used_filaments.rbegin()) + 1);
|
||||
float max_fan = 0;
|
||||
for (LayerTools &layer_tools : m_layer_tools) {
|
||||
std::vector<unsigned int> filaments = layer_tools.extruders;
|
||||
std::set<int> layer_extruder_count;
|
||||
// count once only
|
||||
for (unsigned int &filament : filaments)
|
||||
if (max_fan < config.additional_cooling_fan_speed.get_at(filament))
|
||||
max_fan = config.additional_cooling_fan_speed.get_at(filament);
|
||||
for (size_t column = 0; column < columns; ++column) {
|
||||
const unsigned int filament_id = self_index.size() == columns ? self_index[column] - 1 : column;
|
||||
if (used_filaments.count(filament_id) && max_fan < config.additional_cooling_fan_speed.get_at(column))
|
||||
max_fan = config.additional_cooling_fan_speed.get_at(column);
|
||||
}
|
||||
return max_fan;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user