mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-12 01:07:57 -06:00
Bug Fix: Fix crash when printing by object after 1.8.2 code merge. Fixed tool ordering not done based on flush volume on BBL printers (#3223)
* PR: Fix crash when printing by object after 1.8.2 code merge * PR: Revert change in tool ordering - reorder_extruders_for_minimum_flush_volume to enable tool sequencing based on projected flush volumes * Bumping up reordering to up to 12 different colors on same layer. * Updated tool ordering to distinguish between bbl printers when reordering tools * Update to code comment * Updated population handling of is_bbl_printer variable
This commit is contained in:
parent
90097a1926
commit
ba09fa3866
2 changed files with 11 additions and 9 deletions
|
@ -123,6 +123,7 @@ static double calc_max_layer_height(const PrintConfig &config, double max_object
|
||||||
// (print->config().print_sequence == PrintSequence::ByObject is true).
|
// (print->config().print_sequence == PrintSequence::ByObject is true).
|
||||||
ToolOrdering::ToolOrdering(const PrintObject &object, unsigned int first_extruder, bool prime_multi_material)
|
ToolOrdering::ToolOrdering(const PrintObject &object, unsigned int first_extruder, bool prime_multi_material)
|
||||||
{
|
{
|
||||||
|
m_is_BBL_printer = object.print()->is_BBL_printer();
|
||||||
m_print_object_ptr = &object;
|
m_print_object_ptr = &object;
|
||||||
if (object.layers().empty())
|
if (object.layers().empty())
|
||||||
return;
|
return;
|
||||||
|
@ -162,6 +163,7 @@ ToolOrdering::ToolOrdering(const PrintObject &object, unsigned int first_extrude
|
||||||
// (print->config().print_sequence == PrintSequence::ByObject is false).
|
// (print->config().print_sequence == PrintSequence::ByObject is false).
|
||||||
ToolOrdering::ToolOrdering(const Print &print, unsigned int first_extruder, bool prime_multi_material)
|
ToolOrdering::ToolOrdering(const Print &print, unsigned int first_extruder, bool prime_multi_material)
|
||||||
{
|
{
|
||||||
|
m_is_BBL_printer = print.is_BBL_printer();
|
||||||
m_print_config_ptr = &print.config();
|
m_print_config_ptr = &print.config();
|
||||||
|
|
||||||
// Initialize the print layers for all objects and all layers.
|
// Initialize the print layers for all objects and all layers.
|
||||||
|
@ -757,24 +759,23 @@ void ToolOrdering::reorder_extruders_for_minimum_flush_volume()
|
||||||
const unsigned int number_of_extruders = (unsigned int) (sqrt(flush_matrix.size()) + EPSILON);
|
const unsigned int number_of_extruders = (unsigned int) (sqrt(flush_matrix.size()) + EPSILON);
|
||||||
// Extract purging volumes for each extruder pair:
|
// Extract purging volumes for each extruder pair:
|
||||||
std::vector<std::vector<float>> wipe_volumes;
|
std::vector<std::vector<float>> wipe_volumes;
|
||||||
if (m_print_config_ptr->purge_in_prime_tower) {
|
if (print_config->purge_in_prime_tower || m_is_BBL_printer) {
|
||||||
for (unsigned int i = 0; i < number_of_extruders; ++i)
|
for (unsigned int i = 0; i < number_of_extruders; ++i)
|
||||||
wipe_volumes.push_back(
|
wipe_volumes.push_back( std::vector<float>(flush_matrix.begin() + i * number_of_extruders,
|
||||||
std::vector<float>(flush_matrix.begin() + i * number_of_extruders, flush_matrix.begin() + (i + 1) * number_of_extruders));
|
flush_matrix.begin() + (i + 1) * number_of_extruders));
|
||||||
} else {
|
} else {
|
||||||
// populate wipe_volumes with prime_volume
|
// populate wipe_volumes with prime_volume
|
||||||
for (unsigned int i = 0; i < number_of_extruders; ++i) {
|
for (unsigned int i = 0; i < number_of_extruders; ++i)
|
||||||
wipe_volumes.push_back(std::vector<float>(number_of_extruders, m_print_config_ptr->prime_volume));
|
wipe_volumes.push_back(std::vector<float>(number_of_extruders, print_config->prime_volume));
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int current_extruder_id = -1;
|
unsigned int current_extruder_id = -1;
|
||||||
for (int i = 0; i < m_layer_tools.size(); ++i) {
|
for (int i = 0; i < m_layer_tools.size(); ++i) {
|
||||||
LayerTools& lt = m_layer_tools[i];
|
LayerTools& lt = m_layer_tools[i];
|
||||||
if (lt.extruders.empty())
|
if (lt.extruders.empty())
|
||||||
continue;
|
continue;
|
||||||
// todo: The algorithm complexity is too high(o(n2)), currently only 8 colors are supported
|
// todo: The algorithm complexity is too high(o(n2)), currently only 12 colors are supported
|
||||||
if (i != 0 && lt.extruders.size() <= 8) {
|
if (i != 0 && lt.extruders.size() <= 12) {
|
||||||
lt.extruders = get_extruders_order(wipe_volumes, lt.extruders, current_extruder_id);
|
lt.extruders = get_extruders_order(wipe_volumes, lt.extruders, current_extruder_id);
|
||||||
}
|
}
|
||||||
current_extruder_id = lt.extruders.back();
|
current_extruder_id = lt.extruders.back();
|
||||||
|
|
|
@ -210,6 +210,7 @@ private:
|
||||||
|
|
||||||
const PrintConfig* m_print_config_ptr = nullptr;
|
const PrintConfig* m_print_config_ptr = nullptr;
|
||||||
const PrintObject* m_print_object_ptr = nullptr;
|
const PrintObject* m_print_object_ptr = nullptr;
|
||||||
|
bool m_is_BBL_printer = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace SLic3r
|
} // namespace SLic3r
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue