From cfe8b336674ab85bf33606f3da542dd808efe4fd Mon Sep 17 00:00:00 2001 From: alves Date: Mon, 19 Jan 2026 18:30:16 +0800 Subject: [PATCH] feature open tag for export gcode.3mf --- src/slic3r/GUI/MainFrame.cpp | 250 +++++++++++++++-------------------- 1 file changed, 104 insertions(+), 146 deletions(-) diff --git a/src/slic3r/GUI/MainFrame.cpp b/src/slic3r/GUI/MainFrame.cpp index 2eb43b2cfd..e934b41ae8 100644 --- a/src/slic3r/GUI/MainFrame.cpp +++ b/src/slic3r/GUI/MainFrame.cpp @@ -1745,165 +1745,123 @@ wxBoxSizer* MainFrame::create_side_tools() m_print_option_btn->Bind(wxEVT_BUTTON, [this](wxCommandEvent& event) { - SidePopup* p = new SidePopup(this); + SidePopup* p = new SidePopup(this); - if (wxGetApp().preset_bundle - && !wxGetApp().preset_bundle->is_bbl_vendor()) { - // ThirdParty Buttons - SideButton* export_gcode_btn = new SideButton(p, _L("Export G-code file"), ""); - export_gcode_btn->SetCornerRadius(0); - export_gcode_btn->Bind(wxEVT_BUTTON, [this, p](wxCommandEvent&) { - m_print_btn->SetLabel(_L("Export G-code file")); - m_print_select = eExportGcode; - m_print_enable = get_enable_print_status(); - m_print_btn->Enable(m_print_enable); - this->Layout(); - p->Dismiss(); - }); + // if (wxGetApp().preset_bundle && !wxGetApp().preset_bundle->is_bbl_vendor()) + if (0) { + // ThirdParty Buttons + SideButton* export_gcode_btn = new SideButton(p, _L("Export G-code file"), ""); + export_gcode_btn->SetCornerRadius(0); + export_gcode_btn->Bind(wxEVT_BUTTON, [this, p](wxCommandEvent&) { + m_print_btn->SetLabel(_L("Export G-code file")); + m_print_select = eExportGcode; + m_print_enable = get_enable_print_status(); + m_print_btn->Enable(m_print_enable); + this->Layout(); + p->Dismiss(); + }); - // upload and print - SideButton* send_gcode_btn = new SideButton(p, _L("Print"), ""); - send_gcode_btn->SetCornerRadius(0); - send_gcode_btn->Bind(wxEVT_BUTTON, [this, p](wxCommandEvent&) { - m_print_btn->SetLabel(_L("Print")); - m_print_select = eSendGcode; - m_print_enable = get_enable_print_status(); - m_print_btn->Enable(m_print_enable); - this->Layout(); - p->Dismiss(); - }); + // upload and print + SideButton* send_gcode_btn = new SideButton(p, _L("Print"), ""); + send_gcode_btn->SetCornerRadius(0); + send_gcode_btn->Bind(wxEVT_BUTTON, [this, p](wxCommandEvent&) { + m_print_btn->SetLabel(_L("Print")); + m_print_select = eSendGcode; + m_print_enable = get_enable_print_status(); + m_print_btn->Enable(m_print_enable); + this->Layout(); + p->Dismiss(); + }); - p->append_button(send_gcode_btn); - p->append_button(export_gcode_btn); + p->append_button(send_gcode_btn); + p->append_button(export_gcode_btn); + } else { + SideButton* print_plate_btn = new SideButton(p, _L("Print"), ""); + print_plate_btn->SetCornerRadius(0); + + SideButton* export_sliced_file_btn = new SideButton(p, _L("Export plate sliced file"), ""); + export_sliced_file_btn->SetCornerRadius(0); + + SideButton* export_all_sliced_file_btn = new SideButton(p, _L("Export all sliced file"), ""); + export_all_sliced_file_btn->SetCornerRadius(0); + + print_plate_btn->Bind(wxEVT_BUTTON, [this, p](wxCommandEvent&) { + m_print_btn->SetLabel(_L("Print")); + m_print_select = eSendGcode; + m_print_enable = get_enable_print_status(); + m_print_btn->Enable(m_print_enable); + this->Layout(); + p->Dismiss(); + }); + + export_sliced_file_btn->Bind(wxEVT_BUTTON, [this, p](wxCommandEvent&) { + m_print_btn->SetLabel(_L("Export plate sliced file")); + m_print_select = eExportSlicedFile; + m_print_enable = get_enable_print_status(); + m_print_btn->Enable(m_print_enable); + this->Layout(); + p->Dismiss(); + }); + + export_all_sliced_file_btn->Bind(wxEVT_BUTTON, [this, p](wxCommandEvent&) { + m_print_btn->SetLabel(_L("Export all sliced file")); + m_print_select = eExportAllSlicedFile; + m_print_enable = get_enable_print_status(); + m_print_btn->Enable(m_print_enable); + this->Layout(); + p->Dismiss(); + }); + + bool support_send = true; + bool support_print_all = true; + + const auto preset_bundle = wxGetApp().preset_bundle; + if (preset_bundle) { + if (preset_bundle->use_bbl_network()) { + // BBL network support everything + } else { + support_send = false; // All 3rd print hosts do not have the send options + + auto cfg = preset_bundle->printers.get_edited_preset().config; + const auto host_type = cfg.option>("host_type")->value; + + // Only simply print support uploading all plates + support_print_all = host_type == PrintHostType::htSimplyPrint; + } } - else { - //Snapmaker Orca Buttons - SideButton* print_plate_btn = new SideButton(p, _L("Print plate"), ""); - print_plate_btn->SetCornerRadius(0); - SideButton* send_to_printer_btn = new SideButton(p, _L("Send"), ""); - send_to_printer_btn->SetCornerRadius(0); + p->append_button(print_plate_btn); - SideButton* export_sliced_file_btn = new SideButton(p, _L("Export plate sliced file"), ""); - export_sliced_file_btn->SetCornerRadius(0); - - SideButton* export_all_sliced_file_btn = new SideButton(p, _L("Export all sliced file"), ""); - export_all_sliced_file_btn->SetCornerRadius(0); - - print_plate_btn->Bind(wxEVT_BUTTON, [this, p](wxCommandEvent&) { - m_print_btn->SetLabel(_L("Print plate")); - m_print_select = ePrintPlate; - m_print_enable = get_enable_print_status(); - m_print_btn->Enable(m_print_enable); - this->Layout(); - p->Dismiss(); - }); - - SideButton* print_all_btn = new SideButton(p, _L("Print all"), ""); - print_all_btn->SetCornerRadius(0); - print_all_btn->Bind(wxEVT_BUTTON, [this, p](wxCommandEvent&) { - m_print_btn->SetLabel(_L("Print all")); - m_print_select = ePrintAll; - m_print_enable = get_enable_print_status(); - m_print_btn->Enable(m_print_enable); - this->Layout(); - p->Dismiss(); - }); - - send_to_printer_btn->Bind(wxEVT_BUTTON, [this, p](wxCommandEvent&) { - m_print_btn->SetLabel(_L("Send")); - m_print_select = eSendToPrinter; - m_print_enable = get_enable_print_status(); - m_print_btn->Enable(m_print_enable); - this->Layout(); - p->Dismiss(); - }); - - SideButton* send_to_printer_all_btn = new SideButton(p, _L("Send all"), ""); - send_to_printer_all_btn->SetCornerRadius(0); - send_to_printer_all_btn->Bind(wxEVT_BUTTON, [this, p](wxCommandEvent&) { - m_print_btn->SetLabel(_L("Send all")); - m_print_select = eSendToPrinterAll; - m_print_enable = get_enable_print_status(); - m_print_btn->Enable(m_print_enable); - this->Layout(); - p->Dismiss(); - }); - - export_sliced_file_btn->Bind(wxEVT_BUTTON, [this, p](wxCommandEvent&) { - m_print_btn->SetLabel(_L("Export plate sliced file")); - m_print_select = eExportSlicedFile; - m_print_enable = get_enable_print_status(); - m_print_btn->Enable(m_print_enable); - this->Layout(); - p->Dismiss(); - }); - - export_all_sliced_file_btn->Bind(wxEVT_BUTTON, [this, p](wxCommandEvent&) { - m_print_btn->SetLabel(_L("Export all sliced file")); - m_print_select = eExportAllSlicedFile; - m_print_enable = get_enable_print_status(); - m_print_btn->Enable(m_print_enable); - this->Layout(); - p->Dismiss(); - }); - - bool support_send = true; - bool support_print_all = true; - - const auto preset_bundle = wxGetApp().preset_bundle; - if (preset_bundle) { - if (preset_bundle->use_bbl_network()) { - // BBL network support everything - } else { - support_send = false; // All 3rd print hosts do not have the send options - - auto cfg = preset_bundle->printers.get_edited_preset().config; - const auto host_type = cfg.option>("host_type")->value; - - // Only simply print support uploading all plates - support_print_all = host_type == PrintHostType::htSimplyPrint; - } - } - - p->append_button(print_plate_btn); - if (support_print_all) { - p->append_button(print_all_btn); - } - if (support_send) { - p->append_button(send_to_printer_btn); - p->append_button(send_to_printer_all_btn); - } - if (enable_multi_machine) { - SideButton* print_multi_machine_btn = new SideButton(p, _L("Send to Multi-device"), ""); - print_multi_machine_btn->SetCornerRadius(0); - print_multi_machine_btn->Bind(wxEVT_BUTTON, [this, p](wxCommandEvent&) { - m_print_btn->SetLabel(_L("Send to Multi-device")); - m_print_select = ePrintMultiMachine; - m_print_enable = get_enable_print_status(); - m_print_btn->Enable(m_print_enable); - this->Layout(); - p->Dismiss(); - }); - p->append_button(print_multi_machine_btn); - } - p->append_button(export_sliced_file_btn); - p->append_button(export_all_sliced_file_btn); - SideButton* export_gcode_btn = new SideButton(p, _L("Export G-code file"), ""); - export_gcode_btn->SetCornerRadius(0); - export_gcode_btn->Bind(wxEVT_BUTTON, [this, p](wxCommandEvent&) { - m_print_btn->SetLabel(_L("Export G-code file")); - m_print_select = eExportGcode; + if (enable_multi_machine) { + SideButton* print_multi_machine_btn = new SideButton(p, _L("Send to Multi-device"), ""); + print_multi_machine_btn->SetCornerRadius(0); + print_multi_machine_btn->Bind(wxEVT_BUTTON, [this, p](wxCommandEvent&) { + m_print_btn->SetLabel(_L("Send to Multi-device")); + m_print_select = ePrintMultiMachine; m_print_enable = get_enable_print_status(); m_print_btn->Enable(m_print_enable); this->Layout(); p->Dismiss(); }); - p->append_button(export_gcode_btn); + p->append_button(print_multi_machine_btn); } - - p->Popup(m_print_btn); + p->append_button(export_sliced_file_btn); + p->append_button(export_all_sliced_file_btn); + SideButton* export_gcode_btn = new SideButton(p, _L("Export G-code file"), ""); + export_gcode_btn->SetCornerRadius(0); + export_gcode_btn->Bind(wxEVT_BUTTON, [this, p](wxCommandEvent&) { + m_print_btn->SetLabel(_L("Export G-code file")); + m_print_select = eExportGcode; + m_print_enable = get_enable_print_status(); + m_print_btn->Enable(m_print_enable); + this->Layout(); + p->Dismiss(); + }); + p->append_button(export_gcode_btn); } + + p->Popup(m_print_btn); + } ); /*