FIX: use the last_select_machine

jira: [STUDIO-11576]
Change-Id: Iaf8531ef7704c08f5cf853cc4d25acd711db4b8e
This commit is contained in:
xin.zhang 2025-04-24 11:12:13 +08:00 committed by lane.wei
parent 8ca806abdf
commit b24b5af377
2 changed files with 6 additions and 16 deletions

View File

@ -1942,12 +1942,8 @@ static std::unordered_set<int> _get_used_nozzle_idxes()
} }
bool SelectMachineDialog::is_nozzle_data_valid(const ExtderData &ext_data) const static bool _is_nozzle_data_valid(MachineObject* obj_, const ExtderData &ext_data)
{ {
DeviceManager *dev = Slic3r::GUI::wxGetApp().getDeviceManager();
if (!dev) return false;
MachineObject *obj_ = dev->get_selected_machine();
if (obj_ == nullptr) return false; if (obj_ == nullptr) return false;
PresetBundle *preset_bundle = wxGetApp().preset_bundle; PresetBundle *preset_bundle = wxGetApp().preset_bundle;
@ -1977,13 +1973,9 @@ bool SelectMachineDialog::is_nozzle_data_valid(const ExtderData &ext_data) const
* @param tag_nozzle_diameter -- return the target nozzle_diameter but mismatch * @param tag_nozzle_diameter -- return the target nozzle_diameter but mismatch
* @return is same or not * @return is same or not
/*************************************************************/ /*************************************************************/
bool SelectMachineDialog::is_same_nozzle_diameters(float &tag_nozzle_diameter, int& mismatch_nozzle_id) const static bool _is_same_nozzle_diameters(MachineObject* obj, float &tag_nozzle_diameter, int& mismatch_nozzle_id)
{ {
DeviceManager* dev = Slic3r::GUI::wxGetApp().getDeviceManager(); if (obj == nullptr) return false;
if (!dev) return false;
MachineObject* obj_ = dev->get_selected_machine();
if (obj_ == nullptr) return false;
PresetBundle* preset_bundle = wxGetApp().preset_bundle; PresetBundle* preset_bundle = wxGetApp().preset_bundle;
auto opt_nozzle_diameters = preset_bundle->printers.get_edited_preset().config.option<ConfigOptionFloatsNullable>("nozzle_diameter"); auto opt_nozzle_diameters = preset_bundle->printers.get_edited_preset().config.option<ConfigOptionFloatsNullable>("nozzle_diameter");
@ -2006,7 +1998,7 @@ bool SelectMachineDialog::is_same_nozzle_diameters(float &tag_nozzle_diameter, i
} }
tag_nozzle_diameter = float(opt_nozzle_diameters->get_at(used_nozzle_idx)); tag_nozzle_diameter = float(opt_nozzle_diameters->get_at(used_nozzle_idx));
if (tag_nozzle_diameter != obj_->m_extder_data.extders[used_nozzle_idx].current_nozzle_diameter) if (tag_nozzle_diameter != obj->m_extder_data.extders[used_nozzle_idx].current_nozzle_diameter)
{ {
mismatch_nozzle_id = used_nozzle_idx; mismatch_nozzle_id = used_nozzle_idx;
return false; return false;
@ -3527,7 +3519,7 @@ void SelectMachineDialog::update_show_status()
//the nozzle type of preset and machine are different //the nozzle type of preset and machine are different
if (nozzle_nums > 1 && m_print_type == FROM_NORMAL) { if (nozzle_nums > 1 && m_print_type == FROM_NORMAL) {
if (!is_nozzle_data_valid(obj_->m_extder_data)) { if (!_is_nozzle_data_valid(obj_, obj_->m_extder_data)) {
show_status(PrintDialogStatus::PrintStatusNozzleDataInvalid); show_status(PrintDialogStatus::PrintStatusNozzleDataInvalid);
return; return;
} }
@ -3547,7 +3539,7 @@ void SelectMachineDialog::update_show_status()
{ {
int mismatch_nozzle_id = 0; int mismatch_nozzle_id = 0;
float nozzle_diameter = 0; float nozzle_diameter = 0;
if (!is_same_nozzle_diameters(nozzle_diameter, mismatch_nozzle_id)) if (!_is_same_nozzle_diameters(obj_, nozzle_diameter, mismatch_nozzle_id))
{ {
std::vector<wxString> msg_params; std::vector<wxString> msg_params;
if (obj_->m_extder_data.total_extder_count == 2) if (obj_->m_extder_data.total_extder_count == 2)

View File

@ -540,8 +540,6 @@ public:
bool can_support_auto_cali(); bool can_support_auto_cali();
bool is_same_printer_model(); bool is_same_printer_model();
bool is_blocking_printing(MachineObject* obj_); bool is_blocking_printing(MachineObject* obj_);
bool is_nozzle_data_valid(const ExtderData& ext_data) const;
bool is_same_nozzle_diameters(float& tag_nozzle_diameter, int& mismatch_nozzle_id) const;
bool is_nozzle_hrc_matched(const Extder& extruder, std::string& filament_type) const; bool is_nozzle_hrc_matched(const Extder& extruder, std::string& filament_type) const;
bool has_tips(MachineObject* obj); bool has_tips(MachineObject* obj);
bool is_timeout(); bool is_timeout();