From a7c0ab52f007849e44395d7dfdd2f2807df316b4 Mon Sep 17 00:00:00 2001 From: Ian Bassi Date: Wed, 22 Jul 2026 19:09:57 -0300 Subject: [PATCH] Treat nozzle diameter mismatch as a warning (#14890) --- src/slic3r/GUI/PrePrintChecker.cpp | 55 ++++++++++++++++++++++++++++++ src/slic3r/GUI/PrePrintChecker.hpp | 13 +++++-- src/slic3r/GUI/SelectMachine.cpp | 30 ++++++++++++++-- src/slic3r/GUI/SelectMachine.hpp | 7 ++++ 4 files changed, 100 insertions(+), 5 deletions(-) diff --git a/src/slic3r/GUI/PrePrintChecker.cpp b/src/slic3r/GUI/PrePrintChecker.cpp index c508fe60b6..0575af23ed 100644 --- a/src/slic3r/GUI/PrePrintChecker.cpp +++ b/src/slic3r/GUI/PrePrintChecker.cpp @@ -218,6 +218,49 @@ void PrePrintChecker::add_with_link(PrintDialogStatus state, wxString msg, wxStr } } +// Orca: acknowledgement-checkbox variant of add(); see add_with_link() for the shared classification. +void PrePrintChecker::add_with_checkbox(PrintDialogStatus state, wxString msg, wxString checkbox_label, bool checked, std::function checkbox_callback) +{ + prePrintInfo info; + + if (is_error(state)) { + info.level = prePrintInfoLevel::Error; + } else if (is_warning(state)) { + info.level = prePrintInfoLevel::Warning; + } else { + info.level = prePrintInfoLevel::Normal; + } + + if (is_error_printer(state)) { + info.type = prePrintInfoType::Printer; + } else if (is_error_filament(state)) { + info.type = prePrintInfoType::Filament; + } else if (is_warning_printer(state)) { + info.type = prePrintInfoType::Printer; + } else if (is_warning_filament(state)) { + info.type = prePrintInfoType::Filament; + } + + info.msg = msg; + info.checkbox_label = checkbox_label; + info.checkbox_checked = checked; + info.checkbox_callback = checkbox_callback; + + switch (info.type) { + case prePrintInfoType::Filament: + if (std::find(filamentList.begin(), filamentList.end(), info) == filamentList.end()) { + filamentList.push_back(info); + } + break; + case prePrintInfoType::Printer: + if (std::find(printerList.begin(), printerList.end(), info) == printerList.end()) { + printerList.push_back(info); + } + break; + default: break; + } +} + //void PrePrintMsgBoard::add(const wxString &msg, const wxString &tips, bool is_error) //{ @@ -310,6 +353,18 @@ bool PrinterMsgPanel::UpdateInfos(const std::vector& infos) label->Show(); m_sizer->Add(label, 0, wxBOTTOM, FromDIP(4)); } + + // Orca: acknowledgement checkbox rendered beneath the message (e.g. a nozzle diameter that + // differs from the one the printer remembers, which the user may legitimately override). + if (!info.checkbox_label.empty()) + { + wxCheckBox* checkbox = new wxCheckBox(this, wxID_ANY, info.checkbox_label); + checkbox->SetForegroundColour(_GetLabelColour(info)); + checkbox->SetValue(info.checkbox_checked); + auto cb = info.checkbox_callback; + checkbox->Bind(wxEVT_CHECKBOX, [cb](wxCommandEvent& e) { if (cb) cb(e.IsChecked()); }); + m_sizer->Add(checkbox, 0, wxBOTTOM, FromDIP(4)); + } } this->Show(); diff --git a/src/slic3r/GUI/PrePrintChecker.hpp b/src/slic3r/GUI/PrePrintChecker.hpp index 26fed443ee..f629b70a73 100644 --- a/src/slic3r/GUI/PrePrintChecker.hpp +++ b/src/slic3r/GUI/PrePrintChecker.hpp @@ -26,6 +26,9 @@ struct prePrintInfo wxString wiki_url; wxString link_label; // optional: clickable text appended after msg std::function link_callback; // optional: internal action for link_label click + wxString checkbox_label; // optional: an acknowledgement checkbox under msg + bool checkbox_checked{false}; + std::function checkbox_callback; // called with the new state on toggle int index{0}; public: @@ -33,8 +36,9 @@ public: return level == other.level && type == other.type && msg == other.msg && tips == other.tips && wiki_url == other.wiki_url && link_label == other.link_label && + checkbox_label == other.checkbox_label && checkbox_checked == other.checkbox_checked && index == other.index; - // link_callback excluded: std::function is not comparable + // link_callback / checkbox_callback excluded: std::function is not comparable } }; @@ -59,7 +63,6 @@ enum PrintDialogStatus : unsigned int { PrintStatusInPrinting, PrintStatusNozzleMatchInvalid, PrintStatusNozzleDataInvalid, - PrintStatusNozzleDiameterMismatch, PrintStatusNozzleTypeMismatch, PrintStatusNozzleNoMatchedHotends, PrintStatusNozzleRackMaximumInstalled, @@ -106,6 +109,9 @@ enum PrintDialogStatus : unsigned int { PrintStatusFilaSwitcherSlicingNotMatch, PrintStatusRackNozzleNumUnmeetWarning, PrintStatusHasUnreliableNozzleWarning, + // Orca: a nozzle diameter that differs from the one the printer remembers is a warning, + // not an error, so non-standard nozzles can still be printed with. + PrintStatusNozzleDiameterMismatch, PrintStatusPrinterWarningEnd, // Warnings for filament @@ -159,6 +165,9 @@ public: void add(PrintDialogStatus state, wxString msg, wxString tip, const wxString& wiki_url); // Orca: minimal callback-link render path instead of the full style-bitmask machinery. void add_with_link(PrintDialogStatus state, wxString msg, wxString link_label, std::function link_callback); + // Orca: render msg with an acknowledgement checkbox beneath it, for an overridable warning that + // the user must tick before proceeding (checkbox_callback reports the new state). + void add_with_checkbox(PrintDialogStatus state, wxString msg, wxString checkbox_label, bool checked, std::function checkbox_callback); static ::std::string get_print_status_info(PrintDialogStatus status); wxString get_pre_state_msg(PrintDialogStatus status); diff --git a/src/slic3r/GUI/SelectMachine.cpp b/src/slic3r/GUI/SelectMachine.cpp index 3464f70004..d6ab50c1a4 100644 --- a/src/slic3r/GUI/SelectMachine.cpp +++ b/src/slic3r/GUI/SelectMachine.cpp @@ -2269,8 +2269,11 @@ void SelectMachineDialog::show_status(PrintDialogStatus status, std::vector Printer parts' to change your nozzle setting.")); + + // Orca: non-blocking. A diameter that differs from the one the printer + // remembers is legitimate with a non-standard nozzle, so the print is held back + // only by the acknowledgement checkbox shown in the message board, not by a + // disabled Send outright. Keep checking the remaining extruders. + m_nozzle_diameter_mismatch_msg = msg_params.front(); show_status(PrintDialogStatus::PrintStatusNozzleDiameterMismatch, msg_params); - return false; + continue; } } } @@ -4608,6 +4629,9 @@ static wxString _get_ext_loc_str(const std::unordered_set& extruders, int t void SelectMachineDialog::update_show_status(MachineObject* obj_) { m_pre_print_checker.clear(); + // Orca: re-raised by CheckErrorExtruderNozzleWithSlicing() below if the mismatch is still there, + // so an early return from this pass cannot leave a stale warning behind. + m_nozzle_diameter_mismatch_msg.clear(); /*agent check and printer valid check*/ NetworkAgent* agent = Slic3r::GUI::wxGetApp().getAgent(); diff --git a/src/slic3r/GUI/SelectMachine.hpp b/src/slic3r/GUI/SelectMachine.hpp index 19eef2de2c..fd326f7c85 100644 --- a/src/slic3r/GUI/SelectMachine.hpp +++ b/src/slic3r/GUI/SelectMachine.hpp @@ -550,6 +550,13 @@ public: // Compare the slicing file's nozzle requirements (validity, flow, diameter) against the // printer; the rack extruder is checked against its whole inventory (mounted + rack). bool CheckErrorExtruderNozzleWithSlicing(MachineObject* obj_);//return true if no errors + // Orca: a nozzle diameter differing from the one the printer remembers is a non-blocking + // warning shown in the message board with an acknowledgement checkbox; Send stays disabled + // until the user ticks it. m_nozzle_diameter_mismatch_msg is the current mismatch text (empty + // when there is none), m_nozzle_diameter_ack_msg the text the user acknowledged; Send is + // allowed only while the two match, so a changed or cleared mismatch re-requires acknowledgement. + wxString m_nozzle_diameter_mismatch_msg; + wxString m_nozzle_diameter_ack_msg; // Warn (without blocking) when a mapped filament would be printed from both extruders on a // dual-extruder printer, so per-nozzle manual K-value can't follow it across the whole print. bool CheckWarningFilamentCrossExtruder(MachineObject* obj_);