From d5d3bab82e85075f2f9b9082713bc1a421566ef3 Mon Sep 17 00:00:00 2001 From: SoftFever Date: Wed, 18 Sep 2024 23:59:46 +0800 Subject: [PATCH] Fixed a bug that YOLO flow calibration didn't work for Fr/De languages --- src/slic3r/GUI/Plater.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/slic3r/GUI/Plater.cpp b/src/slic3r/GUI/Plater.cpp index 203ba175a..f607c8881 100644 --- a/src/slic3r/GUI/Plater.cpp +++ b/src/slic3r/GUI/Plater.cpp @@ -9722,7 +9722,17 @@ auto print_config = &wxGetApp().preset_bundle->prints.get_edited_preset().config obj_name = obj_name.substr(9); if (obj_name[0] == 'm') obj_name[0] = '-'; - auto modifier = stof(obj_name); + // Orca: force set locale to C to avoid parsing error + const std::string _loc = std::setlocale(LC_NUMERIC, nullptr); + std::setlocale(LC_NUMERIC,"C"); + auto modifier = 1.0f; + try { + modifier = stof(obj_name); + } catch (...) { + } + // restore locale + std::setlocale(LC_NUMERIC, _loc.c_str()); + if(linear) _obj->config.set_key_value("print_flow_ratio", new ConfigOptionFloat((cur_flowrate + modifier)/cur_flowrate)); else