FIX: the nozzle data check
jira: [STUDIO-10528] Change-Id: I5a20d52a92f4e6620239753a66fb5febcad19f39
This commit is contained in:
parent
750673b7f7
commit
679ec788e5
|
@ -6193,16 +6193,16 @@ void MachineObject::parse_new_info(json print)
|
|||
|
||||
bool MachineObject::is_nozzle_data_invalid()
|
||||
{
|
||||
if (m_extder_data.extders.size() < m_extder_data.current_extder_id) { return false; }
|
||||
|
||||
if (m_extder_data.extders.size() != m_extder_data.total_extder_count) { return false; }
|
||||
|
||||
if (m_extder_data.extders[m_extder_data.current_extder_id].current_nozzle_type == NozzleType::ntUndefine ||
|
||||
m_extder_data.extders[m_extder_data.current_extder_id].current_nozzle_diameter <= 0.0f ||
|
||||
m_extder_data.extders[m_extder_data.current_extder_id].current_nozzle_flow_type == NozzleFlowType::NONE_FLOWTYPE) {
|
||||
return false;
|
||||
for (const auto &ext : m_extder_data.extders)
|
||||
{
|
||||
if (ext.current_nozzle_type == NozzleType::ntUndefine ||
|
||||
ext.current_nozzle_diameter <= 0.0f ||
|
||||
ext.current_nozzle_flow_type == NozzleFlowType::NONE_FLOWTYPE) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
int MachineObject::get_flag_bits(std::string str, int start, int count)
|
||||
|
|
|
@ -1977,6 +1977,35 @@ bool SelectMachineDialog::is_blocking_printing(MachineObject* obj_)
|
|||
return false;
|
||||
}
|
||||
|
||||
bool SelectMachineDialog::is_nozzle_data_valid(const ExtderData &ext_data) const
|
||||
{
|
||||
DeviceManager *dev = Slic3r::GUI::wxGetApp().getDeviceManager();
|
||||
if (!dev) return false;
|
||||
|
||||
MachineObject *obj_ = dev->get_selected_machine();
|
||||
if (obj_ == nullptr) return false;
|
||||
|
||||
PresetBundle *preset_bundle = wxGetApp().preset_bundle;
|
||||
|
||||
try {
|
||||
PartPlate *cur_plate = wxGetApp().plater()->get_partplate_list().get_curr_plate();
|
||||
auto used_filament_idxs = cur_plate->get_used_filaments(); /*the index is started from 1*/
|
||||
for (int used_filament_idx : used_filament_idxs)
|
||||
{
|
||||
int used_nozzle_idx = cur_plate->get_physical_extruder_by_filament_id(preset_bundle->full_config(), used_filament_idx);
|
||||
if (ext_data.extders[used_nozzle_idx].current_nozzle_type == NozzleType::ntUndefine ||
|
||||
ext_data.extders[used_nozzle_idx].current_nozzle_diameter <= 0.0f ||
|
||||
ext_data.extders[used_nozzle_idx].current_nozzle_flow_type == NozzleFlowType::NONE_FLOWTYPE) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
} catch (const std::exception &) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/**************************************************************//*
|
||||
* @param tag_nozzle_type -- return the mismatch nozzle type
|
||||
|
@ -3353,7 +3382,7 @@ void SelectMachineDialog::update_show_status()
|
|||
|
||||
//the nozzle type of preset and machine are different
|
||||
if (nozzle_nums > 1 && m_print_type == FROM_NORMAL) {
|
||||
if (!obj_->is_nozzle_data_invalid()) {
|
||||
if (!is_nozzle_data_valid(obj_->m_extder_data)) {
|
||||
show_status(PrintDialogStatus::PrintStatusNozzleDataInvalid);
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -483,6 +483,7 @@ public:
|
|||
void update_timelapse_enable_status();
|
||||
bool is_same_printer_model();
|
||||
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_same_nozzle_type(const Extder& extruder, std::string& filament_type) const;
|
||||
bool has_tips(MachineObject* obj);
|
||||
|
|
|
@ -2760,7 +2760,7 @@ void SyncAmsInfoDialog::update_show_status()
|
|||
|
||||
// the nozzle type of preset and machine are different
|
||||
if (nozzle_nums > 1) {
|
||||
if (!obj_->is_nozzle_data_invalid()) {
|
||||
if (obj_->is_nozzle_data_invalid()) {
|
||||
show_status(PrintDialogStatus::PrintStatusNozzleDataInvalid);
|
||||
return;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue