ENH: add timelapse gcode for multi_extruder

and add most used_extruder for print by object
jira:none

Change-Id: I021069e865992828b098d73c0d704ba7edbd55d8
(cherry picked from commit ae62f7b8e4b4258318c0d941963eddfb70e86c15)
This commit is contained in:
zhimin.zeng
2024-12-31 09:30:46 +08:00
committed by Noisyfox
parent b3edd30bf7
commit 793e3812d9
4 changed files with 56 additions and 43 deletions

View File

@@ -823,7 +823,7 @@ void ToolOrdering::collect_extruder_statistics(bool prime_multi_material)
}
}
std::vector<int> ToolOrdering::cal_most_used_extruder(const PrintConfig &config)
void ToolOrdering::cal_most_used_extruder(const PrintConfig &config)
{
// record
std::vector<int> extruder_count;
@@ -841,7 +841,14 @@ std::vector<int> ToolOrdering::cal_most_used_extruder(const PrintConfig &config)
extruder_count[extruder_id]++;
}
}
return extruder_count;
// set key for most used extruder
// count most used extruder
most_used_extruder = 0;
for (int extruder_id = 1; extruder_id < extruder_count.size(); extruder_id++) {
if (extruder_count[extruder_id] >= extruder_count[most_used_extruder])
most_used_extruder = extruder_id;
}
}
//BBS: find first non support filament

View File

@@ -235,6 +235,7 @@ public:
std::vector<LayerTools>& layer_tools() { return m_layer_tools; }
bool has_wipe_tower() const { return ! m_layer_tools.empty() && m_first_printing_extruder != (unsigned int)-1 && m_layer_tools.front().has_wipe_tower; }
int get_most_used_extruder() const { return most_used_extruder; }
/*
* called in single extruder mode, the value in map are all 0
* called in dual extruder mode, the value in map will be 0 or 1
@@ -246,7 +247,7 @@ public:
// should be called after doing reorder
FilamentChangeStats get_filament_change_stats(FilamentChangeMode mode);
std::vector<int> cal_most_used_extruder(const PrintConfig &config);
void cal_most_used_extruder(const PrintConfig &config);
bool cal_non_support_filaments(const PrintConfig &config,
unsigned int & first_non_support_filament,
std::vector<int> & initial_non_support_filaments,
@@ -283,6 +284,8 @@ private:
FilamentChangeStats m_stats_by_single_extruder;
FilamentChangeStats m_stats_by_multi_extruder_curr;
FilamentChangeStats m_stats_by_multi_extruder_best;
int most_used_extruder;
};
} // namespace SLic3r