From 599b0e09ebf87cd53039fa754020476b3009838d Mon Sep 17 00:00:00 2001 From: Azi Date: Tue, 7 Jan 2025 17:09:35 -0800 Subject: [PATCH] fixed a custom filament creation bug (#7965) fixed a bug with custom filament creation where orca doesnt recognize capitalized letter in 'Nozzle' in the printer name --- src/slic3r/GUI/CreatePresetsDialog.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/slic3r/GUI/CreatePresetsDialog.cpp b/src/slic3r/GUI/CreatePresetsDialog.cpp index 7c790f2959..b2ba961506 100644 --- a/src/slic3r/GUI/CreatePresetsDialog.cpp +++ b/src/slic3r/GUI/CreatePresetsDialog.cpp @@ -542,21 +542,24 @@ static char* read_json_file(const std::string &preset_path) } static std::string get_printer_nozzle_diameter(std::string printer_name) { + // Create a lowercase version of the printer_name for case-insensitive search + std::string printer_name_lower = printer_name; + std::transform(printer_name_lower.begin(), printer_name_lower.end(), printer_name_lower.begin(), ::tolower); - size_t index = printer_name.find(" nozzle)"); + size_t index = printer_name_lower.find(" nozzle)"); if (std::string::npos == index) { - size_t index = printer_name.find(" nozzle"); + size_t index = printer_name_lower.find(" nozzle"); if (std::string::npos == index) { return ""; } - std::string nozzle = printer_name.substr(0, index); + std::string nozzle = printer_name_lower.substr(0, index); size_t last_space_index = nozzle.find_last_of(" "); if (std::string::npos == index) { return ""; } return nozzle.substr(last_space_index + 1); } else { - std::string nozzle = printer_name.substr(0, index); + std::string nozzle = printer_name_lower.substr(0, index); size_t last_bracket_index = nozzle.find_last_of("("); if (std::string::npos == index) { return "";