diff --git a/resources/profiles/Anycubic.idx b/resources/profiles/Anycubic.idx index e2cf7b0873..a941cef9c2 100644 --- a/resources/profiles/Anycubic.idx +++ b/resources/profiles/Anycubic.idx @@ -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. diff --git a/resources/profiles/Anycubic.ini b/resources/profiles/Anycubic.ini index 9bebbbe765..771b38d012 100644 --- a/resources/profiles/Anycubic.ini +++ b/resources/profiles/Anycubic.ini @@ -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 \ No newline at end of file +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 \ No newline at end of file diff --git a/resources/profiles/Anycubic/PHOTON MONO SE_thumbnail.png b/resources/profiles/Anycubic/PHOTON MONO SE_thumbnail.png new file mode 100644 index 0000000000..9fa39cb4f1 Binary files /dev/null and b/resources/profiles/Anycubic/PHOTON MONO SE_thumbnail.png differ diff --git a/resources/profiles/Anycubic/PHOTON MONO_thumbnail.png b/resources/profiles/Anycubic/PHOTON MONO_thumbnail.png new file mode 100644 index 0000000000..0aaf5c4cd6 Binary files /dev/null and b/resources/profiles/Anycubic/PHOTON MONO_thumbnail.png differ diff --git a/src/libslic3r/CMakeLists.txt b/src/libslic3r/CMakeLists.txt index 098131e008..61046e961a 100644 --- a/src/libslic3r/CMakeLists.txt +++ b/src/libslic3r/CMakeLists.txt @@ -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 diff --git a/src/libslic3r/Format/pwmx.cpp b/src/libslic3r/Format/AnycubicSLA.cpp similarity index 72% rename from src/libslic3r/Format/pwmx.cpp rename to src/libslic3r/Format/AnycubicSLA.cpp index f3f0f6802a..6eeb6b3ea6 100644 --- a/src/libslic3r/Format/pwmx.cpp +++ b/src/libslic3r/Format/AnycubicSLA.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(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; -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 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 PwmxArchive::create_raster() const +std::unique_ptr AnycubicSLAArchive::create_raster() const { sla::Resolution res; sla::PixelDim pxdim; @@ -389,13 +398,13 @@ std::unique_ptr 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 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(rst.data()); const char* img_end = img_start + rst.size(); diff --git a/src/libslic3r/Format/AnycubicSLA.hpp b/src/libslic3r/Format/AnycubicSLA.hpp new file mode 100644 index 0000000000..46eb68d00b --- /dev/null +++ b/src/libslic3r/Format/AnycubicSLA.hpp @@ -0,0 +1,81 @@ +#ifndef _SLIC3R_FORMAT_PWMX_HPP_ +#define _SLIC3R_FORMAT_PWMX_HPP_ + +#include + +#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(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 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_ diff --git a/src/libslic3r/Format/SLAArchiveWriter.cpp b/src/libslic3r/Format/SLAArchiveWriter.cpp index b28c2c6806..7546d7c46a 100644 --- a/src/libslic3r/Format/SLAArchiveWriter.cpp +++ b/src/libslic3r/Format/SLAArchiveWriter.cpp @@ -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 REGISTERED_ARCHIVES { "SL2", { "sl1_svg", [] (const auto &cfg) { return std::make_unique(cfg); } } }, - { - "pwmx", - { "pwmx", [] (const auto &cfg) { return std::make_unique(cfg); } } - } + ANYCUBIC_SLA_FORMAT("pwmo", "Photon Mono"), + ANYCUBIC_SLA_FORMAT("pwmx", "Photon Mono X"), + ANYCUBIC_SLA_FORMAT("pwms", "Photon Mono SE"), }; std::unique_ptr diff --git a/src/libslic3r/Format/pwmx.hpp b/src/libslic3r/Format/pwmx.hpp deleted file mode 100644 index 6d667fab70..0000000000 --- a/src/libslic3r/Format/pwmx.hpp +++ /dev/null @@ -1,37 +0,0 @@ -#ifndef _SLIC3R_FORMAT_PWMX_HPP_ -#define _SLIC3R_FORMAT_PWMX_HPP_ - -#include - -#include "SLAArchiveWriter.hpp" - -#include "libslic3r/PrintConfig.hpp" - -namespace Slic3r { - -class PwmxArchive: public SLAArchiveWriter { - SLAPrinterConfig m_cfg; - -protected: - std::unique_ptr 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_ diff --git a/src/libslic3r/PrintConfig.cpp b/src/libslic3r/PrintConfig.cpp index 3531420299..2d5a3b1509 100644 --- a/src/libslic3r/PrintConfig.cpp +++ b/src/libslic3r/PrintConfig.cpp @@ -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);