diff --git a/src/libslic3r/Format/SL1.cpp b/src/libslic3r/Format/SL1.cpp index df10ce046..2f324accd 100644 --- a/src/libslic3r/Format/SL1.cpp +++ b/src/libslic3r/Format/SL1.cpp @@ -503,21 +503,19 @@ static void write_thumbnail(Zipper &zipper, const ThumbnailData &data) } } -void SL1Archive::export_print(const std::string fname, +void SL1Archive::export_print(Zipper &zipper, const SLAPrint &print, const ThumbnailsList &thumbnails, const std::string &prjname) { - Zipper zipper{fname}; - std::string project = prjname.empty() ? boost::filesystem::path(zipper.get_filename()).stem().string() : prjname; - + ConfMap iniconf, slicerconf; fill_iniconf(iniconf, print); - + iniconf["jobDir"] = project; fill_slicerconf(slicerconf, print); @@ -527,13 +525,13 @@ void SL1Archive::export_print(const std::string fname, zipper << to_ini(iniconf); zipper.add_entry("prusaslicer.ini"); zipper << to_ini(slicerconf); - + size_t i = 0; for (const sla::EncodedRaster &rst : m_layers) { std::string imgname = project + string_printf("%.5d", i++) + "." + rst.extension(); - + zipper.add_entry(imgname.c_str(), rst.data(), rst.size()); } @@ -549,4 +547,14 @@ void SL1Archive::export_print(const std::string fname, } } +void SL1Archive::export_print(const std::string fname, + const SLAPrint &print, + const ThumbnailsList &thumbnails, + const std::string &prjname) +{ + Zipper zipper{fname, Zipper::FAST_COMPRESSION}; + + export_print(zipper, print, thumbnails, prjname); +} + } // namespace Slic3r diff --git a/src/libslic3r/Format/SL1.hpp b/src/libslic3r/Format/SL1.hpp index 493550db4..0a662cc1e 100644 --- a/src/libslic3r/Format/SL1.hpp +++ b/src/libslic3r/Format/SL1.hpp @@ -22,8 +22,13 @@ protected: SLAPrinterConfig & cfg() { return m_cfg; } const SLAPrinterConfig & cfg() const { return m_cfg; } + void export_print(Zipper &, + const SLAPrint &print, + const ThumbnailsList &thumbnails, + const std::string &projectname); + public: - + SL1Archive() = default; explicit SL1Archive(const SLAPrinterConfig &cfg): m_cfg(cfg) {} explicit SL1Archive(SLAPrinterConfig &&cfg): m_cfg(std::move(cfg)) {} diff --git a/src/libslic3r/Format/SL1_SVG.cpp b/src/libslic3r/Format/SL1_SVG.cpp index 372348283..d138a72ba 100644 --- a/src/libslic3r/Format/SL1_SVG.cpp +++ b/src/libslic3r/Format/SL1_SVG.cpp @@ -224,4 +224,14 @@ sla::RasterEncoder SL1_SVGArchive::get_encoder() const return nullptr; } +void SL1_SVGArchive::export_print(const std::string fname, + const SLAPrint &print, + const ThumbnailsList &thumbnails, + const std::string &projectname) +{ + Zipper zipper{fname, Zipper::TIGHT_COMPRESSION}; + + SL1Archive::export_print(zipper, print, thumbnails, projectname); +} + } // namespace Slic3r diff --git a/src/libslic3r/Format/SL1_SVG.hpp b/src/libslic3r/Format/SL1_SVG.hpp index a3afbcdff..a764f1a4c 100644 --- a/src/libslic3r/Format/SL1_SVG.hpp +++ b/src/libslic3r/Format/SL1_SVG.hpp @@ -14,6 +14,11 @@ protected: public: + void export_print(const std::string fname, + const SLAPrint &print, + const ThumbnailsList &thumbnails, + const std::string &projectname = "") override; + using SL1Archive::SL1Archive; };