Slicing warning when templates are sliced.

This commit is contained in:
David Kocik 2023-06-13 15:14:48 +02:00
parent 93bd11c533
commit 45ba32d29a

View File

@ -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: