ENH: seperate reorder from toolorder construct

1.Only do reorder if requseted.In by object mode,we only need
to collect the filaments in the object for filament grouping

jira:NONE

Signed-off-by: xun.zhang <xun.zhang@bambulab.com>
Change-Id: Id88f2449c6d3c5d45b9ff87513308d997fa72da1
(cherry picked from commit 7b5818fe6c538123373243ec8dfedc3c2fa68e6d)
This commit is contained in:
xun.zhang
2024-11-19 19:14:30 +08:00
committed by Noisyfox
parent ee4875dc87
commit 40f930945a
4 changed files with 201 additions and 169 deletions

View File

@@ -2081,6 +2081,7 @@ void Print::process(long long *time_cost_with_cache, bool use_cache)
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);
m_tool_ordering.sort_and_build_data(*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.");
@@ -2150,6 +2151,7 @@ void Print::process(long long *time_cost_with_cache, bool use_cache)
print_object_instance_sequential_active = print_object_instances_ordering.begin();
for (; print_object_instance_sequential_active != print_object_instances_ordering.end(); ++print_object_instance_sequential_active) {
tool_ordering = ToolOrdering(*(*print_object_instance_sequential_active)->print_object, initial_extruder_id);
tool_ordering.sort_and_build_data(*(*print_object_instance_sequential_active)->print_object, initial_extruder_id);
if ((initial_extruder_id = tool_ordering.first_extruder()) != static_cast<unsigned int>(-1)) {
append(printExtruders, tool_ordering.tools_for_layer(layers_to_print.front().first).extruders);
}
@@ -2754,6 +2756,7 @@ void Print::_make_wipe_tower()
const auto bUseWipeTower2 = is_BBL_printer() ? false : true;
// 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);
m_wipe_tower_data.tool_ordering.sort_and_build_data(*this, (unsigned int)-1, bUseWipeTower2 ? true : false);
if (!m_wipe_tower_data.tool_ordering.has_wipe_tower())
// Don't generate any wipe tower.