mirror of
https://github.com/FULU-Foundation/OrcaSlicer-bambulab.git
synced 2026-05-14 13:02:39 -07:00
3mf import/export of config data
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user