diff options
Diffstat (limited to 'xs/src/libslic3r/GCode.cpp')
-rw-r--r-- | xs/src/libslic3r/GCode.cpp | 29 |
1 files changed, 22 insertions, 7 deletions
diff --git a/xs/src/libslic3r/GCode.cpp b/xs/src/libslic3r/GCode.cpp index d22040799..d42a61290 100644 --- a/xs/src/libslic3r/GCode.cpp +++ b/xs/src/libslic3r/GCode.cpp @@ -802,13 +802,10 @@ void GCode::_do_export(Print &print, FILE *file) // Append full config. _write(file, "\n"); { - StaticPrintConfig *configs[] = { &print.config, &print.default_object_config, &print.default_region_config }; - for (size_t i = 0; i < sizeof(configs) / sizeof(configs[0]); ++ i) { - StaticPrintConfig *cfg = configs[i]; - for (const std::string &key : cfg->keys()) - if (key != "compatible_printers") - _write_format(file, "; %s = %s\n", key.c_str(), cfg->serialize(key).c_str()); - } + std::string full_config = ""; + append_full_config(print, full_config); + if (!full_config.empty()) + _write(file, full_config); } } @@ -1372,6 +1369,24 @@ void GCode::apply_print_config(const PrintConfig &print_config) m_config.apply(print_config); } +void GCode::append_full_config(const Print& print, std::string& str) +{ + char buff[1024]; + + const StaticPrintConfig *configs[] = { &print.config, &print.default_object_config, &print.default_region_config }; + for (size_t i = 0; i < sizeof(configs) / sizeof(configs[0]); ++i) { + const StaticPrintConfig *cfg = configs[i]; + for (const std::string &key : cfg->keys()) + { + if (key != "compatible_printers") + { + sprintf(buff, "; %s = %s\n", key.c_str(), cfg->serialize(key).c_str()); + str += buff; + } + } + } +} + void GCode::set_extruders(const std::vector<unsigned int> &extruder_ids) { m_writer.set_extruders(extruder_ids); |