From 45ba32d29ad9509064e7c7501989ef7e9e305170 Mon Sep 17 00:00:00 2001 From: David Kocik Date: Tue, 13 Jun 2023 15:14:48 +0200 Subject: [PATCH] Slicing warning when templates are sliced. --- src/slic3r/GUI/Plater.cpp | 34 ++++++++++++++++++++++++++++++---- 1 file changed, 30 insertions(+), 4 deletions(-) diff --git a/src/slic3r/GUI/Plater.cpp b/src/slic3r/GUI/Plater.cpp index b5bf2e99f..e6c7a33de 100644 --- a/src/slic3r/GUI/Plater.cpp +++ b/src/slic3r/GUI/Plater.cpp @@ -3430,7 +3430,7 @@ bool Plater::priv::restart_background_process(unsigned int state) void Plater::priv::export_gcode(fs::path output_path, bool output_path_on_removable_media, PrintHostJob upload_job) { wxCHECK_RET(!(output_path.empty() && upload_job.empty()), "export_gcode: output_path and upload_job empty"); - + if (model.objects.empty()) return; @@ -4082,11 +4082,37 @@ void Plater::priv::on_slicing_update(SlicingStatusEvent &evt) // Avoid a race condition return; } - -// this->statusbar()->set_progress(evt.status.percent); -// this->statusbar()->set_status_text(_(evt.status.text) + wxString::FromUTF8("…")); notification_manager->set_slicing_progress_percentage(evt.status.text, (float)evt.status.percent / 100.0f); } + + // Check template filaments and add warning + // This is more convinient to do here than in slicing backend, so it happens on "Slicing complete". + if (evt.status.percent >= 100 && this->printer_technology == ptFFF) { + size_t templ_cnt = 0; + const auto& preset_bundle = wxGetApp().preset_bundle; + std::string names; + for (const auto& extruder_filaments : preset_bundle->extruders_filaments) { + const Preset* preset = extruder_filaments.get_selected_preset(); + if (preset && preset->vendor && preset->vendor->templates_profile) { + names += "\n" + preset->name; + templ_cnt++; + } + } + if (templ_cnt > 0) { + const std::string message_notif = GUI::format("%1%\n%2%\n%3%" + , _L_PLURAL("You are using template filament preset.", "You are using template filament presets.", templ_cnt) + , _u8L("Please note that template presets are not customized for specific printer and should only be used as a starting point for creating your own user presets.") + , names); + // warning dialog proccessing cuts text at first '/n' - pass the text without new lines (and without filament names). + const std::string message_dial = GUI::format("%1% %2%" + , _L_PLURAL("You are using template filament preset.", "You are using template filament presets.", templ_cnt) + , _u8L("Please note that template presets are not customized for specific printer and should only be used as a starting point for creating your own user presets.")); + BOOST_LOG_TRIVIAL(warning) << message_notif; + notification_manager->push_slicing_warning_notification(message_notif, false, 0, 0); + add_warning({ PrintStateBase::WarningLevel::CRITICAL, true, message_dial, 0}, 0); + } + } + if (evt.status.flags & (PrintBase::SlicingStatus::RELOAD_SCENE | PrintBase::SlicingStatus::RELOAD_SLA_SUPPORT_POINTS)) { switch (this->printer_technology) { case ptFFF: