FIX: avoid wipe tower conflict with objects

Change-Id: I09f6937a4bb698e4981c094c5694b3ce50efd2b4
(cherry picked from commit 2fc3f05732b8e5c7132b6c8a5f4403d30c516bff)
This commit is contained in:
manch1n 2023-04-10 16:03:28 +08:00 committed by Lane.Wei
parent 229b173894
commit 29459fe4cb
3 changed files with 22 additions and 11 deletions

View file

@ -1718,7 +1718,7 @@ bool GLCanvas3D::make_current_for_postinit() {
return _set_current();
}
Points GLCanvas3D::estimate_wipe_tower_points(int plate_index) const
Points GLCanvas3D::estimate_wipe_tower_points(int plate_index, bool global) const
{
PartPlateList & ppl = wxGetApp().plater()->get_partplate_list();
DynamicPrintConfig &proj_cfg = wxGetApp().preset_bundle->project_config;
@ -1734,9 +1734,17 @@ Points GLCanvas3D::estimate_wipe_tower_points(int plate_index) const
if (wipe_tower_size(1) == 0) {
// when depth is unavailable (no items on this plate), we have to estimate the depth using the extruder number of all plates
std::set<int> extruder_ids;
auto pl = ppl.get_plate_list();
for (const auto& p : pl) {
auto es = p->get_extruders();
if (global) {
auto objs = wxGetApp().obj_list()->objects();
for (ModelObject *obj : *objs) {
for (ModelVolume *volume : obj->volumes) {
std::vector<int> es = volume->get_extruders();
extruder_ids.insert(es.begin(), es.end());
}
}
} else {
PartPlate* pl = ppl.get_plate(plate_index);
std::vector<int> es = pl->get_extruders();
extruder_ids.insert(es.begin(), es.end());
}
int extruder_size = extruder_ids.size();

View file

@ -1059,7 +1059,7 @@ public:
bool make_current_for_postinit();
//BBS
Points estimate_wipe_tower_points(int plate_index) const;
Points estimate_wipe_tower_points(int plate_index, bool global = true) const;
private:
bool _is_shown_on_screen() const;

View file

@ -312,7 +312,10 @@ void ArrangeJob::prepare_wipe_tower()
for (int bedid = 0; bedid < MAX_NUM_PLATES; bedid++) {
if (!plates_have_wipe_tower[bedid]) {
wipe_tower_ap.translation = {0, 0};
wipe_tower_ap.poly.contour.points = canvas3D->estimate_wipe_tower_points(bedid);
bool global = true;
int state = m_plater->get_prepare_state();
if (state == Job::JobPrepareState::PREPARE_STATE_MENU) { global = false; }
wipe_tower_ap.poly.contour.points = canvas3D->estimate_wipe_tower_points(bedid, global);
wipe_tower_ap.bed_idx = bedid;
m_unselected.emplace_back(wipe_tower_ap);
}