FIX: do not touch the plate with different printing sequence

jira: STUDIO-5424
Change-Id: I8ad00fa991b753de126a5bef0d320c452033e2e7
(cherry picked from commit c4adfe16e285f238f2c5cd8938b2167fdfb6b1b0)
This commit is contained in:
Arthur 2023-12-01 20:35:35 +08:00 committed by Lane.Wei
parent f81ba71aa5
commit da1b9bd747
2 changed files with 19 additions and 2 deletions

View File

@ -92,6 +92,7 @@ void ArrangeJob::clear_input()
m_unprintable.clear();
m_locked.clear();
m_unarranged.clear();
m_uncompatible_plates.clear();
m_selected.reserve(count + 1 /* for optional wti */);
m_unselected.reserve(count + 1 /* for optional wti */);
m_unprintable.reserve(cunprint /* for optional wti */);
@ -185,10 +186,20 @@ void ArrangeJob::prepare_selected() {
}
void ArrangeJob::prepare_all() {
PartPlateList& plate_list = m_plater->get_partplate_list();
clear_input();
PartPlateList& plate_list = m_plater->get_partplate_list();
for (size_t i = 0; i < plate_list.get_plate_count(); i++) {
PartPlate* plate = plate_list.get_plate(i);
bool same_as_global_print_seq = true;
plate->get_real_print_seq(&same_as_global_print_seq);
if (plate->is_locked() == false && !same_as_global_print_seq) {
plate->lock(true);
m_uncompatible_plates.push_back(i);
}
}
Model &model = m_plater->model();
bool selected_is_locked = false;
@ -707,6 +718,10 @@ void ArrangeJob::finalize() {
plate_list.rebuild_plates_after_arrangement(!only_on_partplate, true);
}
// unlock the plates we just locked
for (int i : m_uncompatible_plates)
plate_list.get_plate(i)->lock(false);
// BBS: update slice context and gcode result.
m_plater->update_slicing_context_to_current_partplate();

View File

@ -21,6 +21,8 @@ class ArrangeJob : public PlaterJob
ArrangePolygons m_selected, m_unselected, m_unprintable, m_locked;
std::vector<ModelInstance*> m_unarranged;
std::map<int, ArrangePolygons> m_selected_groups; // groups of selected items for sequential printing
std::vector<int> m_uncompatible_plates; // plate indices with different printing sequence than global
arrangement::ArrangeParams params;
int current_plate_index = 0;
Polygon bed_poly;