diff --git a/src/libslic3r/PrintExport.hpp b/src/libslic3r/PrintExport.hpp index 5cfb552176..d40b60aad8 100644 --- a/src/libslic3r/PrintExport.hpp +++ b/src/libslic3r/PrintExport.hpp @@ -14,6 +14,12 @@ namespace Slic3r { +enum ePrintStatistics +{ + psObjectsUsedMaterial = 0, + psSupportUsedMaterial +}; + enum class FilePrinterFormat { SLA_PNGZIP, SVG @@ -118,6 +124,9 @@ template<> class FilePrinter 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 auto stepnum_str = to_string(static_cast(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 "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 statistics) + { + m_objects_used_material = statistics[psObjectsUsedMaterial]; + m_support_used_material = statistics[psSupportUsedMaterial]; + } }; } diff --git a/src/libslic3r/SLAPrint.cpp b/src/libslic3r/SLAPrint.cpp index 08ab56db32..f95b16cfe7 100644 --- a/src/libslic3r/SLAPrint.cpp +++ b/src/libslic3r/SLAPrint.cpp @@ -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"));