FIX: export 3mf fail in creality machine

1. Add place holder support

github:#5557,#5614,#5471

Signed-off-by: xun.zhang <xun.zhang@bambulab.com>
Change-Id: I65e1d116b7af64ab15c3338f713fc3329b3e877d
This commit is contained in:
xun.zhang 2025-01-03 16:25:13 +08:00 committed by Lane.Wei
parent f5c79afd89
commit db1bbc967a
3 changed files with 5 additions and 1 deletions

View File

@ -2329,6 +2329,7 @@ void GCode::_do_export(Print& print, GCodeOutputStream &file, ThumbnailsGenerato
m_writer.extruders(),
// Modifies
print.m_print_statistics));
print.m_print_statistics.initial_tool = initial_extruder_id;
bool activate_air_filtration = false;
for (const auto& extruder : m_writer.extruders())

View File

@ -2557,6 +2557,7 @@ DynamicConfig PrintStatistics::config() const
config.set_key_value("total_weight", new ConfigOptionFloat(this->total_weight));
config.set_key_value("total_wipe_tower_cost", new ConfigOptionFloat(this->total_wipe_tower_cost));
config.set_key_value("total_wipe_tower_filament", new ConfigOptionFloat(this->total_wipe_tower_filament));
config.set_key_value("initial_tool", new ConfigOptionInt(static_cast<int>(this->initial_tool)));
return config;
}
@ -2566,7 +2567,7 @@ DynamicConfig PrintStatistics::placeholders()
for (const std::string &key : {
"print_time", "normal_print_time", "silent_print_time",
"used_filament", "extruded_volume", "total_cost", "total_weight",
"total_toolchanges", "total_wipe_tower_cost", "total_wipe_tower_filament"})
"intial_tool", "total_toolchanges", "total_wipe_tower_cost", "total_wipe_tower_filament"})
config.set_key_value(key, new ConfigOptionString(std::string("{") + key + "}"));
return config;
}

View File

@ -654,6 +654,7 @@ struct PrintStatistics
double total_weight;
double total_wipe_tower_cost;
double total_wipe_tower_filament;
unsigned int initial_tool;
std::map<size_t, double> filament_stats;
// Config with the filled in print statistics.
@ -671,6 +672,7 @@ struct PrintStatistics
total_weight = 0.;
total_wipe_tower_cost = 0.;
total_wipe_tower_filament = 0.;
initial_tool = 0;
filament_stats.clear();
}
};