Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/prusa3d/PrusaSlicer.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEnrico Turri <enricoturri@seznam.cz>2017-12-08 12:50:36 +0300
committerEnrico Turri <enricoturri@seznam.cz>2017-12-08 12:50:36 +0300
commit092d271fa2a01f94a54620fc688ca8fea6ea3af3 (patch)
tree4694487a3e7cd01e047be3fe70201319baff0324 /xs/src/libslic3r/GCode.cpp
parentbc3d184d7cd5853677caaa75827b3ae5c19d9331 (diff)
time estimator wip stage 2
Diffstat (limited to 'xs/src/libslic3r/GCode.cpp')
-rw-r--r--xs/src/libslic3r/GCode.cpp84
1 files changed, 5 insertions, 79 deletions
diff --git a/xs/src/libslic3r/GCode.cpp b/xs/src/libslic3r/GCode.cpp
index fad1e8ee2..8d8bf3e3e 100644
--- a/xs/src/libslic3r/GCode.cpp
+++ b/xs/src/libslic3r/GCode.cpp
@@ -7,9 +7,6 @@
//############################################################################################################
#include "GCodeTimeEstimator.hpp"
-#ifdef WIN32
-#include "enrico/wintimer.h"
-#endif // WIN32
//############################################################################################################
#include <algorithm>
@@ -383,83 +380,12 @@ bool GCode::do_export(Print *print, const char *path)
boost::nowide::remove(path_tmp.c_str());
//############################################################################################################
-#ifdef WIN32
- WinTimer timer;
- timer.Start();
-#endif // WIN32
-
- My_GCodeTimeEstimator timeEstimator;
- timeEstimator.parse_file(path);
-#ifdef WIN32
- double timeParse = timer.GetElapsedTimeSec();
-#endif // WIN32
- timeEstimator.calculate_time();
-#ifdef WIN32
- double timeCalculate = timer.GetElapsedTimeSec();
-#endif // WIN32
- std::cout << std::endl << ">>> estimated time: " << timeEstimator.get_time() << " seconds." << std::endl << std::endl;
-
-#ifdef WIN32
- std::cout << std::endl << "parse_file() -> Time: " << timeParse << std::endl << std::endl;
- std::cout << std::endl << "calculate_file() -> Time: " << timeCalculate - timeParse << std::endl << std::endl;
-#endif // WIN32
+ GCodeTimeEstimator timeEstimator;
+ timeEstimator.calculate_time_from_file(path);
+ float time = timeEstimator.get_time();
+ std::string timeHMS = timeEstimator.get_time_hms();
-/*
- unsigned int i = 0;
- const My_GCodeTimeEstimator::BlocksList& blocks = timeEstimator.get_blocks();
- float maxXYZ[3] = { 0.0f, 0.0f, 0.0f };
- unsigned int maxID[3] = { 0, 0, 0 };
- for (const My_GCodeTimeEstimator::Block& block : blocks)
- {
- ++i;
- std::cout << std::endl << "Block: "
- << i
- << " ("
- << block.delta_pos[My_GCodeTimeEstimator::X]
- << ", "
- << block.delta_pos[My_GCodeTimeEstimator::Y]
- << ", "
- << block.delta_pos[My_GCodeTimeEstimator::Z]
- << ") - f: "
- << block.feedrate
- << " - a: "
- << block.acceleration
- << " - s: ("
- << block.entry_feedrate
- << ", "
- << block.exit_feedrate
- << ")"
- << std::endl;
-
- float dx = ::abs(block.delta_pos[My_GCodeTimeEstimator::X]);
- float dy = ::abs(block.delta_pos[My_GCodeTimeEstimator::Y]);
- float dz = ::abs(block.delta_pos[My_GCodeTimeEstimator::Z]);
-
- if (maxXYZ[My_GCodeTimeEstimator::X] < dx)
- {
- maxXYZ[My_GCodeTimeEstimator::X] = dx;
- maxID[My_GCodeTimeEstimator::X] = i;
- }
-
- if (maxXYZ[My_GCodeTimeEstimator::Y] < dy)
- {
- maxXYZ[My_GCodeTimeEstimator::Y] = dy;
- maxID[My_GCodeTimeEstimator::Y] = i;
- }
-
- if (maxXYZ[My_GCodeTimeEstimator::Z] < dz)
- {
- maxXYZ[My_GCodeTimeEstimator::Z] = dz;
- maxID[My_GCodeTimeEstimator::Z] = i;
- }
- }
-
- std::cout << std::endl << "MAX DX: " << maxID[My_GCodeTimeEstimator::X] << " - " << maxXYZ[My_GCodeTimeEstimator::X] << std::endl;
- std::cout << std::endl << "MAX DY: " << maxID[My_GCodeTimeEstimator::Y] << " - " << maxXYZ[My_GCodeTimeEstimator::Y] << std::endl;
- std::cout << std::endl << "MAX DZ: " << maxID[My_GCodeTimeEstimator::Z] << " - " << maxXYZ[My_GCodeTimeEstimator::Z] << std::endl;
-
- timeEstimator.print_counters();
-*/
+ std::cout << std::endl << ">>> estimated time: " << timeHMS << " (" << time << " seconds)" << std::endl << std::endl;
//############################################################################################################
return result;