mirror of
				https://github.com/SoftFever/OrcaSlicer.git
				synced 2025-10-30 20:21:12 -06:00 
			
		
		
		
	NEW:added to send all plate to printer sd card
Change-Id: Ib7610d64a3b45afaea432c26832313d248c6890b
This commit is contained in:
		
							parent
							
								
									4c9cf7577d
								
							
						
					
					
						commit
						0f00adb0d1
					
				
					 8 changed files with 81 additions and 15 deletions
				
			
		|  | @ -30,6 +30,7 @@ wxDEFINE_EVENT(EVT_GLTOOLBAR_EXPORT_SLICED_FILE, SimpleEvent); | |||
| wxDEFINE_EVENT(EVT_GLTOOLBAR_EXPORT_ALL_SLICED_FILE, SimpleEvent); | ||||
| wxDEFINE_EVENT(EVT_GLTOOLBAR_PRINT_SELECT, SimpleEvent); | ||||
| wxDEFINE_EVENT(EVT_GLTOOLBAR_SEND_TO_PRINTER, SimpleEvent); | ||||
| wxDEFINE_EVENT(EVT_GLTOOLBAR_SEND_TO_PRINTER_ALL, SimpleEvent); | ||||
| 
 | ||||
| wxDEFINE_EVENT(EVT_GLTOOLBAR_ADD, SimpleEvent); | ||||
| wxDEFINE_EVENT(EVT_GLTOOLBAR_DELETE, SimpleEvent); | ||||
|  |  | |||
|  | @ -30,6 +30,7 @@ wxDECLARE_EVENT(EVT_GLTOOLBAR_EXPORT_SLICED_FILE, SimpleEvent); | |||
| wxDECLARE_EVENT(EVT_GLTOOLBAR_EXPORT_ALL_SLICED_FILE, SimpleEvent); | ||||
| wxDECLARE_EVENT(EVT_GLTOOLBAR_PRINT_SELECT, SimpleEvent); | ||||
| wxDECLARE_EVENT(EVT_GLTOOLBAR_SEND_TO_PRINTER, SimpleEvent); | ||||
| wxDECLARE_EVENT(EVT_GLTOOLBAR_SEND_TO_PRINTER_ALL, SimpleEvent); | ||||
| 
 | ||||
| wxDECLARE_EVENT(EVT_GLTOOLBAR_ADD, SimpleEvent); | ||||
| wxDECLARE_EVENT(EVT_GLTOOLBAR_DELETE, SimpleEvent); | ||||
|  |  | |||
|  | @ -1345,6 +1345,8 @@ wxBoxSizer* MainFrame::create_side_tools() | |||
|                 wxPostEvent(m_plater, SimpleEvent(EVT_GLTOOLBAR_EXPORT_ALL_SLICED_FILE)); | ||||
|             else if (m_print_select == eSendToPrinter) | ||||
|                 wxPostEvent(m_plater, SimpleEvent(EVT_GLTOOLBAR_SEND_TO_PRINTER)); | ||||
|             else if (m_print_select == eSendToPrinterAll) | ||||
|                 wxPostEvent(m_plater, SimpleEvent(EVT_GLTOOLBAR_SEND_TO_PRINTER_ALL)); | ||||
|         }); | ||||
| 
 | ||||
|     m_slice_option_btn->Bind(wxEVT_BUTTON, [this](wxCommandEvent& event) | ||||
|  | @ -1467,6 +1469,17 @@ wxBoxSizer* MainFrame::create_side_tools() | |||
|                     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; | ||||
|  | @ -1488,6 +1501,7 @@ wxBoxSizer* MainFrame::create_side_tools() | |||
|                 p->append_button(print_plate_btn); | ||||
|                 p->append_button(print_all_btn); | ||||
|                 //p->append_button(send_to_printer_btn);
 | ||||
|                 //p->append_button(send_to_printer_all_btn);
 | ||||
|                 p->append_button(export_sliced_file_btn); | ||||
|                 p->append_button(export_all_sliced_file_btn); | ||||
|             } | ||||
|  | @ -1611,6 +1625,13 @@ bool MainFrame::get_enable_print_status() | |||
| 			enable = false; | ||||
| 		} | ||||
| 	} | ||||
|     else if (m_print_select == eSendToPrinterAll) | ||||
|     { | ||||
|         if (!part_plate_list.is_all_slice_results_ready_for_print()) | ||||
|         { | ||||
|             enable = false; | ||||
|         } | ||||
|     } | ||||
|     else if (m_print_select == eExportAllSlicedFile) | ||||
|     { | ||||
|         if (!part_plate_list.is_all_slice_results_ready_for_print()) | ||||
|  |  | |||
|  | @ -172,7 +172,6 @@ class MainFrame : public DPIFrame | |||
| 
 | ||||
|     ESettingsLayout m_layout{ ESettingsLayout::Unknown }; | ||||
| 
 | ||||
| 
 | ||||
|     enum SliceSelectType | ||||
|     { | ||||
|         eSliceAll = 0, | ||||
|  | @ -211,8 +210,9 @@ public: | |||
|         eExportGcode = 3, | ||||
|         eSendGcode = 4, | ||||
|         eSendToPrinter = 5, | ||||
|         eUploadGcode = 6, | ||||
|         eExportAllSlicedFile = 7 | ||||
|         eSendToPrinterAll = 6, | ||||
|         eUploadGcode = 7, | ||||
|         eExportAllSlicedFile = 8 | ||||
|     }; | ||||
| 
 | ||||
|     //BBS: add slice&&print status update logic
 | ||||
|  |  | |||
|  | @ -2013,7 +2013,7 @@ struct Plater::priv | |||
|     void update_fff_scene_only_shells(bool only_shells = true); | ||||
|     //BBS: add popup object table logic
 | ||||
|     bool PopupObjectTable(int object_id, int volume_id, const wxPoint& position); | ||||
|     void on_action_send_to_printer(); | ||||
|     void on_action_send_to_printer(bool isall = false); | ||||
| private: | ||||
|     bool layers_height_allowed() const; | ||||
| 
 | ||||
|  | @ -2023,6 +2023,7 @@ private: | |||
|     void undo_redo_to(std::vector<UndoRedo::Snapshot>::const_iterator it_snapshot); | ||||
|     void update_after_undo_redo(const UndoRedo::Snapshot& snapshot, bool temp_snapshot_was_taken = false); | ||||
|     void on_action_export_to_sdcard(SimpleEvent&); | ||||
|     void on_action_export_to_sdcard_all(SimpleEvent&); | ||||
|     // path to project folder stored with no extension
 | ||||
|     boost::filesystem::path     m_project_folder; | ||||
| 
 | ||||
|  | @ -2335,6 +2336,7 @@ Plater::priv::priv(Plater *q, MainFrame *main_frame) | |||
|         q->Bind(EVT_GLTOOLBAR_EXPORT_SLICED_FILE, &priv::on_action_export_sliced_file, this); | ||||
|         q->Bind(EVT_GLTOOLBAR_EXPORT_ALL_SLICED_FILE, &priv::on_action_export_all_sliced_file, this); | ||||
|         q->Bind(EVT_GLTOOLBAR_SEND_TO_PRINTER, &priv::on_action_export_to_sdcard, this); | ||||
|         q->Bind(EVT_GLTOOLBAR_SEND_TO_PRINTER_ALL, &priv::on_action_export_to_sdcard_all, this); | ||||
|         q->Bind(EVT_GLCANVAS_PLATE_SELECT, &priv::on_plate_selected, this); | ||||
|         q->Bind(EVT_DOWNLOAD_PROJECT, &priv::on_action_download_project, this); | ||||
|         q->Bind(EVT_IMPORT_MODEL_ID, &priv::on_action_request_model_id, this); | ||||
|  | @ -5849,10 +5851,16 @@ void Plater::priv::on_action_print_plate(SimpleEvent&) | |||
| } | ||||
| 
 | ||||
| 
 | ||||
| void Plater::priv::on_action_send_to_printer() | ||||
| void Plater::priv::on_action_send_to_printer(bool isall) | ||||
| { | ||||
| 	if (!m_send_to_sdcard_dlg) m_send_to_sdcard_dlg = new SendToPrinterDialog(q); | ||||
| 	m_send_to_sdcard_dlg->prepare(partplate_list.get_curr_plate_index()); | ||||
|     if (isall) { | ||||
|         m_send_to_sdcard_dlg->prepare(PLATE_ALL_IDX); | ||||
|     } | ||||
|     else { | ||||
|         m_send_to_sdcard_dlg->prepare(partplate_list.get_curr_plate_index()); | ||||
|     } | ||||
| 	 | ||||
| 	m_send_to_sdcard_dlg->ShowModal(); | ||||
| } | ||||
| 
 | ||||
|  | @ -5870,8 +5878,6 @@ void Plater::priv::on_action_print_all(SimpleEvent&) | |||
|         BOOST_LOG_TRIVIAL(debug) << __FUNCTION__ << ":received print all event\n" ; | ||||
|     } | ||||
| 
 | ||||
|     if (!wxGetApp().check_login()) return; | ||||
| 
 | ||||
|     //BBS
 | ||||
|     if (!m_select_machine_dlg) m_select_machine_dlg = new SelectMachineDialog(q); | ||||
|     m_select_machine_dlg->prepare(PLATE_ALL_IDX); | ||||
|  | @ -5926,6 +5932,15 @@ void Plater::priv::on_action_export_to_sdcard(SimpleEvent&) | |||
| 	} | ||||
| } | ||||
| 
 | ||||
| void Plater::priv::on_action_export_to_sdcard_all(SimpleEvent&) | ||||
| { | ||||
|     if (q != nullptr) { | ||||
|         BOOST_LOG_TRIVIAL(debug) << __FUNCTION__ << ":received export sliced file event\n"; | ||||
|         q->send_to_printer(true); | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| 
 | ||||
| //BBS: add plate select logic
 | ||||
| void Plater::priv::on_plate_selected(SimpleEvent&) | ||||
| { | ||||
|  | @ -8797,9 +8812,9 @@ void Plater::export_gcode(bool prefer_removable) | |||
|     } | ||||
| } | ||||
| 
 | ||||
| void Plater::send_to_printer() | ||||
| void Plater::send_to_printer(bool isall) | ||||
| { | ||||
|     p->on_action_send_to_printer(); | ||||
|     p->on_action_send_to_printer(isall); | ||||
| } | ||||
| 
 | ||||
| //BBS export gcode 3mf to file
 | ||||
|  |  | |||
|  | @ -303,7 +303,7 @@ public: | |||
|     void segment(size_t obj_idx, size_t instance_idx, double smoothing_alpha=0.5, int segment_number=5); | ||||
|     void merge(size_t obj_idx, std::vector<int>& vol_indeces); | ||||
| 
 | ||||
|     void send_to_printer(); | ||||
|     void send_to_printer(bool isall = false); | ||||
|     void export_gcode(bool prefer_removable); | ||||
|     void export_gcode_3mf(bool export_all = false); | ||||
|     void send_gcode_finish(wxString name); | ||||
|  |  | |||
|  | @ -2301,7 +2301,12 @@ void SelectMachineDialog::on_rename_enter(wxCommandEvent& event) | |||
| 
 | ||||
|     if (m_valid_type != Valid) { | ||||
|         MessageDialog msg_wingow(nullptr, info_line, "", wxICON_WARNING | wxOK); | ||||
|         if (msg_wingow.ShowModal() == wxOK) { return; } | ||||
|         if (msg_wingow.ShowModal() == wxID_OK) {  | ||||
|              m_rename_switch_panel->SetSelection(0); | ||||
|              m_rename_text->SetLabel(m_current_project_name); | ||||
|              m_rename_normal_panel->Layout(); | ||||
|             return;  | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
|     m_current_project_name = new_file_name; | ||||
|  | @ -2659,10 +2664,19 @@ void SelectMachineDialog::set_default() | |||
| { | ||||
|     //project name
 | ||||
|     m_rename_switch_panel->SetSelection(0); | ||||
|     wxString filename = m_plater->get_export_gcode_filename("", false); | ||||
|      | ||||
|     wxString filename = m_plater->get_export_gcode_filename("", false,  | ||||
|         m_print_plate_idx == PLATE_ALL_IDX ?true:false); | ||||
| 
 | ||||
|     if (m_print_plate_idx == PLATE_ALL_IDX && filename.empty()) { | ||||
|         filename = _L("Untitled"); | ||||
|     } | ||||
| 
 | ||||
|     if (filename.empty()) { | ||||
|         filename = m_plater->get_export_gcode_filename("", true); | ||||
|         if (std::strstr(filename.c_str(), _L("Untitled").c_str()) == NULL) { | ||||
|             filename = wxString::Format("Untitled%s",filename); | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
|     fs::path filename_path(filename.c_str()); | ||||
|  |  | |||
|  | @ -128,7 +128,12 @@ void SendToPrinterDialog::on_rename_enter(wxCommandEvent& event) | |||
| 
 | ||||
|     if (m_valid_type != Valid) { | ||||
|         MessageDialog msg_wingow(nullptr, info_line, "", wxICON_WARNING | wxOK); | ||||
|         if (msg_wingow.ShowModal() == wxOK) { return; } | ||||
|         if (msg_wingow.ShowModal() == wxID_OK) { | ||||
|             m_rename_switch_panel->SetSelection(0); | ||||
|             m_rename_text->SetLabel(m_current_project_name); | ||||
|             m_rename_normal_panel->Layout(); | ||||
|             return; | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
|     m_current_project_name = new_file_name; | ||||
|  | @ -1033,10 +1038,19 @@ void SendToPrinterDialog::set_default() | |||
| { | ||||
|     //project name
 | ||||
|     m_rename_switch_panel->SetSelection(0); | ||||
|     wxString filename = m_plater->get_export_gcode_filename("", false); | ||||
| 
 | ||||
|     wxString filename = m_plater->get_export_gcode_filename("", false, | ||||
|         m_print_plate_idx == PLATE_ALL_IDX ? true : false); | ||||
| 
 | ||||
|     if (m_print_plate_idx == PLATE_ALL_IDX && filename.empty()) { | ||||
|         filename = _L("Untitled"); | ||||
|     } | ||||
| 
 | ||||
|     if (filename.empty()) { | ||||
|         filename = m_plater->get_export_gcode_filename("", true); | ||||
|         if (std::strstr(filename.c_str(), _L("Untitled").c_str()) == NULL) { | ||||
|             filename = wxString::Format("Untitled%s", filename); | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
|     fs::path filename_path(filename.c_str()); | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 tao wang
						tao wang