mirror of
				https://github.com/SoftFever/OrcaSlicer.git
				synced 2025-10-31 04:31:15 -06:00 
			
		
		
		
	NEW:added missing method for github branch
Change-Id: I6dba035deb036a5610d3659a6abebbe9ae768bdc
This commit is contained in:
		
							parent
							
								
									316636d36c
								
							
						
					
					
						commit
						b461d8f9d5
					
				
					 5 changed files with 83 additions and 21 deletions
				
			
		|  | @ -22,33 +22,36 @@ | ||||||
|         "bed_temperature_limit": 100, |         "bed_temperature_limit": 100, | ||||||
|         "model_id": "C11", |         "model_id": "C11", | ||||||
|         "printer_type": "C11", |         "printer_type": "C11", | ||||||
|         "ftp_folder" : "sdcard/", |         "compatible_machine": [ "BL-P001", "BL-P002"], | ||||||
|  |         "ftp_folder": "sdcard/", | ||||||
|         "printer_thumbnail_image": "printer_thumbnail_p1p" |         "printer_thumbnail_image": "printer_thumbnail_p1p" | ||||||
|       }, |       }, | ||||||
|       { |       { | ||||||
| 
 | 
 | ||||||
|         "display_name": "Bambu Lab X1", |         "display_name": "Bambu Lab X1", | ||||||
|         "func": { |         "func": { | ||||||
|             "FUNC_VIRTUAL_TYAY" : true, |           "FUNC_VIRTUAL_TYAY": true, | ||||||
|             "FUNC_EXTRUSION_CALI": false, |           "FUNC_EXTRUSION_CALI": false, | ||||||
|             "FUNC_LOCAL_TUNNEL": false |           "FUNC_LOCAL_TUNNEL": false | ||||||
|         }, |         }, | ||||||
|         "model_id": "BL-P002", |         "model_id": "BL-P002", | ||||||
|         "camera_resolution":["720p","1080p"], |         "compatible_machine": [ "BL-P001", "C11"], | ||||||
|  |         "camera_resolution": [ "720p", "1080p" ], | ||||||
|         "printer_type": "3DPrinter-X1", |         "printer_type": "3DPrinter-X1", | ||||||
|         "printer_thumbnail_image": "printer_thumbnail" |         "printer_thumbnail_image": "printer_thumbnail" | ||||||
|        }, |       }, | ||||||
|        { |       { | ||||||
|          "display_name": "Bambu Lab X1 Carbon", |         "display_name": "Bambu Lab X1 Carbon", | ||||||
|          "func": { |         "func": { | ||||||
|              "FUNC_VIRTUAL_TYAY" : true, |           "FUNC_VIRTUAL_TYAY": true, | ||||||
|              "FUNC_EXTRUSION_CALI": false, |           "FUNC_EXTRUSION_CALI": false, | ||||||
|              "FUNC_LOCAL_TUNNEL": false |           "FUNC_LOCAL_TUNNEL": false | ||||||
|          }, |         }, | ||||||
|          "model_id": "BL-P001", |         "model_id": "BL-P001", | ||||||
|          "camera_resolution":["720p","1080p"], |         "compatible_machine": [ "BL-P002", "C11"], | ||||||
|          "printer_type": "3DPrinter-X1-Carbon", |         "camera_resolution": [ "720p", "1080p" ], | ||||||
|          "printer_thumbnail_image": "printer_thumbnail" |         "printer_type": "3DPrinter-X1-Carbon", | ||||||
|        } |         "printer_thumbnail_image": "printer_thumbnail" | ||||||
|  |       } | ||||||
|     ] |     ] | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -2362,6 +2362,11 @@ void MachineObject::set_print_state(std::string status) | ||||||
|     print_status = status; |     print_status = status; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | std::vector<std::string> MachineObject::get_compatible_machine() | ||||||
|  | { | ||||||
|  |     return DeviceManager::get_compatible_machine(printer_type); | ||||||
|  | } | ||||||
|  | 
 | ||||||
| int MachineObject::connect(bool is_anonymous, bool use_openssl) | int MachineObject::connect(bool is_anonymous, bool use_openssl) | ||||||
| { | { | ||||||
|     if (dev_ip.empty()) return -1; |     if (dev_ip.empty()) return -1; | ||||||
|  | @ -5039,4 +5044,20 @@ std::string DeviceManager::load_gcode(std::string type_str, std::string gcode_fi | ||||||
|     return ""; |     return ""; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | std::vector<std::string> DeviceManager::get_compatible_machine(std::string type_str) | ||||||
|  | { | ||||||
|  |     std::vector<std::string> compatible_machine; | ||||||
|  |     if (DeviceManager::function_table.contains("printers")) { | ||||||
|  |         for (auto printer : DeviceManager::function_table["printers"]) { | ||||||
|  |             if (printer.contains("model_id") && printer["model_id"].get<std::string>() == type_str) { | ||||||
|  |                 if (printer.contains("compatible_machine")) { | ||||||
|  |                     for (auto res : printer["compatible_machine"]) | ||||||
|  |                         compatible_machine.emplace_back(res.get<std::string>()); | ||||||
|  |                 } | ||||||
|  |             } | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  |     return compatible_machine; | ||||||
|  | } | ||||||
|  | 
 | ||||||
| } // namespace Slic3r
 | } // namespace Slic3r
 | ||||||
|  |  | ||||||
|  | @ -910,6 +910,7 @@ public: | ||||||
|     static bool is_in_printing_status(std::string status); |     static bool is_in_printing_status(std::string status); | ||||||
| 
 | 
 | ||||||
|     void set_print_state(std::string status); |     void set_print_state(std::string status); | ||||||
|  |     std::vector<std::string> get_compatible_machine(); | ||||||
| 
 | 
 | ||||||
|     bool is_connected(); |     bool is_connected(); | ||||||
|     bool is_connecting(); |     bool is_connecting(); | ||||||
|  | @ -1005,6 +1006,7 @@ public: | ||||||
|     static bool load_filaments_blacklist_config(std::string config_file); |     static bool load_filaments_blacklist_config(std::string config_file); | ||||||
|     static void check_filaments_in_blacklist(std::string tag_vendor, std::string tag_type, bool& in_blacklist, std::string& ac, std::string& info); |     static void check_filaments_in_blacklist(std::string tag_vendor, std::string tag_type, bool& in_blacklist, std::string& ac, std::string& info); | ||||||
|     static std::string load_gcode(std::string type_str, std::string gcode_file); |     static std::string load_gcode(std::string type_str, std::string gcode_file); | ||||||
|  |     static std::vector<std::string> get_compatible_machine(std::string type_str); | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| } // namespace Slic3r
 | } // namespace Slic3r
 | ||||||
|  |  | ||||||
|  | @ -92,6 +92,8 @@ std::string get_print_status_info(PrintDialogStatus status) | ||||||
|         return "PrintStatusLanModeNoSdcard"; |         return "PrintStatusLanModeNoSdcard"; | ||||||
|     case PrintStatusNoSdcard: |     case PrintStatusNoSdcard: | ||||||
|         return "PrintStatusNoSdcard"; |         return "PrintStatusNoSdcard"; | ||||||
|  |     case PrintStatusUnsupportedPrinter: | ||||||
|  |         return "PrintStatusUnsupportedPrinter"; | ||||||
|     case PrintStatusTimelapseNoSdcard: |     case PrintStatusTimelapseNoSdcard: | ||||||
|         return "PrintStatusTimelapseNoSdcard"; |         return "PrintStatusTimelapseNoSdcard"; | ||||||
|     case PrintStatusNotSupportedPrintAll: |     case PrintStatusNotSupportedPrintAll: | ||||||
|  | @ -2129,7 +2131,12 @@ void SelectMachineDialog::show_status(PrintDialogStatus status, std::vector<wxSt | ||||||
|         update_print_status_msg(msg_text, true, true); |         update_print_status_msg(msg_text, true, true); | ||||||
|         Enable_Send_Button(false); |         Enable_Send_Button(false); | ||||||
|         Enable_Refresh_Button(true); |         Enable_Refresh_Button(true); | ||||||
|     } else if (status == PrintDialogStatus::PrintStatusTimelapseNoSdcard) { |     } else if (status == PrintDialogStatus::PrintStatusUnsupportedPrinter) { | ||||||
|  |         wxString msg_text = _L("The selected printer is incompatible with the chosen printer presets."); | ||||||
|  |         update_print_status_msg(msg_text, true, true); | ||||||
|  |         Enable_Send_Button(false); | ||||||
|  |         Enable_Refresh_Button(true); | ||||||
|  |     }else if (status == PrintDialogStatus::PrintStatusTimelapseNoSdcard) { | ||||||
|         wxString msg_text = _L("An SD card needs to be inserted to record timelapse."); |         wxString msg_text = _L("An SD card needs to be inserted to record timelapse."); | ||||||
|         update_print_status_msg(msg_text, true, true); |         update_print_status_msg(msg_text, true, true); | ||||||
|         Enable_Send_Button(true); |         Enable_Send_Button(true); | ||||||
|  | @ -2177,6 +2184,29 @@ void SelectMachineDialog::on_cancel(wxCloseEvent &event) | ||||||
|     this->EndModal(wxID_CANCEL); |     this->EndModal(wxID_CANCEL); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | bool SelectMachineDialog::is_blocking_printing() | ||||||
|  | { | ||||||
|  |     DeviceManager* dev = Slic3r::GUI::wxGetApp().getDeviceManager(); | ||||||
|  |     if (!dev) return true; | ||||||
|  | 
 | ||||||
|  |     MachineObject* obj_ = dev->get_selected_machine(); | ||||||
|  |     if (obj_ == nullptr) return true; | ||||||
|  | 
 | ||||||
|  |     PresetBundle* preset_bundle = wxGetApp().preset_bundle; | ||||||
|  |     auto source_model = preset_bundle->printers.get_edited_preset().get_printer_type(preset_bundle); | ||||||
|  |     auto target_model = obj_->printer_type; | ||||||
|  | 
 | ||||||
|  |     if (source_model != target_model) { | ||||||
|  |         std::vector<std::string> compatible_machine = dev->get_compatible_machine(target_model); | ||||||
|  |         vector<std::string>::iterator it = find(compatible_machine.begin(), compatible_machine.end(), source_model); | ||||||
|  |         if (it == compatible_machine.end()) { | ||||||
|  |             return true; | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     return false; | ||||||
|  | } | ||||||
|  | 
 | ||||||
| bool SelectMachineDialog::is_same_printer_model() | bool SelectMachineDialog::is_same_printer_model() | ||||||
| { | { | ||||||
|     bool result = true; |     bool result = true; | ||||||
|  | @ -3106,7 +3136,11 @@ void SelectMachineDialog::update_show_status() | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     if (obj_->is_in_upgrading()) { |     if (is_blocking_printing()) { | ||||||
|  |         show_status(PrintDialogStatus::PrintStatusUnsupportedPrinter); | ||||||
|  |         return; | ||||||
|  |     } | ||||||
|  |     else if (obj_->is_in_upgrading()) { | ||||||
|         show_status(PrintDialogStatus::PrintStatusInUpgrading); |         show_status(PrintDialogStatus::PrintStatusInUpgrading); | ||||||
|         return; |         return; | ||||||
|     } |     } | ||||||
|  |  | ||||||
|  | @ -271,7 +271,8 @@ enum PrintDialogStatus { | ||||||
|     PrintStatusNeedConsistencyUpgrading, |     PrintStatusNeedConsistencyUpgrading, | ||||||
|     PrintStatusNotSupportedSendToSDCard, |     PrintStatusNotSupportedSendToSDCard, | ||||||
|     PrintStatusNotSupportedPrintAll, |     PrintStatusNotSupportedPrintAll, | ||||||
|     PrintStatusBlankPlate |     PrintStatusBlankPlate, | ||||||
|  |     PrintStatusUnsupportedPrinter | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| std::string get_print_status_info(PrintDialogStatus status); | std::string get_print_status_info(PrintDialogStatus status); | ||||||
|  | @ -442,6 +443,7 @@ public: | ||||||
|     void set_flow_calibration_state(bool state); |     void set_flow_calibration_state(bool state); | ||||||
|     bool is_show_timelapse(); |     bool is_show_timelapse(); | ||||||
|     bool is_same_printer_model(); |     bool is_same_printer_model(); | ||||||
|  |     bool is_blocking_printing(); | ||||||
|     bool has_tips(MachineObject* obj); |     bool has_tips(MachineObject* obj); | ||||||
|     bool is_timeout(); |     bool is_timeout(); | ||||||
|     int  update_print_required_data(Slic3r::DynamicPrintConfig config, Slic3r::Model model, Slic3r::PlateDataPtrs plate_data_list, std::string file_name); |     int  update_print_required_data(Slic3r::DynamicPrintConfig config, Slic3r::Model model, Slic3r::PlateDataPtrs plate_data_list, std::string file_name); | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 tao wang
						tao wang