Save statistics values to the config.ini

This commit is contained in:
YuSanka 2019-02-13 16:30:40 +01:00
parent 88f04e0fae
commit 3f23bd5224
2 changed files with 25 additions and 1 deletions

View file

@ -14,6 +14,12 @@
namespace Slic3r {
enum ePrintStatistics
{
psObjectsUsedMaterial = 0,
psSupportUsedMaterial
};
enum class FilePrinterFormat {
SLA_PNGZIP,
SVG
@ -118,6 +124,9 @@ template<> class FilePrinter<FilePrinterFormat::SLA_PNGZIP>
double m_layer_height = .0;
Raster::Origin m_o = Raster::Origin::TOP_LEFT;
double m_objects_used_material = 0.0;
double m_support_used_material = 0.0;
std::string createIniContent(const std::string& projectname) {
double layer_height = m_layer_height;
@ -129,6 +138,9 @@ template<> class FilePrinter<FilePrinterFormat::SLA_PNGZIP>
auto stepnum_str = to_string(static_cast<unsigned>(800*layer_height));
auto layerh_str = to_string(layer_height);
const std::string objects_used_material = to_string(m_objects_used_material);
const std::string support_used_material = to_string(m_support_used_material);
return string(
"action = print\n"
"jobDir = ") + projectname + "\n" +
@ -143,7 +155,9 @@ template<> class FilePrinter<FilePrinterFormat::SLA_PNGZIP>
"layerHeight = " + layerh_str + "\n"
"noteInfo = "
"expTime="+expt_str+"+resinType=generic+layerHeight="
+layerh_str+"+printer=DWARF3\n";
+layerh_str+"+printer=DWARF3\n"
"objUsedMaterial=" + objects_used_material + "\n"
"supUsedMaterial=" + support_used_material + "\n";
}
public:
@ -277,6 +291,12 @@ public:
out.close();
m_layers_rst[i].first.reset();
}
void set_statistics(const std::vector<double> statistics)
{
m_objects_used_material = statistics[psObjectsUsedMaterial];
m_support_used_material = statistics[psSupportUsedMaterial];
}
};
}

View file

@ -969,6 +969,10 @@ void SLAPrint::process()
// Fill statistics
fill_statistics();
// Set statistics values to the printer
SLAPrinter& printer = *m_printer;
printer.set_statistics({m_print_statistics.objects_used_material,
m_print_statistics.support_used_material});
// If everything vent well
report_status(*this, 100, L("Slicing done"));