ENH: add nozzle initialization check
jira: none Change-Id: I9378295113c78c1775fa396d592501758d888182
This commit is contained in:
parent
21865dc055
commit
9c1d6b2067
|
@ -459,7 +459,7 @@ struct Sidebar::priv
|
|||
void jump_to_object(ObjectDataViewModelNode* item);
|
||||
void can_search();
|
||||
|
||||
void sync_extruder_list();
|
||||
bool sync_extruder_list();
|
||||
bool switch_diameter(bool single);
|
||||
void update_sync_status(const MachineObject* obj);
|
||||
|
||||
|
@ -1097,20 +1097,23 @@ bool Sidebar::priv::switch_diameter(bool single)
|
|||
return wxGetApp().get_tab(Preset::TYPE_PRINTER)->select_preset(preset->name);
|
||||
}
|
||||
|
||||
void Sidebar::priv::sync_extruder_list()
|
||||
bool Sidebar::priv::sync_extruder_list()
|
||||
{
|
||||
MachineObject *obj = wxGetApp().getDeviceManager()->get_selected_machine();
|
||||
if (obj == nullptr || !obj->is_info_ready()) {
|
||||
MessageDialog dlg(this->plater, _L("Please select a printer in 'Device' page first."), _L("Sync extruder infomation"), wxOK | wxICON_WARNING);
|
||||
dlg.ShowModal();
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
if (obj->m_extder_data.extders.size() != 2) {
|
||||
MessageDialog dlg(this->plater, _L("The currently connected printer does not have two extruders."), _L("Sync extruder infomation"), wxOK | wxICON_WARNING);
|
||||
dlg.ShowModal();
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!check_printer_initialized(obj))
|
||||
return false;
|
||||
|
||||
std::string machine_print_name = obj->printer_type;
|
||||
PresetBundle *preset_bundle = wxGetApp().preset_bundle;
|
||||
std::string target_model_id = preset_bundle->printers.get_selected_preset().get_printer_type(preset_bundle);
|
||||
|
@ -1119,11 +1122,11 @@ void Sidebar::priv::sync_extruder_list()
|
|||
MessageDialog dlg(this->plater, _L("The currently selected machine preset is inconsistent with the connected printer type.\n"
|
||||
"Are you sure to continue syncing?"), _L("Sync extruder infomation"), wxICON_WARNING | wxYES | wxNO);
|
||||
if (dlg.ShowModal() == wxID_NO) {
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!this->plater)
|
||||
return;
|
||||
return false;
|
||||
|
||||
this->plater->update_objects_position_when_select_preset([&obj, machine_preset]() {
|
||||
Tab *printer_tab = GUI::wxGetApp().get_tab(Preset::Type::TYPE_PRINTER);
|
||||
|
@ -1178,6 +1181,7 @@ void Sidebar::priv::sync_extruder_list()
|
|||
AMSCountPopupWindow::SetAMSCount(main_index, main_4, main_1);
|
||||
AMSCountPopupWindow::UpdateAMSCount(0, left_extruder);
|
||||
AMSCountPopupWindow::UpdateAMSCount(1, right_extruder);
|
||||
return true;
|
||||
}
|
||||
|
||||
void Sidebar::priv::update_sync_status(const MachineObject *obj)
|
||||
|
@ -2633,9 +2637,9 @@ std::map<int, DynamicPrintConfig> Sidebar::build_filament_ams_list(MachineObject
|
|||
return filament_ams_list;
|
||||
}
|
||||
|
||||
void Sidebar::sync_extruder_list()
|
||||
bool Sidebar::sync_extruder_list()
|
||||
{
|
||||
p->sync_extruder_list();
|
||||
return p->sync_extruder_list();
|
||||
}
|
||||
|
||||
void Sidebar::update_sync_status(const MachineObject *obj)
|
||||
|
@ -9161,9 +9165,10 @@ bool Plater::priv::check_ams_status_impl()
|
|||
} dlg(q);
|
||||
dlg.Fit();
|
||||
if (dlg.ShowModal() == wxID_YES) {
|
||||
GUI::wxGetApp().sidebar().sync_extruder_list();
|
||||
wxPostEvent(q, SimpleEvent(EVT_GLTOOLBAR_SLICE_PLATE));
|
||||
wxGetApp().mainframe->m_tabpanel->SetSelection(MainFrame::TabPosition::tpPreview);
|
||||
if (GUI::wxGetApp().sidebar().sync_extruder_list()) {
|
||||
wxPostEvent(q, SimpleEvent(EVT_GLTOOLBAR_SLICE_PLATE));
|
||||
wxGetApp().mainframe->m_tabpanel->SetSelection(MainFrame::TabPosition::tpPreview);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -12865,6 +12870,35 @@ Preset *get_printer_preset(MachineObject *obj)
|
|||
return printer_preset;
|
||||
}
|
||||
|
||||
bool check_printer_initialized(MachineObject *obj)
|
||||
{
|
||||
if (!obj)
|
||||
return false;
|
||||
|
||||
bool has_been_initialized = true;
|
||||
for (const Extder& extruder : obj->m_extder_data.extders) {
|
||||
if (extruder.current_nozzle_flow_type == NozzleFlowType::NONE_FLOWTYPE) {
|
||||
has_been_initialized = false;
|
||||
break;
|
||||
}
|
||||
if (extruder.current_nozzle_type == NozzleType::ntUndefine) {
|
||||
has_been_initialized = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!has_been_initialized) {
|
||||
MessageDialog dlg(wxGetApp().plater(), _L("It is detected that the nozzle type is not set. please set the nozzle first and then perform the current operation again."), _L("Warning"), wxOK | wxICON_WARNING);
|
||||
dlg.ShowModal();
|
||||
|
||||
PrinterPartsDialog* print_parts_dlg = new PrinterPartsDialog(nullptr);
|
||||
print_parts_dlg->update_machine_obj(obj);
|
||||
print_parts_dlg->ShowModal();
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// OK if fail_msg is empty
|
||||
std::string check_boolean_possible(const std::vector<const ModelVolume*>& volumes) {
|
||||
std::string fail_msg;
|
||||
|
|
|
@ -154,7 +154,7 @@ public:
|
|||
void load_ams_list(std::string const & device, MachineObject* obj);
|
||||
std::map<int, DynamicPrintConfig> build_filament_ams_list(MachineObject* obj);
|
||||
void sync_ams_list();
|
||||
void sync_extruder_list();
|
||||
bool sync_extruder_list();
|
||||
bool should_sync_extruder_list(MachineObject* obj);
|
||||
void update_sync_status(const MachineObject* obj);
|
||||
|
||||
|
@ -821,7 +821,9 @@ std::string check_boolean_possible(const std::vector<const ModelVolume*>& volume
|
|||
|
||||
Preset *get_printer_preset(MachineObject *obj);
|
||||
wxArrayString get_all_camera_view_type();
|
||||
} // namespace GUI
|
||||
|
||||
bool check_printer_initialized(MachineObject* obj);
|
||||
} // namespace GUI
|
||||
} // namespace Slic3r
|
||||
|
||||
#endif
|
||||
|
|
|
@ -163,7 +163,7 @@ static bool is_same_nozzle_type(const DynamicPrintConfig &full_config, const Mac
|
|||
if (abs(filament_nozzle_hrc) > abs(printer_nozzle_hrc)) {
|
||||
BOOST_LOG_TRIVIAL(info) << "filaments hardness mismatch: printer_nozzle_hrc = " << printer_nozzle_hrc << ", filament_nozzle_hrc = " << filament_nozzle_hrc;
|
||||
std::string filament_type = full_config.opt_string("filament_type", 0);
|
||||
error_msg = wxString::Format(_L("*Printing %s material with %s may cause nozzle damage"), filament_type, to_wstring_name(NozzleTypeEumnToStr[obj->m_extder_data.extders[0].current_nozzle_type]));
|
||||
error_msg = wxString::Format(_L("Printing %1s material with %2s nozzle may cause nozzle damage."), filament_type, to_wstring_name(NozzleTypeEumnToStr[obj->m_extder_data.extders[0].current_nozzle_type]));
|
||||
error_msg += "\n";
|
||||
|
||||
MessageDialog msg_dlg(nullptr, error_msg, wxEmptyString, wxICON_WARNING | wxOK | wxCANCEL);
|
||||
|
@ -195,8 +195,11 @@ static bool check_nozzle_diameter_and_type(const DynamicPrintConfig &full_config
|
|||
return false;
|
||||
}
|
||||
|
||||
if (!check_printer_initialized(obj))
|
||||
return false;
|
||||
|
||||
// P1P/S
|
||||
if (obj->m_extder_data.extders[0].current_nozzle_type = NozzleType::ntUndefine)
|
||||
if (obj->m_extder_data.extders[0].current_nozzle_type == NozzleType::ntUndefine)
|
||||
return true;
|
||||
|
||||
if (!is_same_nozzle_diameters(full_config, obj, error_msg))
|
||||
|
|
Loading…
Reference in New Issue