Skip to content

Commit

Permalink
Added All Plates Stats Total Cost #1781 (#2238)
Browse files Browse the repository at this point in the history
Co-authored-by: SoftFever <[email protected]>
  • Loading branch information
niklasb22 and SoftFever authored Sep 27, 2023
1 parent 3433e7b commit 0e785c0
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions src/slic3r/GUI/GCodeViewer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4185,6 +4185,7 @@ void GCodeViewer::render_all_plates_stats(const std::vector<const GCodeProcessor
std::vector<double> flushed_filaments_m_all_plates;
std::vector<double> flushed_filaments_g_all_plates;
float total_time_all_plates = 0.0f;
float total_cost_all_plates = 0.0f;
bool show_detailed_statistics_page = false;

auto max_width = [](const std::vector<std::string>& items, const std::string& title, float extra_size = 0.0f) {
Expand Down Expand Up @@ -4278,8 +4279,12 @@ void GCodeViewer::render_all_plates_stats(const std::vector<const GCodeProcessor
}
const PrintEstimatedStatistics::Mode& plate_time_mode = plate_print_statistics.modes[static_cast<size_t>(m_time_estimate_mode)];
total_time_all_plates += plate_time_mode.time;

Print *print;
plate->get_print((PrintBase **) &print, nullptr, nullptr);
total_cost_all_plates += print->print_statistics().total_cost;
}

for (auto it = volume_of_extruders_all_plates.begin(); it != volume_of_extruders_all_plates.end(); it++) {
auto [model_used_filament_m, model_used_filament_g] = get_used_filament_from_volume(it->second, it->first);
model_used_filaments_m_all_plates.push_back(model_used_filament_m);
Expand Down Expand Up @@ -4342,13 +4347,21 @@ void GCodeViewer::render_all_plates_stats(const std::vector<const GCodeProcessor
ImGui::Dummy(ImVec2(0.0f, ImGui::GetFontSize() * 0.1));
ImGui::Dummy({ window_padding, window_padding });
ImGui::SameLine();
imgui.title(_u8L("Total Time Estimation"));
imgui.title(_u8L("Total Estimation"));

ImGui::Dummy({ window_padding, window_padding });
ImGui::SameLine();
imgui.text(_u8L("Total time") + ":");
ImGui::SameLine();
imgui.text(short_time(get_time_dhms(total_time_all_plates)));

ImGui::Dummy({ window_padding, window_padding });
ImGui::SameLine();
imgui.text(_u8L("Total cost") + ":");
ImGui::SameLine();
char buf[64];
::sprintf(buf, "%.2f", total_cost_all_plates);
imgui.text(buf);
}
ImGui::End();
ImGui::PopStyleColor(6);
Expand Down

0 comments on commit 0e785c0

Please sign in to comment.