ENH: add manual grouping mode stats

1.In auto mode,display the statistics of auto mode and single
extruder
2.In manual mode,display the statistics of manual mode and auto mode
3.Support by object mode

jira:NONE

Signed-off-by: xun.zhang <xun.zhang@bambulab.com>
Change-Id: If54c4db79f33d5278c0f18d01ab0518e8660f9c7
(cherry picked from commit 2dbc5c939666e294c805ee4bf33ec09976688be3)
This commit is contained in:
xun.zhang
2024-07-25 11:37:15 +08:00
committed by Noisyfox
parent 0fec5317d6
commit 8331f8eba8
6 changed files with 142 additions and 51 deletions

View File

@@ -66,6 +66,7 @@ void Print::clear()
m_objects.clear();
m_print_regions.clear();
m_model.clear_objects();
m_statistics_by_extruder_count.clear();
}
// Called by Print::apply().
@@ -2064,17 +2065,13 @@ void Print::process(long long *time_cost_with_cache, bool use_cache)
m_tool_ordering.clear();
if (this->has_wipe_tower()) {
this->_make_wipe_tower();
} else if (this->config().print_sequence != PrintSequence::ByObject) {
// Initialize the tool ordering, so it could be used by the G-code preview slider for planning tool changes and filament switches.
m_tool_ordering = ToolOrdering(*this, -1, false);
}
else if (this->config().print_sequence != PrintSequence::ByObject) {
// Initialize the tool ordering, so it could be used by the G-code preview slider for planning tool changes and filament switches.
m_tool_ordering = ToolOrdering(*this, -1, false);
if (m_tool_ordering.empty() || m_tool_ordering.last_extruder() == unsigned(-1))
throw Slic3r::SlicingError("The print is empty. The model is not printable with current print settings.");
std::pair<int, int> curr_info = m_tool_ordering.get_flush_info(ToolOrdering::FlushCalcMode::Normal);
std::pair<int, int> single_extruder_info = m_tool_ordering.get_flush_info(ToolOrdering::FlushCalcMode::OneExtruder);
this->m_statistics_by_extruder_count.filament_flush_weight = { curr_info.first,single_extruder_info.first };
this->m_statistics_by_extruder_count.filament_change_count = { curr_info.second,single_extruder_info.second };
}
this->set_done(psWipeTower);
}
@@ -2709,12 +2706,6 @@ void Print::_make_wipe_tower()
// Let the ToolOrdering class know there will be initial priming extrusions at the start of the print.
m_wipe_tower_data.tool_ordering = ToolOrdering(*this, (unsigned int) -1, bUseWipeTower2 ? true : false);
std::pair<int, int> curr_info = m_wipe_tower_data.tool_ordering.get_flush_info(ToolOrdering::FlushCalcMode::Normal);
std::pair<int, int> single_extruder_info = m_wipe_tower_data.tool_ordering.get_flush_info(ToolOrdering::FlushCalcMode::OneExtruder);
this->m_statistics_by_extruder_count.filament_flush_weight = { curr_info.first,single_extruder_info.first };
this->m_statistics_by_extruder_count.filament_change_count = { curr_info.second,single_extruder_info.second };
if (!m_wipe_tower_data.tool_ordering.has_wipe_tower())
// Don't generate any wipe tower.
return;