1 #ifndef ARCHIVETRAITS_HPP
2 #define ARCHIVETRAITS_HPP
3 
4 #include <string>
5 
6 #include "libslic3r/Zipper.hpp"
7 #include "libslic3r/SLAPrint.hpp"
8 
9 namespace Slic3r {
10 
11 class SL1Archive: public SLAPrinter {
12     SLAPrinterConfig m_cfg;
13 
14 protected:
15     uqptr<sla::RasterBase> create_raster() const override;
16     sla::RasterEncoder get_encoder() const override;
17 
18 public:
19 
20     SL1Archive() = default;
SL1Archive(const SLAPrinterConfig & cfg)21     explicit SL1Archive(const SLAPrinterConfig &cfg): m_cfg(cfg) {}
SL1Archive(SLAPrinterConfig && cfg)22     explicit SL1Archive(SLAPrinterConfig &&cfg): m_cfg(std::move(cfg)) {}
23 
24     void export_print(Zipper &zipper, const SLAPrint &print, const std::string &projectname = "");
export_print(const std::string & fname,const SLAPrint & print,const std::string & projectname="")25     void export_print(const std::string &fname, const SLAPrint &print, const std::string &projectname = "")
26     {
27         Zipper zipper(fname);
28         export_print(zipper, print, projectname);
29     }
30 
apply(const SLAPrinterConfig & cfg)31     void apply(const SLAPrinterConfig &cfg) override
32     {
33         auto diff = m_cfg.diff(cfg);
34         if (!diff.empty()) {
35             m_cfg.apply_only(cfg, diff);
36             m_layers = {};
37         }
38     }
39 };
40 
41 ConfigSubstitutions import_sla_archive(const std::string &zipfname, DynamicPrintConfig &out);
42 
43 ConfigSubstitutions import_sla_archive(
44     const std::string &      zipfname,
45     Vec2i                    windowsize,
46     TriangleMesh &           out,
47     DynamicPrintConfig &     profile,
__anonf1f0e70a0102(int) 48     std::function<bool(int)> progr = [](int) { return true; });
49 
import_sla_archive(const std::string & zipfname,Vec2i windowsize,TriangleMesh & out,std::function<bool (int)> progr=[](int){})50 inline ConfigSubstitutions import_sla_archive(
51     const std::string &      zipfname,
52     Vec2i                    windowsize,
53     TriangleMesh &           out,
54     std::function<bool(int)> progr = [](int) { return true; })
55 {
56     DynamicPrintConfig profile;
57     return import_sla_archive(zipfname, windowsize, out, profile, progr);
58 }
59 
60 } // namespace Slic3r::sla
61 
62 #endif // ARCHIVETRAITS_HPP
63