mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-11 16:57:53 -06:00
GCodeViewer -> Added imgui dialog for estimated printing times
This commit is contained in:
parent
2a78799f7e
commit
73b885fc37
17 changed files with 438 additions and 183 deletions
|
@ -678,6 +678,21 @@ namespace Slic3r {
|
|||
return _get_time_minutes(get_time());
|
||||
}
|
||||
|
||||
#if ENABLE_GCODE_VIEWER
|
||||
std::vector<std::pair<CustomGCode::Type, std::pair<float, float>>> GCodeTimeEstimator::get_custom_gcode_times(bool include_remaining) const
|
||||
{
|
||||
std::vector<std::pair<CustomGCode::Type, std::pair<float, float>>> ret;
|
||||
|
||||
float total_time = 0.0f;
|
||||
for (const auto& [type, time] : m_custom_gcode_times) {
|
||||
float remaining = include_remaining ? m_time - total_time : 0.0f;
|
||||
ret.push_back({ type, { time, remaining } });
|
||||
total_time += time;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
#else
|
||||
std::vector<std::pair<CustomGCode::Type, float>> GCodeTimeEstimator::get_custom_gcode_times() const
|
||||
{
|
||||
return m_custom_gcode_times;
|
||||
|
@ -721,7 +736,24 @@ namespace Slic3r {
|
|||
}
|
||||
return ret;
|
||||
}
|
||||
#endif // ENABLE_GCODE_VIEWER
|
||||
|
||||
#if ENABLE_GCODE_VIEWER
|
||||
std::vector<std::pair<CustomGCode::Type, std::pair<std::string, std::string>>> GCodeTimeEstimator::get_custom_gcode_times_dhm(bool include_remaining) const
|
||||
{
|
||||
std::vector<std::pair<CustomGCode::Type, std::pair<std::string, std::string>>> ret;
|
||||
|
||||
float total_time = 0.0f;
|
||||
for (const auto& [type, time] : m_custom_gcode_times) {
|
||||
std::string duration = _get_time_dhm(time);
|
||||
std::string remaining = include_remaining ? _get_time_dhm(m_time - total_time) : "";
|
||||
ret.push_back({ type, { duration, remaining } });
|
||||
total_time += time;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
#else
|
||||
std::vector<std::pair<CustomGCode::Type, std::string>> GCodeTimeEstimator::get_custom_gcode_times_dhm(bool include_remaining) const
|
||||
{
|
||||
std::vector<std::pair<CustomGCode::Type, std::string>> ret;
|
||||
|
@ -742,6 +774,7 @@ namespace Slic3r {
|
|||
|
||||
return ret;
|
||||
}
|
||||
#endif // ENABLE_GCODE_VIEWER
|
||||
|
||||
// Return an estimate of the memory consumed by the time estimator.
|
||||
size_t GCodeTimeEstimator::memory_used() const
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue