format/AnycubicSLA: refactor Anycubic SLA format and add Photon Mono and Mono SE printers (#9929)
* format/sla: Rename pwmx format to AnycubicSLA The Anycubic Photon SLA printer familiy is shipped with the PhotonWorkshop slicer. This slicer generates the sliced archives. These archives have per-printer extensions, not only pwmx. The name is -most of the times- comprised of the PhontonWorkshop "pw" bit and the model name. "mo" for the Photon Mono, "mx" for the Mono X. Therefore the format name "pwmx" is incorrect and we are renaming it to AnycubicSLA. On top of it we are introducing a helper macro to connect file extension and printer definition as most printers use extremely similiar formats. Signed-off-by: Mimoja <git@mimoja.de> * format/AnycubicSLA: Add missing fields The AnycubicSLA format description is derived from reverse engineering of the PhotonWorkshop output files. While the initial Photon devices had their binary headers with version 1 we have seen newer models with additional versions. Namely 515, 516 and 517. We are adding the version handling to the AnycubicSLA exporter to prepare for future version handling. Some fields were missing for Version 1 which are added. Signed-off-by: Mimoja <git@mimoja.de> * PrintConfig/sla: Move material notes to simple view As the Anycubic Photon Mono X uses the material notes to configure the printers parameters we need to change the visibility to allow every user acces. This will change the default behaviour for non Anycubic SLA printers. Signed-off-by: Mimoja <git@mimoja.de> * format/AnycubicSLA: Expose Antialiasing via material notes Similiar to how the other machine configurations are exposed via the material notes we are adding the Antialiasing config. Signed-off-by: Mimoja <git@mimoja.de> * Printer/sla: Add Anycubic Photon Mono and Mono SE The Photon Mono and Mono SE are format compatible printers with the Mono X. They support Version 1 and Version 515 binary archives. We are implementing them as Version 1 priters to reduce the overhead and keep the code in line with the Mono X. The addition as Version 1 printers leaves some features unexposed, most noteably the Antialiasing level configuration which is now always the maximum. Given that the printers check the eligability of sliced files by file extension we are poised to create per-printer sla_print default configurations to overwrite output_filename_format. Tested: Successfully printed multiple objects. Changing the layer parameter on the onscreen display succeeded. --------- Signed-off-by: Mimoja <git@mimoja.de>
This commit is contained in:
parent
f56cffe546
commit
e93b222d33
10 changed files with 303 additions and 156 deletions
|
@ -1,3 +1,7 @@
|
|||
min_slic3r_version = 2.6.0-alpha4
|
||||
0.2.4 Enable pad for Anycubic SLA profiles
|
||||
0.2.3 Added Photon Mono printer.
|
||||
0.2.2 Added Photon Mono SE printer.
|
||||
min_slic3r_version = 2.6.0-alpha2
|
||||
0.2.1 Added Eolas Prints filaments.
|
||||
0.2.0 Added Photon Mono X printer.
|
||||
|
|
|
@ -73,6 +73,13 @@ technology = FFF
|
|||
family = PREDATOR
|
||||
default_materials = Generic PLA @PREDATOR; Generic PETG @PREDATOR; Generic ABS @PREDATOR
|
||||
|
||||
[printer_model:PHOTON MONO]
|
||||
name = Photon Mono
|
||||
variants = default
|
||||
technology = SLA
|
||||
family = PHOTON MONO
|
||||
default_materials = Generic Blue Resin @MONO 0.05
|
||||
|
||||
[printer_model:PHOTON MONO X]
|
||||
name = Photon Mono X
|
||||
variants = default
|
||||
|
@ -80,6 +87,13 @@ technology = SLA
|
|||
family = PHOTON MONO
|
||||
default_materials = Generic Blue Resin @MONO 0.05
|
||||
|
||||
[printer_model:PHOTON MONO SE]
|
||||
name = Photon Mono SE
|
||||
variants = default
|
||||
technology = SLA
|
||||
family = PHOTON MONO
|
||||
default_materials = Generic Blue Resin @MONO 0.05
|
||||
|
||||
# All presets starting with asterisk, for example *common*, are intermediate and they will
|
||||
# not make it into the user interface.
|
||||
|
||||
|
@ -2327,11 +2341,10 @@ z_offset = 0
|
|||
## SLA printers
|
||||
|
||||
[sla_print:*common print ANYCUBIC SLA*]
|
||||
compatible_printers_condition = printer_notes=~/.*PHOTONMONOX.*/
|
||||
compatible_printers_condition = printer_notes=~/.*VENDOR_ANYCUBIC.*/ and printer_notes=~/.*SLA.*/
|
||||
layer_height = 0.05
|
||||
output_filename_format = [input_filename_base].pwmx
|
||||
pad_edge_radius = 0.5
|
||||
pad_enable = 0
|
||||
pad_enable = 1
|
||||
pad_max_merge_distance = 50
|
||||
pad_wall_height = 0
|
||||
pad_wall_thickness = 1
|
||||
|
@ -2355,20 +2368,38 @@ support_pillar_widening_factor = 0
|
|||
supports_enable = 1
|
||||
support_small_pillar_diameter_percent = 60%
|
||||
|
||||
[sla_print:0.05 Normal @ANYCUBIC]
|
||||
[sla_print:0.05 Normal @ANYCUBIC ABSTRACT]
|
||||
inherits = *common print ANYCUBIC SLA*
|
||||
compatible_printers_condition = printer_notes=~/.*ABSTRACT_ONLY.*/
|
||||
layer_height = 0.05
|
||||
|
||||
[sla_print:0.05 Normal @ANYCUBIC MONO]
|
||||
inherits = 0.05 Normal @ANYCUBIC ABSTRACT
|
||||
compatible_printers_condition = printer_notes=~/.*PHOTONMONO\n.*/
|
||||
output_filename_format = [input_filename_base].pwmo
|
||||
|
||||
[sla_print:0.05 Normal @ANYCUBIC MONO X]
|
||||
inherits = 0.05 Normal @ANYCUBIC ABSTRACT
|
||||
compatible_printers_condition = printer_notes=~/.*PHOTONMONOX\n.*/
|
||||
output_filename_format = [input_filename_base].pwmx
|
||||
|
||||
[sla_print:0.05 Normal @ANYCUBIC MONO SE]
|
||||
inherits = 0.05 Normal @ANYCUBIC ABSTRACT
|
||||
compatible_printers_condition = printer_notes=~/.*PHOTONMONOSE\n.*/
|
||||
output_filename_format = [input_filename_base].pwma
|
||||
|
||||
|
||||
## SLA materials
|
||||
|
||||
#MONO series printer need a significantly reduced exposure time but are otherwise compatible
|
||||
[sla_material:*common ANYCUBIC SLA*]
|
||||
compatible_printers_condition = printer_notes=~/.*PHOTONMONOX.*/
|
||||
compatible_printers_condition = printer_notes=~/.*VENDOR_ANYCUBIC.*/ and printer_notes=~/.*SLA.*/
|
||||
compatible_prints_condition = layer_height == 0.05
|
||||
exposure_time = 7
|
||||
initial_exposure_time = 40
|
||||
initial_layer_height = 0.05
|
||||
material_correction = 1,1,1
|
||||
material_notes = LIFT_DISTANCE=8.0\nLIFT_SPEED=2.5\nRETRACT_SPEED=3.0\nBOTTOM_LIFT_SPEED=2.0\nBOTTOM_LIFT_DISTANCE=9.0\nDELAY_BEFORE_EXPOSURE=0.5
|
||||
material_notes = #Distances are defined in mm, speeds are defined in mm/s.\n#Delay is defined in s.\nLIFT_DISTANCE=8.0\nLIFT_SPEED=2.5\nRETRACT_SPEED=3.0\nBOTTOM_LIFT_SPEED=2.0\nBOTTOM_LIFT_DISTANCE=9.0\nDELAY_BEFORE_EXPOSURE=0.5\nANTIALIASING=1
|
||||
|
||||
[sla_material:*common 0.05 ANYCUBIC SLA*]
|
||||
inherits = *common ANYCUBIC SLA*
|
||||
|
@ -2380,10 +2411,66 @@ initial_exposure_time = 40
|
|||
material_type = Tough
|
||||
material_vendor = Generic
|
||||
material_colour = #6080EC
|
||||
compatible_printers_condition = printer_notes=~/.*PHOTONMONOX.*/
|
||||
compatible_printers_condition = printer_notes=~/.*MONO.*/ and printer_notes=~/.*VENDOR_ANYCUBIC.*/ and printer_notes=~/.*SLA.*/
|
||||
|
||||
## Printers
|
||||
|
||||
[printer:Anycubic Photon Mono]
|
||||
printer_technology = SLA
|
||||
printer_model = PHOTON MONO
|
||||
printer_variant = default
|
||||
default_sla_material_profile = Generic Blue Resin @MONO 0.05
|
||||
default_sla_print_profile = 0.05 Normal @ANYCUBIC
|
||||
thumbnails = 224x168
|
||||
sla_archive_format = pwmo
|
||||
bed_shape = 0x0,82.62x0,82.62x130.56,0x130.56
|
||||
display_orientation = landscape
|
||||
display_mirror_x = 1
|
||||
display_mirror_y = 0
|
||||
display_pixels_x = 1620
|
||||
display_pixels_y = 2560
|
||||
display_width = 82.62
|
||||
display_height = 130.56
|
||||
max_print_height = 165
|
||||
elefant_foot_compensation = 0.2
|
||||
elefant_foot_min_width = 0.2
|
||||
min_exposure_time = 0.8
|
||||
max_exposure_time = 120
|
||||
min_initial_exposure_time = 0.8
|
||||
max_initial_exposure_time = 300
|
||||
printer_correction = 1,1,1
|
||||
gamma_correction = 1
|
||||
area_fill = 50
|
||||
printer_notes = Don't remove the following keywords! These keywords are used in the "compatible printer" condition of the print and filament profiles to link the particular print and filament profiles to this printer profile.'\nPRINTER_VENDOR_ANYCUBIC\nPRINTER_MODEL_PHOTONMONO\nPRINTER_TECHNOLOGY_SLA\n
|
||||
|
||||
[printer:Anycubic Photon Mono SE]
|
||||
printer_technology = SLA
|
||||
printer_model = PHOTON MONO SE
|
||||
printer_variant = default
|
||||
default_sla_material_profile = Generic Blue Resin @MONO 0.05
|
||||
default_sla_print_profile = 0.05 Normal @ANYCUBIC
|
||||
thumbnails = 224x168
|
||||
sla_archive_format = pwms
|
||||
bed_shape = 0x0,82.62x0,82.62x130.56,0x130.56
|
||||
display_orientation = landscape
|
||||
display_mirror_x = 1
|
||||
display_mirror_y = 0
|
||||
display_pixels_x = 1620
|
||||
display_pixels_y = 2560
|
||||
display_width = 82.62
|
||||
display_height = 130.56
|
||||
max_print_height = 160
|
||||
elefant_foot_compensation = 0.2
|
||||
elefant_foot_min_width = 0.2
|
||||
min_exposure_time = 0.8
|
||||
max_exposure_time = 120
|
||||
min_initial_exposure_time = 0.8
|
||||
max_initial_exposure_time = 300
|
||||
printer_correction = 1,1,1
|
||||
gamma_correction = 1
|
||||
area_fill = 45
|
||||
printer_notes = Don't remove the following keywords! These keywords are used in the "compatible printer" condition of the print and filament profiles to link the particular print and filament profiles to this printer profile.'\nPRINTER_VENDOR_ANYCUBIC\nPRINTER_MODEL_PHOTONMONOSE\nPRINTER_TECHNOLOGY_SLA\n
|
||||
|
||||
[printer:Anycubic Photon Mono X]
|
||||
printer_technology = SLA
|
||||
printer_model = PHOTON MONO X
|
||||
|
@ -2410,4 +2497,4 @@ max_initial_exposure_time = 300
|
|||
printer_correction = 1,1,1
|
||||
gamma_correction = 1
|
||||
area_fill = 45
|
||||
printer_notes = Don't remove the following keywords! These keywords are used in the "compatible printer" condition of the print and filament profiles to link the particular print and filament profiles to this printer profile.'\nPRINTER_VENDOR_ANYCUBIC\nPRINTER_MODEL_PHOTONMONOX\n
|
||||
printer_notes = Don't remove the following keywords! These keywords are used in the "compatible printer" condition of the print and filament profiles to link the particular print and filament profiles to this printer profile.'\nPRINTER_VENDOR_ANYCUBIC\nPRINTER_MODEL_PHOTONMONOX\nPRINTER_TECHNOLOGY_SLA\n
|
BIN
resources/profiles/Anycubic/PHOTON MONO SE_thumbnail.png
Normal file
BIN
resources/profiles/Anycubic/PHOTON MONO SE_thumbnail.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 38 KiB |
BIN
resources/profiles/Anycubic/PHOTON MONO_thumbnail.png
Normal file
BIN
resources/profiles/Anycubic/PHOTON MONO_thumbnail.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 35 KiB |
|
@ -127,8 +127,8 @@ set(SLIC3R_SOURCES
|
|||
Format/SL1.cpp
|
||||
Format/SL1_SVG.hpp
|
||||
Format/SL1_SVG.cpp
|
||||
Format/pwmx.hpp
|
||||
Format/pwmx.cpp
|
||||
Format/AnycubicSLA.hpp
|
||||
Format/AnycubicSLA.cpp
|
||||
Format/STEP.hpp
|
||||
Format/STEP.cpp
|
||||
GCode/ThumbnailData.cpp
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#include "pwmx.hpp"
|
||||
#include "AnycubicSLA.hpp"
|
||||
#include "GCode/ThumbnailData.hpp"
|
||||
#include "SLA/RasterBase.hpp"
|
||||
#include "libslic3r/SLAPrint.hpp"
|
||||
|
@ -22,6 +22,8 @@
|
|||
#define CFG_DELAY_BEFORE_EXPOSURE "DELAY_BEFORE_EXPOSURE"
|
||||
#define CFG_BOTTOM_LIFT_SPEED "BOTTOM_LIFT_SPEED"
|
||||
#define CFG_BOTTOM_LIFT_DISTANCE "BOTTOM_LIFT_DISTANCE"
|
||||
#define CFG_ANTIALIASING "ANTIALIASING"
|
||||
|
||||
|
||||
#define PREV_W 224
|
||||
#define PREV_H 168
|
||||
|
@ -31,7 +33,7 @@
|
|||
|
||||
namespace Slic3r {
|
||||
|
||||
static void pwx_get_pixel_span(const std::uint8_t* ptr, const std::uint8_t* end,
|
||||
static void anycubicsla_get_pixel_span(const std::uint8_t* ptr, const std::uint8_t* end,
|
||||
std::uint8_t& pixel, size_t& span_len)
|
||||
{
|
||||
size_t max_len;
|
||||
|
@ -46,7 +48,7 @@ static void pwx_get_pixel_span(const std::uint8_t* ptr, const std::uint8_t* end,
|
|||
}
|
||||
}
|
||||
|
||||
struct PWXRasterEncoder
|
||||
struct AnycubicSLARasterEncoder
|
||||
{
|
||||
sla::EncodedRaster operator()(const void *ptr,
|
||||
size_t w,
|
||||
|
@ -62,7 +64,7 @@ struct PWXRasterEncoder
|
|||
const std::uint8_t *src = reinterpret_cast<const std::uint8_t *>(ptr);
|
||||
const std::uint8_t *src_end = src + size;
|
||||
while (src < src_end) {
|
||||
pwx_get_pixel_span(src, src_end, pixel, span_len);
|
||||
anycubicsla_get_pixel_span(src, src_end, pixel, span_len);
|
||||
src += span_len;
|
||||
// fully transparent of fully opaque pixel
|
||||
if (pixel == 0 || pixel == 0xF0) {
|
||||
|
@ -78,27 +80,27 @@ struct PWXRasterEncoder
|
|||
}
|
||||
}
|
||||
|
||||
return sla::EncodedRaster(std::move(dst), "pwx");
|
||||
return sla::EncodedRaster(std::move(dst), "pwimg");
|
||||
}
|
||||
};
|
||||
|
||||
using ConfMap = std::map<std::string, std::string>;
|
||||
|
||||
typedef struct pwmx_format_intro
|
||||
typedef struct anycubicsla_format_intro
|
||||
{
|
||||
char tag[12];
|
||||
std::uint32_t version; // value 1
|
||||
std::uint32_t area_num; // unknown - usually 4
|
||||
std::uint32_t version; // value 1 (also known as 515, 516 and 517)
|
||||
std::uint32_t area_num; // Number of tables - usually 4
|
||||
std::uint32_t header_data_offset;
|
||||
std::float_t intro24; // unknown - usually 0
|
||||
std::uint32_t software_data_offset; // unused in version 1
|
||||
std::uint32_t preview_data_offset;
|
||||
std::float_t intro32; // unknown
|
||||
std::uint32_t layer_color_offset; // unused in version 1
|
||||
std::uint32_t layer_data_offset;
|
||||
std::float_t intro40; // unknown
|
||||
std::uint32_t extra_data_offset; // unused here (only used in version 516)
|
||||
std::uint32_t image_data_offset;
|
||||
} pwmx_format_intro;
|
||||
} anycubicsla_format_intro;
|
||||
|
||||
typedef struct pwmx_format_header
|
||||
typedef struct anycubicsla_format_header
|
||||
{
|
||||
char tag[12];
|
||||
std::uint32_t payload_size;
|
||||
|
@ -121,11 +123,11 @@ typedef struct pwmx_format_header
|
|||
std::uint32_t per_layer_override; // ? unknown meaning ?
|
||||
std::uint32_t print_time_s;
|
||||
std::uint32_t transition_layer_count;
|
||||
std::uint32_t unknown; // ? usually 0 ?
|
||||
std::uint32_t transition_layer_type; // usually 0
|
||||
|
||||
} pwmx_format_header;
|
||||
} anycubicsla_format_header;
|
||||
|
||||
typedef struct pwmx_format_preview
|
||||
typedef struct anycubicsla_format_preview
|
||||
{
|
||||
char tag[12];
|
||||
std::uint32_t payload_size;
|
||||
|
@ -134,16 +136,16 @@ typedef struct pwmx_format_preview
|
|||
std::uint32_t preview_h;
|
||||
// raw image data in BGR565 format
|
||||
std::uint8_t pixels[PREV_W * PREV_H * 2];
|
||||
} pwmx_format_preview;
|
||||
} anycubicsla_format_preview;
|
||||
|
||||
typedef struct pwmx_format_layers_header
|
||||
typedef struct anycubicsla_format_layers_header
|
||||
{
|
||||
char tag[12];
|
||||
std::uint32_t payload_size;
|
||||
std::uint32_t layer_count;
|
||||
} pwmx_format_layers_header;
|
||||
} anycubicsla_format_layers_header;
|
||||
|
||||
typedef struct pwmx_format_layer
|
||||
typedef struct anycubicsla_format_layer
|
||||
{
|
||||
std::uint32_t image_offset;
|
||||
std::uint32_t image_size;
|
||||
|
@ -153,20 +155,20 @@ typedef struct pwmx_format_layer
|
|||
std::float_t layer_height_mm;
|
||||
std::float_t layer44; // unkown - usually 0
|
||||
std::float_t layer48; // unkown - usually 0
|
||||
} pwmx_format_layer;
|
||||
} anycubicsla_format_layer;
|
||||
|
||||
typedef struct pwmx_format_misc
|
||||
typedef struct anycubicsla_format_misc
|
||||
{
|
||||
std::float_t bottom_layer_height_mm;
|
||||
std::float_t bottom_lift_distance_mm;
|
||||
std::float_t bottom_lift_speed_mms;
|
||||
|
||||
} pwmx_format_misc;
|
||||
} anycubicsla_format_misc;
|
||||
|
||||
class PwmxFormatConfigDef : public ConfigDef
|
||||
class AnycubicSLAFormatConfigDef : public ConfigDef
|
||||
{
|
||||
public:
|
||||
PwmxFormatConfigDef()
|
||||
AnycubicSLAFormatConfigDef()
|
||||
{
|
||||
add(CFG_LIFT_DISTANCE, coFloat);
|
||||
add(CFG_LIFT_SPEED, coFloat);
|
||||
|
@ -174,17 +176,18 @@ public:
|
|||
add(CFG_DELAY_BEFORE_EXPOSURE, coFloat);
|
||||
add(CFG_BOTTOM_LIFT_DISTANCE, coFloat);
|
||||
add(CFG_BOTTOM_LIFT_SPEED, coFloat);
|
||||
add(CFG_ANTIALIASING, coInt);
|
||||
}
|
||||
};
|
||||
|
||||
class PwmxFormatDynamicConfig : public DynamicConfig
|
||||
class AnycubicSLAFormatDynamicConfig : public DynamicConfig
|
||||
{
|
||||
public:
|
||||
PwmxFormatDynamicConfig(){};
|
||||
AnycubicSLAFormatDynamicConfig(){};
|
||||
const ConfigDef *def() const override { return &config_def; }
|
||||
|
||||
private:
|
||||
PwmxFormatConfigDef config_def;
|
||||
AnycubicSLAFormatConfigDef config_def;
|
||||
};
|
||||
|
||||
namespace {
|
||||
|
@ -222,8 +225,8 @@ template<class T> void crop_value(T &val, T val_min, T val_max)
|
|||
}
|
||||
}
|
||||
|
||||
void fill_preview(pwmx_format_preview &p,
|
||||
pwmx_format_misc &/*m*/,
|
||||
void fill_preview(anycubicsla_format_preview &p,
|
||||
anycubicsla_format_misc &/*m*/,
|
||||
const ThumbnailsList &thumbnails)
|
||||
{
|
||||
|
||||
|
@ -266,9 +269,8 @@ void fill_preview(pwmx_format_preview &p,
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
void fill_header(pwmx_format_header &h,
|
||||
pwmx_format_misc &m,
|
||||
void fill_header(anycubicsla_format_header &h,
|
||||
anycubicsla_format_misc &m,
|
||||
const SLAPrint &print,
|
||||
std::uint32_t layer_count)
|
||||
{
|
||||
|
@ -282,7 +284,7 @@ void fill_header(pwmx_format_header &h,
|
|||
auto mat_opt = cfg.option("material_notes");
|
||||
std::string mnotes = mat_opt? cfg.option("material_notes")->serialize() : "";
|
||||
// create a config parser from the material notes
|
||||
Slic3r::PwmxFormatDynamicConfig mat_cfg;
|
||||
Slic3r::AnycubicSLAFormatDynamicConfig mat_cfg;
|
||||
SLAPrintStatistics stats = print.print_statistics();
|
||||
|
||||
// sanitize the string config
|
||||
|
@ -314,6 +316,13 @@ void fill_header(pwmx_format_header &h,
|
|||
h.per_layer_override = 0;
|
||||
|
||||
// TODO - expose these variables to the UI rather than using material notes
|
||||
if (mat_cfg.has(CFG_ANTIALIASING)) {
|
||||
h.antialiasing = get_cfg_value_i(mat_cfg, CFG_ANTIALIASING);
|
||||
crop_value(h.antialiasing, (uint32_t) 0, (uint32_t) 1);
|
||||
} else {
|
||||
h.antialiasing = 1;
|
||||
}
|
||||
|
||||
h.delay_before_exposure_s = get_cfg_value_f(mat_cfg, CFG_DELAY_BEFORE_EXPOSURE, 0.5f);
|
||||
crop_value(h.delay_before_exposure_s, 0.0f, 1000.0f);
|
||||
|
||||
|
@ -356,7 +365,7 @@ void fill_header(pwmx_format_header &h,
|
|||
|
||||
} // namespace
|
||||
|
||||
std::unique_ptr<sla::RasterBase> PwmxArchive::create_raster() const
|
||||
std::unique_ptr<sla::RasterBase> AnycubicSLAArchive::create_raster() const
|
||||
{
|
||||
sla::Resolution res;
|
||||
sla::PixelDim pxdim;
|
||||
|
@ -389,13 +398,13 @@ std::unique_ptr<sla::RasterBase> PwmxArchive::create_raster() const
|
|||
return sla::create_raster_grayscale_aa(res, pxdim, gamma, tr);
|
||||
}
|
||||
|
||||
sla::RasterEncoder PwmxArchive::get_encoder() const
|
||||
sla::RasterEncoder AnycubicSLAArchive::get_encoder() const
|
||||
{
|
||||
return PWXRasterEncoder{};
|
||||
return AnycubicSLARasterEncoder{};
|
||||
}
|
||||
|
||||
// Endian safe write of little endian 32bit ints
|
||||
static void pwmx_write_int32(std::ofstream &out, std::uint32_t val)
|
||||
static void anycubicsla_write_int32(std::ofstream &out, std::uint32_t val)
|
||||
{
|
||||
const char i1 = (val & 0xFF);
|
||||
const char i2 = (val >> 8) & 0xFF;
|
||||
|
@ -407,104 +416,106 @@ static void pwmx_write_int32(std::ofstream &out, std::uint32_t val)
|
|||
out.write((const char *) &i3, 1);
|
||||
out.write((const char *) &i4, 1);
|
||||
}
|
||||
static void pwmx_write_float(std::ofstream &out, std::float_t val)
|
||||
static void anycubicsla_write_float(std::ofstream &out, std::float_t val)
|
||||
{
|
||||
std::uint32_t *f = (std::uint32_t *) &val;
|
||||
pwmx_write_int32(out, *f);
|
||||
anycubicsla_write_int32(out, *f);
|
||||
}
|
||||
|
||||
static void pwmx_write_intro(std::ofstream &out, pwmx_format_intro &i)
|
||||
static void anycubicsla_write_intro(std::ofstream &out, anycubicsla_format_intro &i)
|
||||
{
|
||||
out.write(TAG_INTRO, sizeof(i.tag));
|
||||
pwmx_write_int32(out, i.version);
|
||||
pwmx_write_int32(out, i.area_num);
|
||||
pwmx_write_int32(out, i.header_data_offset);
|
||||
pwmx_write_int32(out, i.intro24);
|
||||
pwmx_write_int32(out, i.preview_data_offset);
|
||||
pwmx_write_int32(out, i.intro32);
|
||||
pwmx_write_int32(out, i.layer_data_offset);
|
||||
pwmx_write_int32(out, i.intro40);
|
||||
pwmx_write_int32(out, i.image_data_offset);
|
||||
anycubicsla_write_int32(out, i.version);
|
||||
anycubicsla_write_int32(out, i.area_num);
|
||||
anycubicsla_write_int32(out, i.header_data_offset);
|
||||
anycubicsla_write_int32(out, i.software_data_offset);
|
||||
anycubicsla_write_int32(out, i.preview_data_offset);
|
||||
anycubicsla_write_int32(out, i.layer_color_offset);
|
||||
anycubicsla_write_int32(out, i.layer_data_offset);
|
||||
anycubicsla_write_int32(out, i.extra_data_offset);
|
||||
anycubicsla_write_int32(out, i.image_data_offset);
|
||||
}
|
||||
|
||||
static void pwmx_write_header(std::ofstream &out, pwmx_format_header &h)
|
||||
static void anycubicsla_write_header(std::ofstream &out, anycubicsla_format_header &h)
|
||||
{
|
||||
out.write(TAG_HEADER, sizeof(h.tag));
|
||||
pwmx_write_int32(out, h.payload_size);
|
||||
pwmx_write_float(out, h.pixel_size_um);
|
||||
pwmx_write_float(out, h.layer_height_mm);
|
||||
pwmx_write_float(out, h.exposure_time_s);
|
||||
pwmx_write_float(out, h.delay_before_exposure_s);
|
||||
pwmx_write_float(out, h.bottom_exposure_time_s);
|
||||
pwmx_write_float(out, h.bottom_layer_count);
|
||||
pwmx_write_float(out, h.lift_distance_mm);
|
||||
pwmx_write_float(out, h.lift_speed_mms);
|
||||
pwmx_write_float(out, h.retract_speed_mms);
|
||||
pwmx_write_float(out, h.volume_ml);
|
||||
pwmx_write_int32(out, h.antialiasing);
|
||||
pwmx_write_int32(out, h.res_x);
|
||||
pwmx_write_int32(out, h.res_y);
|
||||
pwmx_write_float(out, h.weight_g);
|
||||
pwmx_write_float(out, h.price);
|
||||
pwmx_write_int32(out, h.price_currency);
|
||||
pwmx_write_int32(out, h.per_layer_override);
|
||||
pwmx_write_int32(out, h.print_time_s);
|
||||
pwmx_write_int32(out, h.transition_layer_count);
|
||||
pwmx_write_int32(out, h.unknown);
|
||||
anycubicsla_write_int32(out, h.payload_size);
|
||||
anycubicsla_write_float(out, h.pixel_size_um);
|
||||
anycubicsla_write_float(out, h.layer_height_mm);
|
||||
anycubicsla_write_float(out, h.exposure_time_s);
|
||||
anycubicsla_write_float(out, h.delay_before_exposure_s);
|
||||
anycubicsla_write_float(out, h.bottom_exposure_time_s);
|
||||
anycubicsla_write_float(out, h.bottom_layer_count);
|
||||
anycubicsla_write_float(out, h.lift_distance_mm);
|
||||
anycubicsla_write_float(out, h.lift_speed_mms);
|
||||
anycubicsla_write_float(out, h.retract_speed_mms);
|
||||
anycubicsla_write_float(out, h.volume_ml);
|
||||
anycubicsla_write_int32(out, h.antialiasing);
|
||||
anycubicsla_write_int32(out, h.res_x);
|
||||
anycubicsla_write_int32(out, h.res_y);
|
||||
anycubicsla_write_float(out, h.weight_g);
|
||||
anycubicsla_write_float(out, h.price);
|
||||
anycubicsla_write_int32(out, h.price_currency);
|
||||
anycubicsla_write_int32(out, h.per_layer_override);
|
||||
anycubicsla_write_int32(out, h.print_time_s);
|
||||
anycubicsla_write_int32(out, h.transition_layer_count);
|
||||
anycubicsla_write_int32(out, h.transition_layer_type);
|
||||
}
|
||||
|
||||
static void pwmx_write_preview(std::ofstream &out, pwmx_format_preview &p)
|
||||
static void anycubicsla_write_preview(std::ofstream &out, anycubicsla_format_preview &p)
|
||||
{
|
||||
out.write(TAG_PREVIEW, sizeof(p.tag));
|
||||
pwmx_write_int32(out, p.payload_size);
|
||||
pwmx_write_int32(out, p.preview_w);
|
||||
pwmx_write_int32(out, p.preview_dpi);
|
||||
pwmx_write_int32(out, p.preview_h);
|
||||
anycubicsla_write_int32(out, p.payload_size);
|
||||
anycubicsla_write_int32(out, p.preview_w);
|
||||
anycubicsla_write_int32(out, p.preview_dpi);
|
||||
anycubicsla_write_int32(out, p.preview_h);
|
||||
out.write((const char*) p.pixels, sizeof(p.pixels));
|
||||
}
|
||||
|
||||
static void pwmx_write_layers_header(std::ofstream &out, pwmx_format_layers_header &h)
|
||||
static void anycubicsla_write_layers_header(std::ofstream &out, anycubicsla_format_layers_header &h)
|
||||
{
|
||||
out.write(TAG_LAYERS, sizeof(h.tag));
|
||||
pwmx_write_int32(out, h.payload_size);
|
||||
pwmx_write_int32(out, h.layer_count);
|
||||
anycubicsla_write_int32(out, h.payload_size);
|
||||
anycubicsla_write_int32(out, h.layer_count);
|
||||
}
|
||||
|
||||
static void pwmx_write_layer(std::ofstream &out, pwmx_format_layer &l)
|
||||
static void anycubicsla_write_layer(std::ofstream &out, anycubicsla_format_layer &l)
|
||||
{
|
||||
pwmx_write_int32(out, l.image_offset);
|
||||
pwmx_write_int32(out, l.image_size);
|
||||
pwmx_write_float(out, l.lift_distance_mm);
|
||||
pwmx_write_float(out, l.lift_speed_mms);
|
||||
pwmx_write_float(out, l.exposure_time_s);
|
||||
pwmx_write_float(out, l.layer_height_mm);
|
||||
pwmx_write_float(out, l.layer44);
|
||||
pwmx_write_float(out, l.layer48);
|
||||
anycubicsla_write_int32(out, l.image_offset);
|
||||
anycubicsla_write_int32(out, l.image_size);
|
||||
anycubicsla_write_float(out, l.lift_distance_mm);
|
||||
anycubicsla_write_float(out, l.lift_speed_mms);
|
||||
anycubicsla_write_float(out, l.exposure_time_s);
|
||||
anycubicsla_write_float(out, l.layer_height_mm);
|
||||
anycubicsla_write_float(out, l.layer44);
|
||||
anycubicsla_write_float(out, l.layer48);
|
||||
}
|
||||
|
||||
void PwmxArchive::export_print(const std::string fname,
|
||||
void AnycubicSLAArchive::export_print(const std::string fname,
|
||||
const SLAPrint &print,
|
||||
const ThumbnailsList &thumbnails,
|
||||
const std::string &/*projectname*/)
|
||||
{
|
||||
std::uint32_t layer_count = m_layers.size();
|
||||
|
||||
pwmx_format_intro intro = {};
|
||||
pwmx_format_header header = {};
|
||||
pwmx_format_preview preview = {};
|
||||
pwmx_format_layers_header layers_header = {};
|
||||
pwmx_format_misc misc = {};
|
||||
anycubicsla_format_intro intro = {};
|
||||
anycubicsla_format_header header = {};
|
||||
anycubicsla_format_preview preview = {};
|
||||
anycubicsla_format_layers_header layers_header = {};
|
||||
anycubicsla_format_misc misc = {};
|
||||
std::vector<uint8_t> layer_images;
|
||||
std::uint32_t image_offset;
|
||||
|
||||
intro.version = 1;
|
||||
assert(m_version == ANYCUBIC_SLA_FORMAT_VERSION_1);
|
||||
|
||||
intro.version = m_version;
|
||||
intro.area_num = 4;
|
||||
intro.header_data_offset = sizeof(intro);
|
||||
intro.preview_data_offset = sizeof(intro) + sizeof(header);
|
||||
intro.layer_data_offset = intro.preview_data_offset + sizeof(preview);
|
||||
intro.image_data_offset = intro.layer_data_offset +
|
||||
sizeof(layers_header) +
|
||||
(sizeof(pwmx_format_layer) * layer_count);
|
||||
(sizeof(anycubicsla_format_layer) * layer_count);
|
||||
|
||||
fill_header(header, misc, print, layer_count);
|
||||
fill_preview(preview, misc, thumbnails);
|
||||
|
@ -513,21 +524,21 @@ void PwmxArchive::export_print(const std::string fname,
|
|||
// open the file and write the contents
|
||||
std::ofstream out;
|
||||
out.open(fname, std::ios::binary | std::ios::out | std::ios::trunc);
|
||||
pwmx_write_intro(out, intro);
|
||||
pwmx_write_header(out, header);
|
||||
pwmx_write_preview(out, preview);
|
||||
anycubicsla_write_intro(out, intro);
|
||||
anycubicsla_write_header(out, header);
|
||||
anycubicsla_write_preview(out, preview);
|
||||
|
||||
layers_header.payload_size = intro.image_data_offset - intro.layer_data_offset -
|
||||
sizeof(layers_header.tag) - sizeof(layers_header.payload_size);
|
||||
layers_header.layer_count = layer_count;
|
||||
pwmx_write_layers_header(out, layers_header);
|
||||
anycubicsla_write_layers_header(out, layers_header);
|
||||
|
||||
//layers
|
||||
layer_images.reserve(layer_count * LAYER_SIZE_ESTIMATE);
|
||||
image_offset = intro.image_data_offset;
|
||||
size_t i = 0;
|
||||
for (const sla::EncodedRaster &rst : m_layers) {
|
||||
pwmx_format_layer l;
|
||||
anycubicsla_format_layer l;
|
||||
std::memset(&l, 0, sizeof(l));
|
||||
l.image_offset = image_offset;
|
||||
l.image_size = rst.size();
|
||||
|
@ -543,7 +554,7 @@ void PwmxArchive::export_print(const std::string fname,
|
|||
l.lift_speed_mms = header.lift_speed_mms;
|
||||
}
|
||||
image_offset += l.image_size;
|
||||
pwmx_write_layer(out, l);
|
||||
anycubicsla_write_layer(out, l);
|
||||
// add the rle encoded layer image into the buffer
|
||||
const char* img_start = reinterpret_cast<const char*>(rst.data());
|
||||
const char* img_end = img_start + rst.size();
|
81
src/libslic3r/Format/AnycubicSLA.hpp
Normal file
81
src/libslic3r/Format/AnycubicSLA.hpp
Normal file
|
@ -0,0 +1,81 @@
|
|||
#ifndef _SLIC3R_FORMAT_PWMX_HPP_
|
||||
#define _SLIC3R_FORMAT_PWMX_HPP_
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "SLAArchiveWriter.hpp"
|
||||
|
||||
#include "libslic3r/PrintConfig.hpp"
|
||||
|
||||
#define ANYCUBIC_SLA_FORMAT_VERSION_1 1
|
||||
#define ANYCUBIC_SLA_FORMAT_VERSION_515 515
|
||||
#define ANYCUBIC_SLA_FORMAT_VERSION_516 516
|
||||
#define ANYCUBIC_SLA_FORMAT_VERSION_517 517
|
||||
|
||||
#define ANYCUBIC_SLA_FORMAT_VERSIONED(FILEFORMAT, NAME, VERSION) \
|
||||
{ FILEFORMAT, { FILEFORMAT, [] (const auto &cfg) { return std::make_unique<AnycubicSLAArchive>(cfg, VERSION); } } }
|
||||
|
||||
#define ANYCUBIC_SLA_FORMAT(FILEFORMAT, NAME) \
|
||||
ANYCUBIC_SLA_FORMAT_VERSIONED(FILEFORMAT, NAME, ANYCUBIC_SLA_FORMAT_VERSION_1)
|
||||
|
||||
/**
|
||||
// Supports only ANYCUBIC_SLA_VERSION_1
|
||||
ANYCUBIC_SLA_FORMAT_VERSIONED("pws", "Photon / Photon S", ANYCUBIC_SLA_VERSION_1),
|
||||
ANYCUBIC_SLA_FORMAT_VERSIONED("pw0", "Photon Zero", ANYCUBIC_SLA_VERSION_1),
|
||||
ANYCUBIC_SLA_FORMAT_VERSIONED("pwx", "Photon X", ANYCUBIC_SLA_VERSION_1),
|
||||
|
||||
// Supports ANYCUBIC_SLA_VERSION_1 and ANYCUBIC_SLA_VERSION_515
|
||||
ANYCUBIC_SLA_FORMAT_VERSIONED("pwmo", "Photon Mono", ANYCUBIC_SLA_VERSION_1),
|
||||
ANYCUBIC_SLA_FORMAT_VERSIONED("pwms", "Photon Mono SE", ANYCUBIC_SLA_VERSION_1),
|
||||
ANYCUBIC_SLA_FORMAT_VERSIONED("dlp", "Photon Ultra", ANYCUBIC_SLA_VERSION_1),
|
||||
ANYCUBIC_SLA_FORMAT_VERSIONED("pwmx", "Photon Mono X", ANYCUBIC_SLA_VERSION_1),
|
||||
ANYCUBIC_SLA_FORMAT_VERSIONED("pmsq", "Photon Mono SQ", ANYCUBIC_SLA_VERSION_1),
|
||||
|
||||
// Supports ANYCUBIC_SLA_VERSION_515 and ANYCUBIC_SLA_VERSION_516
|
||||
ANYCUBIC_SLA_FORMAT_VERSIONED("pwma", "Photon Mono 4K", ANYCUBIC_SLA_VERSION_515),
|
||||
ANYCUBIC_SLA_FORMAT_VERSIONED("pm3", "Photon M3", ANYCUBIC_SLA_VERSION_515),
|
||||
ANYCUBIC_SLA_FORMAT_VERSIONED("pm3m", "Photon M3 Max", ANYCUBIC_SLA_VERSION_515),
|
||||
|
||||
// Supports NYCUBIC_SLA_VERSION_515 and ANYCUBIC_SLA_VERSION_516 and ANYCUBIC_SLA_VERSION_517
|
||||
ANYCUBIC_SLA_FORMAT_VERSIONED("pwmb", "Photon Mono X 6K / Photon M3 Plus", ANYCUBIC_SLA_VERSION_515),
|
||||
ANYCUBIC_SLA_FORMAT_VERSIONED("dl2p", "Photon Photon D2", ANYCUBIC_SLA_VERSION_515),
|
||||
ANYCUBIC_SLA_FORMAT_VERSIONED("pmx2", "Photon Mono X2", ANYCUBIC_SLA_VERSION_515),
|
||||
ANYCUBIC_SLA_FORMAT_VERSIONED("pm3r", "Photon M3 Premium", ANYCUBIC_SLA_VERSION_515),
|
||||
*/
|
||||
|
||||
namespace Slic3r {
|
||||
|
||||
class AnycubicSLAArchive: public SLAArchiveWriter {
|
||||
SLAPrinterConfig m_cfg;
|
||||
uint16_t m_version;
|
||||
|
||||
protected:
|
||||
std::unique_ptr<sla::RasterBase> create_raster() const override;
|
||||
sla::RasterEncoder get_encoder() const override;
|
||||
|
||||
SLAPrinterConfig & cfg() { return m_cfg; }
|
||||
const SLAPrinterConfig & cfg() const { return m_cfg; }
|
||||
|
||||
public:
|
||||
|
||||
AnycubicSLAArchive() = default;
|
||||
explicit AnycubicSLAArchive(const SLAPrinterConfig &cfg):
|
||||
m_cfg(cfg), m_version(ANYCUBIC_SLA_FORMAT_VERSION_1) {}
|
||||
explicit AnycubicSLAArchive(SLAPrinterConfig &&cfg):
|
||||
m_cfg(std::move(cfg)), m_version(ANYCUBIC_SLA_FORMAT_VERSION_1) {}
|
||||
|
||||
explicit AnycubicSLAArchive(const SLAPrinterConfig &cfg, uint16_t version):
|
||||
m_cfg(cfg), m_version(version) {}
|
||||
explicit AnycubicSLAArchive(SLAPrinterConfig &&cfg, uint16_t version):
|
||||
m_cfg(std::move(cfg)), m_version(version) {}
|
||||
|
||||
void export_print(const std::string fname,
|
||||
const SLAPrint &print,
|
||||
const ThumbnailsList &thumbnails,
|
||||
const std::string &projectname = "") override;
|
||||
};
|
||||
|
||||
|
||||
} // namespace Slic3r::sla
|
||||
|
||||
#endif // _SLIC3R_FORMAT_PWMX_HPP_
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
#include "SL1.hpp"
|
||||
#include "SL1_SVG.hpp"
|
||||
#include "pwmx.hpp"
|
||||
#include "AnycubicSLA.hpp"
|
||||
|
||||
#include "libslic3r/libslic3r.h"
|
||||
|
||||
|
@ -33,10 +33,9 @@ static const std::map<std::string, ArchiveEntry> REGISTERED_ARCHIVES {
|
|||
"SL2",
|
||||
{ "sl1_svg", [] (const auto &cfg) { return std::make_unique<SL1_SVGArchive>(cfg); } }
|
||||
},
|
||||
{
|
||||
"pwmx",
|
||||
{ "pwmx", [] (const auto &cfg) { return std::make_unique<PwmxArchive>(cfg); } }
|
||||
}
|
||||
ANYCUBIC_SLA_FORMAT("pwmo", "Photon Mono"),
|
||||
ANYCUBIC_SLA_FORMAT("pwmx", "Photon Mono X"),
|
||||
ANYCUBIC_SLA_FORMAT("pwms", "Photon Mono SE"),
|
||||
};
|
||||
|
||||
std::unique_ptr<SLAArchiveWriter>
|
||||
|
|
|
@ -1,37 +0,0 @@
|
|||
#ifndef _SLIC3R_FORMAT_PWMX_HPP_
|
||||
#define _SLIC3R_FORMAT_PWMX_HPP_
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "SLAArchiveWriter.hpp"
|
||||
|
||||
#include "libslic3r/PrintConfig.hpp"
|
||||
|
||||
namespace Slic3r {
|
||||
|
||||
class PwmxArchive: public SLAArchiveWriter {
|
||||
SLAPrinterConfig m_cfg;
|
||||
|
||||
protected:
|
||||
std::unique_ptr<sla::RasterBase> create_raster() const override;
|
||||
sla::RasterEncoder get_encoder() const override;
|
||||
|
||||
SLAPrinterConfig & cfg() { return m_cfg; }
|
||||
const SLAPrinterConfig & cfg() const { return m_cfg; }
|
||||
|
||||
public:
|
||||
|
||||
PwmxArchive() = default;
|
||||
explicit PwmxArchive(const SLAPrinterConfig &cfg): m_cfg(cfg) {}
|
||||
explicit PwmxArchive(SLAPrinterConfig &&cfg): m_cfg(std::move(cfg)) {}
|
||||
|
||||
void export_print(const std::string fname,
|
||||
const SLAPrint &print,
|
||||
const ThumbnailsList &thumbnails,
|
||||
const std::string &projectname = "") override;
|
||||
};
|
||||
|
||||
|
||||
} // namespace Slic3r::sla
|
||||
|
||||
#endif // _SLIC3R_FORMAT_PWMX_HPP_
|
|
@ -3867,7 +3867,9 @@ void PrintConfigDef::init_sla_params()
|
|||
def->multiline = true;
|
||||
def->full_width = true;
|
||||
def->height = 13;
|
||||
def->mode = comAdvanced;
|
||||
// TODO currently notes are the only way to pass data
|
||||
// for non-PrusaResearch printers. We therefore need to always show them
|
||||
def->mode = comSimple;
|
||||
def->set_default_value(new ConfigOptionString(""));
|
||||
|
||||
def = this->add("material_vendor", coString);
|
||||
|
|
Loading…
Reference in a new issue