Fix nozzle diameter guards for printers that don't report nozzle info (#13255)

Fix nozzle diameter guards for printers that don't report nozzle info (#13236)

PR #12814 changed DevNozzle::m_diameter default from 0.4f to 0.0f to
mean "unknown" when firmware doesn't push nozzle info, and guarded two
call sites in SelectMachine.cpp. PR #13330 introduced
DevExtderSystem::NozzleDiameterMatchesOrUnknown() and adopted it in
get_printer_preset / CalibUtils / CalibrationWizardPresetPage. A few
reachable sites were still left out and now report "mismatch" / fail
silently for every non-BBL printer (Klipper/Moonraker, RRF, Marlin,
etc.) that doesn't push BBL nozzle data.

The most visible symptom: the "Sync filament colors from AMS" button on
Moonraker printers with AMS/AFC silently does nothing, because
get_printer_preset() couldn't find a matching system preset (fixed in
#13330, but the lookup-string sites below kept the bug visible
elsewhere).

Apply NozzleDiameterMatchesOrUnknown at the two remaining comparison
sites:

  src/slic3r/GUI/Plater.cpp
    - file-load printer-mismatch dialog — don't prompt on every load
    - on_select_preset sync_extruder_list gate — skip 0.0 extruders

For the three filament-lookup string-builder sites, fall back to the
currently-selected printer preset's nozzle diameter so the dropdown
isn't empty when firmware hasn't reported a diameter:

  src/slic3r/GUI/AMSMaterialsSetting.cpp (Popup + on_select_filament)
  src/slic3r/GUI/CaliHistoryDialog.cpp (get_all_filaments)

Also remove the dead SyncAmsInfoDialog::is_same_nozzle_diameters method
surfaced while auditing the affected sites — it was introduced
2024-12-30 in commit ad79ed6d93 ("ENH:add SyncAmsInfoDialog",
cherry-picked from Bambu's internal branch) but a caller was never
wired up on the OrcaSlicer side. Dead since introduction.

Fixes #13236
Refs #12814 #13330

Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
Co-authored-by: SoftFever <softfeverever@gmail.com>
This commit is contained in:
Clifford
2026-05-27 08:41:15 -04:00
committed by GitHub
parent 957d3017b4
commit 04aa26da9a
5 changed files with 31 additions and 60 deletions

View File

@@ -6850,12 +6850,12 @@ std::vector<size_t> Plater::priv::load_files(const std::vector<fs::path>& input_
double preset_nozzle_diameter = 0.4;
const ConfigOption *opt = printer_preset.config.option("nozzle_diameter");
if (opt) preset_nozzle_diameter = static_cast<const ConfigOptionFloats *>(opt)->values[0];
float machine_nozzle_diameter = obj->GetExtderSystem()->GetNozzleDiameter(0);
std::string machine_type = obj->printer_type;
if (obj->is_support_upgrade_kit && obj->installed_upgrade_kit) machine_type = "C12";
if (printer_preset.get_current_printer_type(preset_bundle) != machine_type || !is_approx((float) preset_nozzle_diameter, machine_nozzle_diameter)) {
bool nozzle_mismatch = !obj->GetExtderSystem()->NozzleDiameterMatchesOrUnknown(0, (float) preset_nozzle_diameter);
if (printer_preset.get_current_printer_type(preset_bundle) != machine_type || nozzle_mismatch) {
Preset *machine_preset = get_printer_preset(obj);
if (machine_preset != nullptr) {
std::string printer_model = machine_preset->config.option<ConfigOptionString>("printer_model")->value;
@@ -9566,7 +9566,7 @@ void Plater::priv::on_select_preset(wxCommandEvent &evt)
const auto& extruders = obj->GetExtderSystem()->GetExtruders();
for (const DevExtder &extruder : extruders) {
if (!is_approx(extruder.GetNozzleDiameter(), float(preset_nozzle_diameter))) {
if (!obj->GetExtderSystem()->NozzleDiameterMatchesOrUnknown(extruder.GetExtId(), float(preset_nozzle_diameter))) {
same_nozzle_diameter = false;
}
}