diff --git a/xs/src/libslic3r/GCode.cpp b/xs/src/libslic3r/GCode.cpp index 8e0862cf2f..f0b37ade32 100644 --- a/xs/src/libslic3r/GCode.cpp +++ b/xs/src/libslic3r/GCode.cpp @@ -863,9 +863,9 @@ void GCode::_do_export(Print &print, FILE *file, GCodePreviewData *preview_data) _write(file, m_writer.postamble()); // calculates estimated printing time - m_normal_time_estimator.calculate_time(); + m_normal_time_estimator.calculate_time(false); if (m_silent_time_estimator_enabled) - m_silent_time_estimator.calculate_time(); + m_silent_time_estimator.calculate_time(false); // Get filament stats. print.filament_stats.clear(); diff --git a/xs/src/libslic3r/GCodeTimeEstimator.cpp b/xs/src/libslic3r/GCodeTimeEstimator.cpp index 7c8540e668..2b4d89b3d7 100644 --- a/xs/src/libslic3r/GCodeTimeEstimator.cpp +++ b/xs/src/libslic3r/GCodeTimeEstimator.cpp @@ -196,11 +196,14 @@ namespace Slic3r { } } - void GCodeTimeEstimator::calculate_time() + void GCodeTimeEstimator::calculate_time(bool start_from_beginning) { PROFILE_FUNC(); - _reset_time(); - _set_blocks_st_synchronize(false); + if (start_from_beginning) + { + _reset_time(); + _set_blocks_st_synchronize(false); + } _calculate_time(); #if ENABLE_MOVE_STATS diff --git a/xs/src/libslic3r/GCodeTimeEstimator.hpp b/xs/src/libslic3r/GCodeTimeEstimator.hpp index fe678884a7..7e0cb4442e 100644 --- a/xs/src/libslic3r/GCodeTimeEstimator.hpp +++ b/xs/src/libslic3r/GCodeTimeEstimator.hpp @@ -227,7 +227,10 @@ namespace Slic3r { void add_gcode_block(const std::string &str) { this->add_gcode_block(str.c_str()); } // Calculates the time estimate from the gcode lines added using add_gcode_line() or add_gcode_block() - void calculate_time(); + // start_from_beginning: + // if set to true all blocks will be used to calculate the time estimate, + // if set to false only the blocks not yet processed will be used and the calculated time will be added to the current calculated time + void calculate_time(bool start_from_beginning); // Calculates the time estimate from the given gcode in string format void calculate_time_from_text(const std::string& gcode);