Merge remote-tracking branch 'origin/ys_sla_time_estimation'

This commit is contained in:
bubnikv 2019-02-21 13:11:16 +01:00
commit 37ab271803
10 changed files with 467 additions and 18 deletions

View file

@ -2,7 +2,7 @@
#define slic3r_SLAPrint_hpp_
#include <mutex>
#include "ClipperUtils.hpp"
#include "PrintBase.hpp"
#include "PrintExport.hpp"
#include "Point.hpp"
@ -172,6 +172,35 @@ using PrintObjects = std::vector<SLAPrintObject*>;
class TriangleMesh;
struct SLAPrintStatistics
{
SLAPrintStatistics() { clear(); }
std::string estimated_print_time;
double objects_used_material;
double support_used_material;
size_t slow_layers_count;
size_t fast_layers_count;
double total_cost;
double total_weight;
// Config with the filled in print statistics.
DynamicConfig config() const;
// Config with the statistics keys populated with placeholder strings.
static DynamicConfig placeholders();
// Replace the print statistics placeholders in the path.
std::string finalize_output_path(const std::string &path_in) const;
void clear() {
estimated_print_time.clear();
objects_used_material = 0.;
support_used_material = 0.;
slow_layers_count = 0;
fast_layers_count = 0;
total_cost = 0.;
total_weight = 0.;
}
};
/**
* @brief This class is the high level FSM for the SLA printing process.
*
@ -211,6 +240,8 @@ public:
std::string output_filename() const override
{ return this->PrintBase::output_filename(m_print_config.output_filename_format.value, "zip"); }
const SLAPrintStatistics& print_statistics() const { return m_print_statistics; }
private:
using SLAPrinter = FilePrinter<FilePrinterFormat::SLA_PNGZIP>;
using SLAPrinterPtr = std::unique_ptr<SLAPrinter>;
@ -218,6 +249,8 @@ private:
// Invalidate steps based on a set of parameters changed.
bool invalidate_state_by_config_options(const std::vector<t_config_option_key> &opt_keys);
void fill_statistics();
SLAPrintConfig m_print_config;
SLAPrinterConfig m_printer_config;
SLAMaterialConfig m_material_config;
@ -249,6 +282,9 @@ private:
// The printer itself
SLAPrinterPtr m_printer;
// Estimated print time, material consumed.
SLAPrintStatistics m_print_statistics;
friend SLAPrintObject;
};