NEW:added inspection of pla-glow material

jira:[none]

Change-Id: I1a62992e24665b83f54981e59edc1ba1fcda9a8a
(cherry picked from commit fa2fc22f3e648c0f0f485d1a7e701658693da457)
This commit is contained in:
tao wang 2025-02-17 19:43:28 +08:00 committed by Noisyfox
parent 72ac5dd093
commit 18ffc5497b
9 changed files with 43 additions and 161 deletions

View file

@ -2195,156 +2195,6 @@ void SyncAmsInfoDialog::show_errors(wxString &info)
confirm_dlg.on_show();
}
void SyncAmsInfoDialog::on_ok_btn(wxCommandEvent &event)
{
bool has_slice_warnings = false;
bool is_printing_block = false;
DeviceManager *dev = Slic3r::GUI::wxGetApp().getDeviceManager();
if (!dev) return;
MachineObject *obj_ = dev->get_selected_machine();
if (!obj_) return;
std::vector<ConfirmBeforeSendInfo> confirm_text;
confirm_text.push_back(ConfirmBeforeSendInfo(_L("Please check the following:")));
// Check Printer Model Id
bool is_same_printer_type = is_same_printer_model();
if (!is_same_printer_type && (m_print_type == PrintFromType::FROM_NORMAL)) {
confirm_text.push_back(ConfirmBeforeSendInfo(_L("The printer type selected when generating G-Code is not consistent with the currently selected printer. It is "
"recommended that you use the same printer type for slicing.")));
has_slice_warnings = true;
}
// check blacklist
for (auto i = 0; i < m_ams_mapping_result.size(); i++) {
auto tid = m_ams_mapping_result[i].tray_id;
std::string filament_type = boost::to_upper_copy(m_ams_mapping_result[i].type);
std::string filament_brand;
for (auto fs : m_filaments) {
if (fs.id == m_ams_mapping_result[i].id) { filament_brand = m_filaments[i].brand; }
}
bool in_blacklist = false;
std::string action;
std::string info;
DeviceManager::check_filaments_in_blacklist(filament_brand, filament_type, tid, in_blacklist, action, info);
if (in_blacklist && action == "warning") {
wxString prohibited_error = wxString::FromUTF8(info);
confirm_text.push_back(ConfirmBeforeSendInfo(prohibited_error));
has_slice_warnings = true;
}
}
PartPlate *plate = m_plater->get_partplate_list().get_curr_plate();
for (auto warning : plate->get_slice_result()->warnings) {
if (warning.msg == BED_TEMP_TOO_HIGH_THAN_FILAMENT) {
if ((obj_->get_printer_is_enclosed())) {
// confirm_text.push_back(Plater::get_slice_warning_string(warning) + "\n");
// has_slice_warnings = true;
}
} else if (warning.msg == NOT_SUPPORT_TRADITIONAL_TIMELAPSE) {
if (obj_->get_printer_arch() == PrinterArch::ARCH_I3 && (m_checkbox_list["timelapse"]->getValue() == "on")) {
confirm_text.push_back(ConfirmBeforeSendInfo(Plater::get_slice_warning_string(warning)));
has_slice_warnings = true;
}
} else if (warning.msg == NOT_GENERATE_TIMELAPSE) {
continue;
} else if (warning.msg == NOZZLE_HRC_CHECKER) {
wxString error_info = Plater::get_slice_warning_string(warning);
if (error_info.IsEmpty()) { error_info = wxString::Format("%s\n", warning.msg); }
confirm_text.push_back(ConfirmBeforeSendInfo(error_info));
has_slice_warnings = true;
}
}
// check for unidentified material
auto mapping_result = m_mapping_popup.parse_ams_mapping(obj_->amsList);
auto has_unknown_filament = false;
// check if ams mapping is has errors, tpu
bool has_prohibited_filament = false;
wxString prohibited_error = wxEmptyString;
for (auto i = 0; i < m_ams_mapping_result.size(); i++) {
auto tid = m_ams_mapping_result[i].tray_id;
std::string filament_type = boost::to_upper_copy(m_ams_mapping_result[i].type);
std::string filament_brand;
for (auto fs : m_filaments) {
if (fs.id == m_ams_mapping_result[i].id) { filament_brand = m_filaments[i].brand; }
}
bool in_blacklist = false;
std::string action;
std::string info;
DeviceManager::check_filaments_in_blacklist(filament_brand, filament_type, tid, in_blacklist, action, info);
if (in_blacklist && action == "prohibition") {
has_prohibited_filament = true;
prohibited_error = wxString::FromUTF8(info);
}
for (auto miter : mapping_result) {
// matching
if (miter.id == tid) {
if (miter.type == TrayType::THIRD || miter.type == TrayType::EMPTY) {
has_unknown_filament = true;
break;
}
}
}
}
if (has_prohibited_filament && obj_->has_ams() && (m_checkbox_list["use_ams"]->getValue() == "on")) {
wxString tpu_tips = prohibited_error;
BOOST_LOG_TRIVIAL(info)<<__FUNCTION__ << "print_job: on_ok to send";
return;
}
if (has_unknown_filament) {
has_slice_warnings = true;
confirm_text.push_back(ConfirmBeforeSendInfo(_L("There are some unknown filaments in the AMS mappings. Please check whether they are the required filaments. If they are "
"okay, press \"Confirm\" to start printing.")));
}
float nozzle_diameter;
std::string filament_type;
NozzleType tag_nozzle_type;
if (!obj_->m_extder_data.extders[0].current_nozzle_type == NozzleType::ntUndefine && (m_print_type == PrintFromType::FROM_NORMAL)) {
if (!is_same_nozzle_diameters(tag_nozzle_type, nozzle_diameter)) {
has_slice_warnings = true;
is_printing_block = true;
wxString nozzle_in_preset = wxString::Format(_L("nozzle in preset: %.1f %s"), nozzle_diameter, "");
wxString nozzle_in_printer = wxString::Format(_L("nozzle memorized: %.1f %s"), obj_->m_extder_data.extders[0].current_nozzle_diameter, "");
confirm_text.push_back(ConfirmBeforeSendInfo(_L("Your nozzle diameter in sliced file is not consistent with memorized nozzle. If you changed your nozzle lately, "
"please go to Device > Printer Parts to change settings.") +
"\n " + nozzle_in_preset + "\n " + nozzle_in_printer + "\n",
ConfirmBeforeSendInfo::InfoLevel::Warning));
}
if (!is_same_nozzle_type(filament_type, tag_nozzle_type)) {
has_slice_warnings = true;
is_printing_block = true;
nozzle_diameter = obj_->m_extder_data.extders[0].current_nozzle_diameter;
wxString nozzle_in_preset = wxString::Format(_L("Printing %1s material with %2s nozzle may cause nozzle damage."), filament_type,
format_steel_name(obj_->m_extder_data.extders[0].current_nozzle_type));
confirm_text.push_back(ConfirmBeforeSendInfo(nozzle_in_preset, ConfirmBeforeSendInfo::InfoLevel::Warning));
}
}
}
wxString SyncAmsInfoDialog::format_steel_name(NozzleType type)
{
if (type == NozzleType::ntHardenedSteel) {