Skip to content

Commit 23165b8

Browse files
committed
fix Malformed command issue for Klipper
1 parent 5d1c36c commit 23165b8

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

src/libslic3r/GCode.cpp

+8-4
Original file line numberDiff line numberDiff line change
@@ -2662,12 +2662,16 @@ namespace Skirt {
26622662

26632663
} // namespace Skirt
26642664

2665-
inline std::string get_instance_name(const PrintObject *object, const PrintInstance &inst) {
2666-
return (boost::format("%1%_id_%2%_copy_%3%") % object->model_object()->name % object->get_id() % inst.id).str();
2665+
inline std::string get_instance_name(const PrintObject *object, size_t inst_id) {
2666+
auto obj_name = object->model_object()->name;
2667+
// replace space in obj_name with '-'
2668+
std::replace(obj_name.begin(), obj_name.end(), ' ', '_');
2669+
2670+
return (boost::format("%1%_id_%2%_copy_%3%") % obj_name % object->get_id() % inst_id).str();
26672671
}
26682672

2669-
inline std::string get_instance_name(const PrintObject *object, size_t inst_id) {
2670-
return (boost::format("%1%_id_%2%_copy_%3%") % object->model_object()->name % object->get_id() % inst_id).str();
2673+
inline std::string get_instance_name(const PrintObject *object, const PrintInstance &inst) {
2674+
return get_instance_name(object, inst.id);
26712675
}
26722676

26732677
// In sequential mode, process_layer is called once per each object and its copy,

0 commit comments

Comments
 (0)