From 34094bf1b8084d2791f439e7ce037af80e3ae3c1 Mon Sep 17 00:00:00 2001 From: tamasmeszaros Date: Tue, 26 Mar 2019 18:04:04 +0100 Subject: [PATCH] Adding new step for statistics --- src/libslic3r/SLAPrint.cpp | 21 ++++++++++++++++----- src/libslic3r/SLAPrint.hpp | 1 + 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/src/libslic3r/SLAPrint.cpp b/src/libslic3r/SLAPrint.cpp index 5ecb7c1d9..ee24cf3ec 100644 --- a/src/libslic3r/SLAPrint.cpp +++ b/src/libslic3r/SLAPrint.cpp @@ -60,12 +60,14 @@ const std::array OBJ_STEP_LABELS = // Should also add up to 100 (%) const std::array PRINT_STEP_LEVELS = { - 80, // slapsRasterize - 20, // slapsValidate + 5, // slapsStats + 94, // slapsRasterize + 1, // slapsValidate }; const std::array PRINT_STEP_LABELS = { + L("Calculating statistics"), // slapsStats L("Rasterizing layers"), // slapsRasterize L("Validating"), // slapsValidate }; @@ -913,6 +915,16 @@ void SLAPrint::process() 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 auto rasterize = [this, max_objstatus, ilhs]() { if(canceled()) return; @@ -1050,8 +1062,6 @@ void SLAPrint::process() // Print all the layers in parallel tbb::parallel_for(0, lvlcnt, lvlfn); - // Fill statistics - this->fill_statistics(); // Set statistics values to the printer 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()), @@ -1075,6 +1085,7 @@ void SLAPrint::process() std::array print_program = { + fillstats, rasterize, [](){} // validate }; @@ -1116,7 +1127,7 @@ void SLAPrint::process() } std::array printsteps = { - slapsRasterize, slapsValidate + slapsStats, slapsRasterize, slapsValidate }; // this would disable the rasterization step diff --git a/src/libslic3r/SLAPrint.hpp b/src/libslic3r/SLAPrint.hpp index 88152830f..afdfab415 100644 --- a/src/libslic3r/SLAPrint.hpp +++ b/src/libslic3r/SLAPrint.hpp @@ -11,6 +11,7 @@ namespace Slic3r { enum SLAPrintStep : unsigned int { + slapsStats, slapsRasterize, slapsValidate, slapsCount