mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-07-25 11:52:05 +00:00
ENH: add cost info when loading GCode file
Add total cost infomation when loading Gcode file jira:STUDIO-4353 Signed-off-by: xun.zhang <xun.zhang@bambulab.com> Change-Id: I930cb141e2a0b3cf328515f6543707c8bd5d620a
This commit is contained in:
@@ -9027,6 +9027,20 @@ void Plater::load_gcode(const wxString& filename)
|
||||
|
||||
current_print.apply(this->model(), wxGetApp().preset_bundle->full_config());
|
||||
|
||||
//BBS: add cost info when drag in gcode
|
||||
auto& ps = current_result->print_statistics;
|
||||
double total_cost = 0.0;
|
||||
for (auto& volumes_map : { ps.volumes_per_extruder,ps.flush_per_filament ,ps.wipe_tower_volumes_per_extruder }) {
|
||||
for (auto volume : volumes_map) {
|
||||
size_t extruder_id = volume.first;
|
||||
double density = current_result->filament_densities.at(extruder_id);
|
||||
double cost = current_result->filament_costs.at(extruder_id);
|
||||
double weight = volume.second * density * 0.001;
|
||||
total_cost += weight * cost * 0.001;
|
||||
}
|
||||
}
|
||||
current_print.print_statistics().total_cost = total_cost;
|
||||
|
||||
current_print.set_gcode_file_ready();
|
||||
|
||||
// show results
|
||||
|
||||
Reference in New Issue
Block a user