SLA: added pwmx format exporter
Pwmx format is used by Anycubic Photon Mono X printers. File format structure and rle encoding implemented according to: https://github.com/sn4k3/UVtools https://github.com/ole00/pwmx_info
This commit is contained in:
parent
0835e117d5
commit
7685e70743
9 changed files with 647 additions and 36 deletions
|
@ -3,6 +3,7 @@
|
|||
|
||||
#include "Format/SL1.hpp"
|
||||
#include "Format/SL1_SVG.hpp"
|
||||
#include "Format/pwmx.hpp"
|
||||
|
||||
#include "ClipperUtils.hpp"
|
||||
#include "Geometry.hpp"
|
||||
|
@ -16,6 +17,8 @@
|
|||
#include <boost/filesystem/path.hpp>
|
||||
#include <boost/log/trivial.hpp>
|
||||
|
||||
#include <miniz.h>
|
||||
|
||||
// #define SLAPRINT_DO_BENCHMARK
|
||||
|
||||
#ifdef SLAPRINT_DO_BENCHMARK
|
||||
|
@ -249,6 +252,9 @@ SLAPrint::ApplyStatus SLAPrint::apply(const Model &model, DynamicPrintConfig con
|
|||
m_archiver = std::make_unique<SL1Archive>(m_printer_config);
|
||||
else if (m_printer_config.sla_archive_format.value == "SL2")
|
||||
m_archiver = std::make_unique<SL1_SVGArchive>(m_printer_config);
|
||||
else if (m_printer_config.sla_archive_format.value == "pwmx") {
|
||||
m_archiver = std::make_unique<PwmxArchive>(m_printer_config);
|
||||
}
|
||||
}
|
||||
|
||||
struct ModelObjectStatus {
|
||||
|
@ -1265,4 +1271,16 @@ void SLAPrint::StatusReporter::operator()(SLAPrint & p,
|
|||
p.set_status(int(std::round(st)), msg, flags);
|
||||
}
|
||||
|
||||
|
||||
void SLAPrint::write_thumbnail(Zipper& zipper, const ThumbnailData& data)
|
||||
{
|
||||
size_t png_size = 0;
|
||||
void* png_data = tdefl_write_image_to_png_file_in_memory_ex((const void*)data.pixels.data(), data.width, data.height, 4, &png_size, MZ_DEFAULT_LEVEL, 1);
|
||||
if (png_data != nullptr)
|
||||
{
|
||||
zipper.add_entry("thumbnail/thumbnail" + std::to_string(data.width) + "x" + std::to_string(data.height) + ".png", (const std::uint8_t*)png_data, png_size);
|
||||
mz_free(png_data);
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace Slic3r
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue