This commit is contained in:
QIDI TECH
2024-12-13 16:14:37 +08:00
parent 4baf9e41c5
commit 1c5fda6cad
34 changed files with 30 additions and 27 deletions

View File

@@ -3017,8 +3017,10 @@ namespace Skirt {
inline std::string get_instance_name(const PrintObject* object, size_t inst_id) {
auto obj_name = object->model_object()->name;
// replace space in obj_name with '-'
std::replace(obj_name.begin(), obj_name.end(), ' ', '_');
// replace special char in obj_name with '-'
const std::string banned = "\b\t\n\v\f\r \"#%&\'*-./:;<>\\";
std::replace_if(obj_name.begin(), obj_name.end(), [&banned](char c) { return banned.find(c) != std::string::npos; }, '_');
return (boost::format("%1%_id_%2%_copy_%3%") % obj_name % object->get_klipper_object_id() % inst_id).str();
}