FIX: unable to send file to sd card if plate > 1

1. Should set plate index before send file

jira:STUDIO-12431

Signed-off-by: xun.zhang <xun.zhang@bambulab.com>
Change-Id: Id7828069a81f5671b0a6b90d7b0c9b703b10a9cc
This commit is contained in:
xun.zhang 2025-05-28 16:44:41 +08:00 committed by lane.wei
parent 19ee0a3777
commit fd1e17f818
3 changed files with 23 additions and 20 deletions

View File

@ -849,7 +849,7 @@ public:
Bind(wxEVT_PAINT, [this](wxPaintEvent& evt) { Bind(wxEVT_PAINT, [this](wxPaintEvent& evt) {
wxPaintDC dc(this); wxPaintDC dc(this);
dc.SetPen(wxColour(0xEEEEEE)); dc.SetPen(wxColour("#EEEEEE"));
dc.SetBrush(*wxTRANSPARENT_BRUSH); dc.SetBrush(*wxTRANSPARENT_BRUSH);
dc.DrawRoundedRectangle(0, 0, GetSize().x, GetSize().y, 0); dc.DrawRoundedRectangle(0, 0, GetSize().x, GetSize().y, 0);
}); });
@ -906,8 +906,8 @@ ExtruderGroup::ExtruderGroup(wxWindow * parent, int index, wxString const &title
: StaticGroup(parent, wxID_ANY, title) : StaticGroup(parent, wxID_ANY, title)
{ {
SetFont(Label::Body_10); SetFont(Label::Body_10);
SetForegroundColour(wxColour(0xCECECE)); SetForegroundColour(wxColour("#CECECE"));
SetBorderColor(wxColour(0xEEEEEE)); SetBorderColor(wxColour("#EEEEEE"));
ShowBadge(true); ShowBadge(true);
// Nozzle // Nozzle
wxStaticText *label_diameter = new wxStaticText(this, wxID_ANY, _L("Diameter")); wxStaticText *label_diameter = new wxStaticText(this, wxID_ANY, _L("Diameter"));
@ -5279,7 +5279,7 @@ std::vector<size_t> Plater::priv::load_files(const std::vector<fs::path>& input_
return std::vector<size_t>(); return std::vector<size_t>();
if (!input_files.empty()) if (!input_files.empty())
q->m_3mf_path = input_files[0].string(); q->m_3mf_path = input_files[0].string();
// BBS // BBS
int filaments_cnt = config->opt<ConfigOptionStrings>("filament_colour")->values.size(); int filaments_cnt = config->opt<ConfigOptionStrings>("filament_colour")->values.size();
@ -9946,6 +9946,17 @@ void Plater::get_print_job_data(PrintPrepareData* data)
} }
} }
void Plater::set_print_job_plate_idx(int plate_idx)
{
if (plate_idx == PLATE_CURRENT_IDX) {
p->m_print_job_data.plate_idx = get_partplate_list().get_curr_plate_index();
}
else {
p->m_print_job_data.plate_idx = plate_idx;
}
}
int Plater::get_send_calibration_finished_event() int Plater::get_send_calibration_finished_event()
{ {
return EVT_SEND_CALIBRATION_FINISHED; return EVT_SEND_CALIBRATION_FINISHED;
@ -15028,14 +15039,7 @@ int Plater::send_gcode(int plate_idx, Export3mfProgressFn proFn)
{ {
int result = 0; int result = 0;
/* generate 3mf */ /* generate 3mf */
set_print_job_plate_idx(plate_idx);
if (plate_idx == PLATE_CURRENT_IDX) {
p->m_print_job_data.plate_idx = get_partplate_list().get_curr_plate_index();
}
else {
p->m_print_job_data.plate_idx = plate_idx;
}
PartPlate* plate = get_partplate_list().get_curr_plate(); PartPlate* plate = get_partplate_list().get_curr_plate();
try { try {
@ -15064,12 +15068,7 @@ int Plater::export_config_3mf(int plate_idx, Export3mfProgressFn proFn)
{ {
int result = 0; int result = 0;
/* generate 3mf */ /* generate 3mf */
if (plate_idx == PLATE_CURRENT_IDX) { set_print_job_plate_idx(plate_idx);
p->m_print_job_data.plate_idx = get_partplate_list().get_curr_plate_index();
}
else {
p->m_print_job_data.plate_idx = plate_idx;
}
PartPlate* plate = get_partplate_list().get_curr_plate(); PartPlate* plate = get_partplate_list().get_curr_plate();
try { try {

View File

@ -568,6 +568,8 @@ public:
int get_prepare_state(); int get_prepare_state();
//BBS: add print job releated functions //BBS: add print job releated functions
void get_print_job_data(PrintPrepareData* data); void get_print_job_data(PrintPrepareData* data);
void set_print_job_plate_idx(int plate_idx);
int get_send_calibration_finished_event(); int get_send_calibration_finished_event();
int get_print_finished_event(); int get_print_finished_event();
int get_send_finished_event(); int get_send_finished_event();

View File

@ -849,8 +849,10 @@ void SendToPrinterDialog::on_ok(wxCommandEvent &event)
// enter sending mode // enter sending mode
sending_mode(); sending_mode();
if (wxGetApp().plater()->using_exported_file()) if (wxGetApp().plater()->using_exported_file()) {
result = 0; m_plater->set_print_job_plate_idx(m_print_plate_idx);
result = 0;
}
else { else {
result = m_plater->send_gcode(m_print_plate_idx, [this](int export_stage, int current, int total, bool &cancel) { result = m_plater->send_gcode(m_print_plate_idx, [this](int export_stage, int current, int total, bool &cancel) {
if (this->m_is_canceled) return; if (this->m_is_canceled) return;