Adding new step for statistics

This commit is contained in:
tamasmeszaros 2019-03-26 18:04:04 +01:00
parent c8291c6e52
commit 34094bf1b8
2 changed files with 17 additions and 5 deletions

View file

@ -60,12 +60,14 @@ const std::array<std::string, slaposCount> OBJ_STEP_LABELS =
// Should also add up to 100 (%) // Should also add up to 100 (%)
const std::array<unsigned, slapsCount> PRINT_STEP_LEVELS = const std::array<unsigned, slapsCount> PRINT_STEP_LEVELS =
{ {
80, // slapsRasterize 5, // slapsStats
20, // slapsValidate 94, // slapsRasterize
1, // slapsValidate
}; };
const std::array<std::string, slapsCount> PRINT_STEP_LABELS = const std::array<std::string, slapsCount> PRINT_STEP_LABELS =
{ {
L("Calculating statistics"), // slapsStats
L("Rasterizing layers"), // slapsRasterize L("Rasterizing layers"), // slapsRasterize
L("Validating"), // slapsValidate L("Validating"), // slapsValidate
}; };
@ -913,6 +915,16 @@ void SLAPrint::process()
report_status(*this, -2, "", SlicingStatus::RELOAD_SLA_PREVIEW); report_status(*this, -2, "", SlicingStatus::RELOAD_SLA_PREVIEW);
}; };
auto fillstats = [this]() {
m_print_statistics.clear();
// Fill statistics
fill_statistics();
report_status(*this, -2, "", SlicingStatus::RELOAD_SLA_PREVIEW);
};
// Rasterizing the model objects, and their supports // Rasterizing the model objects, and their supports
auto rasterize = [this, max_objstatus, ilhs]() { auto rasterize = [this, max_objstatus, ilhs]() {
if(canceled()) return; if(canceled()) return;
@ -1050,8 +1062,6 @@ void SLAPrint::process()
// Print all the layers in parallel // Print all the layers in parallel
tbb::parallel_for<unsigned, decltype(lvlfn)>(0, lvlcnt, lvlfn); tbb::parallel_for<unsigned, decltype(lvlfn)>(0, lvlcnt, lvlfn);
// Fill statistics
this->fill_statistics();
// Set statistics values to the printer // Set statistics values to the printer
m_printer->set_statistics({(m_print_statistics.objects_used_material + m_print_statistics.support_used_material)/1000, m_printer->set_statistics({(m_print_statistics.objects_used_material + m_print_statistics.support_used_material)/1000,
double(m_default_object_config.faded_layers.getInt()), double(m_default_object_config.faded_layers.getInt()),
@ -1075,6 +1085,7 @@ void SLAPrint::process()
std::array<slapsFn, slapsCount> print_program = std::array<slapsFn, slapsCount> print_program =
{ {
fillstats,
rasterize, rasterize,
[](){} // validate [](){} // validate
}; };
@ -1116,7 +1127,7 @@ void SLAPrint::process()
} }
std::array<SLAPrintStep, slapsCount> printsteps = { std::array<SLAPrintStep, slapsCount> printsteps = {
slapsRasterize, slapsValidate slapsStats, slapsRasterize, slapsValidate
}; };
// this would disable the rasterization step // this would disable the rasterization step

View file

@ -11,6 +11,7 @@
namespace Slic3r { namespace Slic3r {
enum SLAPrintStep : unsigned int { enum SLAPrintStep : unsigned int {
slapsStats,
slapsRasterize, slapsRasterize,
slapsValidate, slapsValidate,
slapsCount slapsCount