From 5d30cb58834a0b9839f557644bb6c6a9689e12b4 Mon Sep 17 00:00:00 2001 From: "zhou.xu" Date: Mon, 6 Jan 2025 16:38:30 +0800 Subject: [PATCH] FIX:plate number corresponds to plate number in 3D jira: none Change-Id: I632e3e3330bddcc7744de8ebc69900feb57e1b41 --- src/slic3r/GUI/SyncAmsInfoDialog.cpp | 19 +++++++++++++------ src/slic3r/GUI/SyncAmsInfoDialog.hpp | 1 + 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/src/slic3r/GUI/SyncAmsInfoDialog.cpp b/src/slic3r/GUI/SyncAmsInfoDialog.cpp index 52bf4d2d1..b29f4d262 100644 --- a/src/slic3r/GUI/SyncAmsInfoDialog.cpp +++ b/src/slic3r/GUI/SyncAmsInfoDialog.cpp @@ -385,11 +385,12 @@ SyncAmsInfoDialog::SyncAmsInfoDialog(wxWindow *parent, SyncInfo &info) : wxArrayString choices; for (size_t i = 0; i < plate_list.get_plate_count(); i++) { auto temp_plate = GUI::wxGetApp().plater()->get_partplate_list().get_plate(i); - if (!temp_plate->get_objects().empty()) { + if (!temp_plate->get_objects_on_this_plate().empty()) { if (m_is_empty_project) { m_is_empty_project = false; } - choices.Add(std::to_wstring(i)); + choices.Add(i < 10 ? ("0"+std::to_wstring(i + 1)) : std::to_wstring(i)); + m_plate_choices.emplace_back(i); } } if (m_is_empty_project == false) { @@ -406,11 +407,17 @@ SyncAmsInfoDialog::SyncAmsInfoDialog(wxWindow *parent, SyncInfo &info) : for (size_t i = 0; i < choices.size(); i++) { cur_combox->Append(choices[i]); } - cur_combox->SetSelection(m_specify_plate_idx); + auto iter = std::find(m_plate_choices.begin(), m_plate_choices.end(), m_specify_plate_idx); + if (iter != m_plate_choices.end()) { + auto index = iter - m_plate_choices.begin(); + cur_combox->SetSelection(index); + } cur_combox->Bind(wxEVT_COMBOBOX, [this](auto &e) { - update_when_change_plate(e.GetSelection()); - Layout(); - Fit(); + if (e.GetSelection() < m_plate_choices.size()) { + update_when_change_plate(m_plate_choices[e.GetSelection()]); + Layout(); + Fit(); + } }); m_plate_combox_sizer->Add(cur_combox, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxEXPAND | wxBOTTOM, FromDIP(5)); diff --git a/src/slic3r/GUI/SyncAmsInfoDialog.hpp b/src/slic3r/GUI/SyncAmsInfoDialog.hpp index 0422de28b..cb69a2ccf 100644 --- a/src/slic3r/GUI/SyncAmsInfoDialog.hpp +++ b/src/slic3r/GUI/SyncAmsInfoDialog.hpp @@ -282,6 +282,7 @@ private: wxCheckBox* m_merge_color_checkbox = nullptr; bool m_is_empty_project = true; + std::vector m_plate_choices; const int THUMBNAIL_SIZE_WIDTH = 200; int m_specify_plate_idx{-1}; wxString m_printer_name;