mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-10-22 16:21:24 -06:00
Integration of SLA parameters, WIP
This commit is contained in:
parent
bf4871d7f8
commit
f0c1c15b62
10 changed files with 506 additions and 145 deletions
|
@ -49,9 +49,9 @@ enum ConfigOptionType {
|
|||
coPercents = coPercent + coVectorType,
|
||||
// a fraction or an absolute value
|
||||
coFloatOrPercent = 5,
|
||||
// single 2d point. Currently not used.
|
||||
// single 2d point (Point2f). Currently not used.
|
||||
coPoint = 6,
|
||||
// vector of 2d points. Currently used for the definition of the print bed and for the extruder offsets.
|
||||
// vector of 2d points (Point2f). Currently used for the definition of the print bed and for the extruder offsets.
|
||||
coPoints = coPoint + coVectorType,
|
||||
// single boolean value
|
||||
coBool = 7,
|
||||
|
@ -821,12 +821,7 @@ public:
|
|||
bool deserialize(const std::string &str, bool append = false) override
|
||||
{
|
||||
UNUSED(append);
|
||||
const t_config_enum_values &enum_keys_map = ConfigOptionEnum<T>::get_enum_values();
|
||||
auto it = enum_keys_map.find(str);
|
||||
if (it == enum_keys_map.end())
|
||||
return false;
|
||||
this->value = static_cast<T>(it->second);
|
||||
return true;
|
||||
return from_string(str, this->value);
|
||||
}
|
||||
|
||||
static bool has(T value)
|
||||
|
@ -838,7 +833,7 @@ public:
|
|||
}
|
||||
|
||||
// Map from an enum name to an enum integer value.
|
||||
static t_config_enum_names& get_enum_names()
|
||||
static const t_config_enum_names& get_enum_names()
|
||||
{
|
||||
static t_config_enum_names names;
|
||||
if (names.empty()) {
|
||||
|
@ -855,7 +850,17 @@ public:
|
|||
return names;
|
||||
}
|
||||
// Map from an enum name to an enum integer value.
|
||||
static t_config_enum_values& get_enum_values();
|
||||
static const t_config_enum_values& get_enum_values();
|
||||
|
||||
static bool from_string(const std::string &str, T &value)
|
||||
{
|
||||
const t_config_enum_values &enum_keys_map = ConfigOptionEnum<T>::get_enum_values();
|
||||
auto it = enum_keys_map.find(str);
|
||||
if (it == enum_keys_map.end())
|
||||
return false;
|
||||
value = static_cast<T>(it->second);
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
// Generic enum configuration value.
|
||||
|
@ -900,7 +905,7 @@ public:
|
|||
// What type? bool, int, string etc.
|
||||
ConfigOptionType type = coNone;
|
||||
// Default value of this option. The default value object is owned by ConfigDef, it is released in its destructor.
|
||||
ConfigOption *default_value = nullptr;
|
||||
const ConfigOption *default_value = nullptr;
|
||||
|
||||
// Usually empty.
|
||||
// Special values - "i_enum_open", "f_enum_open" to provide combo box for int or float selection,
|
||||
|
@ -958,7 +963,7 @@ public:
|
|||
std::vector<std::string> enum_labels;
|
||||
// For enums (when type == coEnum). Maps enum_values to enums.
|
||||
// Initialized by ConfigOptionEnum<xxx>::get_enum_values()
|
||||
t_config_enum_values *enum_keys_map = nullptr;
|
||||
const t_config_enum_values *enum_keys_map = nullptr;
|
||||
|
||||
bool has_enum_value(const std::string &value) const {
|
||||
for (const std::string &v : enum_values)
|
||||
|
|
|
@ -17,9 +17,51 @@ namespace Slic3r {
|
|||
#define L(s) Slic3r::I18N::translate(s)
|
||||
|
||||
PrintConfigDef::PrintConfigDef()
|
||||
{
|
||||
this->init_common_params();
|
||||
this->init_fff_params();
|
||||
this->init_sla_params();
|
||||
}
|
||||
|
||||
void PrintConfigDef::init_common_params()
|
||||
{
|
||||
t_optiondef_map &Options = this->options;
|
||||
ConfigOptionDef* def;
|
||||
|
||||
def = this->add("printer_technology", coEnum);
|
||||
def->label = L("Printer technology");
|
||||
def->tooltip = L("Printer technology");
|
||||
def->cli = "printer-technology=s";
|
||||
def->enum_keys_map = &ConfigOptionEnum<PrinterTechnology>::get_enum_values();
|
||||
def->enum_values.push_back("FFF");
|
||||
def->enum_values.push_back("SLA");
|
||||
def->default_value = new ConfigOptionEnum<PrinterTechnology>(ptFFF);
|
||||
|
||||
def = this->add("bed_shape", coPoints);
|
||||
def->label = L("Bed shape");
|
||||
def->default_value = new ConfigOptionPoints { Pointf(0,0), Pointf(200,0), Pointf(200,200), Pointf(0,200) };
|
||||
|
||||
def = this->add("layer_height", coFloat);
|
||||
def->label = L("Layer height");
|
||||
def->category = L("Layers and Perimeters");
|
||||
def->tooltip = L("This setting controls the height (and thus the total number) of the slices/layers. "
|
||||
"Thinner layers give better accuracy but take more time to print.");
|
||||
def->sidetext = L("mm");
|
||||
def->cli = "layer-height=f";
|
||||
def->min = 0;
|
||||
def->default_value = new ConfigOptionFloat(0.3);
|
||||
|
||||
def = this->add("max_print_height", coFloat);
|
||||
def->label = L("Max print height");
|
||||
def->tooltip = L("Set this to the maximum height that can be reached by your extruder while printing.");
|
||||
def->sidetext = L("mm");
|
||||
def->cli = "max-print-height=f";
|
||||
def->default_value = new ConfigOptionFloat(200.0);
|
||||
}
|
||||
|
||||
void PrintConfigDef::init_fff_params()
|
||||
{
|
||||
t_optiondef_map &Options = this->options;
|
||||
ConfigOptionDef* def;
|
||||
|
||||
// Maximum extruder temperature, bumped to 1500 to support printing of glass.
|
||||
|
@ -33,10 +75,6 @@ PrintConfigDef::PrintConfigDef()
|
|||
def->cli = "avoid-crossing-perimeters!";
|
||||
def->default_value = new ConfigOptionBool(false);
|
||||
|
||||
def = this->add("bed_shape", coPoints);
|
||||
def->label = L("Bed shape");
|
||||
def->default_value = new ConfigOptionPoints { Pointf(0,0), Pointf(200,0), Pointf(200,200), Pointf(0,200) };
|
||||
|
||||
def = this->add("bed_temperature", coInts);
|
||||
def->label = L("Other layers");
|
||||
def->tooltip = L("Bed temperature for layers after the first one. "
|
||||
|
@ -882,16 +920,6 @@ PrintConfigDef::PrintConfigDef()
|
|||
def->height = 50;
|
||||
def->default_value = new ConfigOptionString("");
|
||||
|
||||
def = this->add("layer_height", coFloat);
|
||||
def->label = L("Layer height");
|
||||
def->category = L("Layers and Perimeters");
|
||||
def->tooltip = L("This setting controls the height (and thus the total number) of the slices/layers. "
|
||||
"Thinner layers give better accuracy but take more time to print.");
|
||||
def->sidetext = L("mm");
|
||||
def->cli = "layer-height=f";
|
||||
def->min = 0;
|
||||
def->default_value = new ConfigOptionFloat(0.3);
|
||||
|
||||
def = this->add("silent_mode", coBool);
|
||||
def->label = L("Support silent mode");
|
||||
def->tooltip = L("Set silent mode for the G-code flavor");
|
||||
|
@ -1004,13 +1032,6 @@ PrintConfigDef::PrintConfigDef()
|
|||
def->min = 0;
|
||||
def->default_value = new ConfigOptionFloats { 0. };
|
||||
|
||||
def = this->add("max_print_height", coFloat);
|
||||
def->label = L("Max print height");
|
||||
def->tooltip = L("Set this to the maximum height that can be reached by your extruder while printing.");
|
||||
def->sidetext = L("mm");
|
||||
def->cli = "max-print-height=f";
|
||||
def->default_value = new ConfigOptionFloat(200.0);
|
||||
|
||||
def = this->add("max_print_speed", coFloat);
|
||||
def->label = L("Max print speed");
|
||||
def->tooltip = L("When setting other speed settings to 0 Slic3r will autocalculate the optimal speed "
|
||||
|
@ -2037,6 +2058,90 @@ PrintConfigDef::PrintConfigDef()
|
|||
def->default_value = new ConfigOptionFloat(0);
|
||||
}
|
||||
|
||||
void PrintConfigDef::init_sla_params()
|
||||
{
|
||||
t_optiondef_map &Options = this->options;
|
||||
ConfigOptionDef* def;
|
||||
|
||||
// SLA Printer settings
|
||||
def = this->add("display_width", coFloat);
|
||||
def->label = L("Display width");
|
||||
def->tooltip = L("Width of the display");
|
||||
def->cli = "display-width=f";
|
||||
def->min = 1;
|
||||
def->default_value = new ConfigOptionFloat(150.);
|
||||
|
||||
def = this->add("display_height", coFloat);
|
||||
def->label = L("Display height");
|
||||
def->tooltip = L("Height of the display");
|
||||
def->cli = "display-height=f";
|
||||
def->min = 1;
|
||||
def->default_value = new ConfigOptionFloat(100.);
|
||||
|
||||
def = this->add("display_pixels_x", coInt);
|
||||
def->label = L("Number of pixels in X");
|
||||
def->tooltip = L("Number of pixels in X");
|
||||
def->cli = "display-pixels-x=i";
|
||||
def->min = 100;
|
||||
def->default_value = new ConfigOptionInt(2000);
|
||||
|
||||
def = this->add("display_pixels_y", coInt);
|
||||
def->label = L("Number of pixels in Y");
|
||||
def->tooltip = L("Number of pixels in Y");
|
||||
def->cli = "display-pixels-y=i";
|
||||
def->min = 100;
|
||||
def->default_value = new ConfigOptionInt(1000);
|
||||
|
||||
def = this->add("printer_correction", coFloats);
|
||||
def->label = L("Printer scaling correction");
|
||||
def->tooltip = L("Printer scaling correction");
|
||||
def->min = 0;
|
||||
def->default_value = new ConfigOptionFloats( { 1., 1., 1. } );
|
||||
|
||||
// SLA Material settings.
|
||||
def = this->add("initial_layer_height", coFloat);
|
||||
def->label = L("Initial layer height");
|
||||
def->tooltip = L("Initial layer height");
|
||||
def->sidetext = L("mm");
|
||||
def->cli = "initial-layer-height=f";
|
||||
def->min = 0;
|
||||
def->default_value = new ConfigOptionFloat(0.3);
|
||||
|
||||
def = this->add("exposure_time", coFloat);
|
||||
def->label = L("Exposure time");
|
||||
def->tooltip = L("Exposure time");
|
||||
def->sidetext = L("s");
|
||||
def->cli = "exposure-time=f";
|
||||
def->min = 0;
|
||||
def->default_value = new ConfigOptionFloat(10);
|
||||
|
||||
def = this->add("initial_exposure_time", coFloat);
|
||||
def->label = L("Initial exposure time");
|
||||
def->tooltip = L("Initial exposure time");
|
||||
def->sidetext = L("s");
|
||||
def->cli = "initial-exposure-time=f";
|
||||
def->min = 0;
|
||||
def->default_value = new ConfigOptionFloat(15);
|
||||
|
||||
def = this->add("material_correction_printing", coFloats);
|
||||
def->label = L("Correction for expansion when printing");
|
||||
def->tooltip = L("Correction for expansion when printing");
|
||||
def->min = 0;
|
||||
def->default_value = new ConfigOptionFloats( { 1. , 1., 1. } );
|
||||
|
||||
def = this->add("material_correction_curing", coFloats);
|
||||
def->label = L("Correction for expansion after curing");
|
||||
def->tooltip = L("Correction for expansion after curing");
|
||||
def->min = 0;
|
||||
def->default_value = new ConfigOptionFloats( { 1. , 1., 1. } );
|
||||
|
||||
def = this->add("default_sla_material_profile", coString);
|
||||
def->label = L("Default SLA material profile");
|
||||
def->tooltip = L("Default print profile associated with the current printer profile. "
|
||||
"On selection of the current printer profile, this print profile will be activated.");
|
||||
def->default_value = new ConfigOptionString();
|
||||
}
|
||||
|
||||
void PrintConfigDef::handle_legacy(t_config_option_key &opt_key, std::string &value)
|
||||
{
|
||||
// handle legacy options
|
||||
|
@ -2362,4 +2467,8 @@ StaticPrintConfig::StaticCache<class Slic3r::PrintConfig> PrintConfig::s_c
|
|||
StaticPrintConfig::StaticCache<class Slic3r::HostConfig> HostConfig::s_cache_HostConfig;
|
||||
StaticPrintConfig::StaticCache<class Slic3r::FullPrintConfig> FullPrintConfig::s_cache_FullPrintConfig;
|
||||
|
||||
StaticPrintConfig::StaticCache<class Slic3r::SLAMaterialConfig> SLAMaterialConfig::s_cache_SLAMaterialConfig;
|
||||
StaticPrintConfig::StaticCache<class Slic3r::SLAPrinterConfig> SLAPrinterConfig::s_cache_SLAPrinterConfig;
|
||||
StaticPrintConfig::StaticCache<class Slic3r::SLAFullPrintConfig> SLAFullPrintConfig::s_cache_SLAFullPrintConfig;
|
||||
|
||||
}
|
||||
|
|
|
@ -22,6 +22,14 @@
|
|||
|
||||
namespace Slic3r {
|
||||
|
||||
enum PrinterTechnology
|
||||
{
|
||||
// Fused Filament Fabrication
|
||||
ptFFF,
|
||||
// Stereolitography
|
||||
ptSLA,
|
||||
};
|
||||
|
||||
enum GCodeFlavor {
|
||||
gcfRepRap, gcfRepetier, gcfTeacup, gcfMakerWare, gcfMarlin, gcfSailfish, gcfMach3, gcfMachinekit,
|
||||
gcfSmoothie, gcfNoExtrusion,
|
||||
|
@ -44,7 +52,16 @@ enum FilamentType {
|
|||
ftPLA, ftABS, ftPET, ftHIPS, ftFLEX, ftSCAFF, ftEDGE, ftNGEN, ftPVA
|
||||
};
|
||||
|
||||
template<> inline t_config_enum_values& ConfigOptionEnum<GCodeFlavor>::get_enum_values() {
|
||||
template<> inline const t_config_enum_values& ConfigOptionEnum<PrinterTechnology>::get_enum_values() {
|
||||
static t_config_enum_values keys_map;
|
||||
if (keys_map.empty()) {
|
||||
keys_map["FFF"] = ptFFF;
|
||||
keys_map["SLA"] = ptSLA;
|
||||
}
|
||||
return keys_map;
|
||||
}
|
||||
|
||||
template<> inline const t_config_enum_values& ConfigOptionEnum<GCodeFlavor>::get_enum_values() {
|
||||
static t_config_enum_values keys_map;
|
||||
if (keys_map.empty()) {
|
||||
keys_map["reprap"] = gcfRepRap;
|
||||
|
@ -61,7 +78,7 @@ template<> inline t_config_enum_values& ConfigOptionEnum<GCodeFlavor>::get_enum_
|
|||
return keys_map;
|
||||
}
|
||||
|
||||
template<> inline t_config_enum_values& ConfigOptionEnum<InfillPattern>::get_enum_values() {
|
||||
template<> inline const t_config_enum_values& ConfigOptionEnum<InfillPattern>::get_enum_values() {
|
||||
static t_config_enum_values keys_map;
|
||||
if (keys_map.empty()) {
|
||||
keys_map["rectilinear"] = ipRectilinear;
|
||||
|
@ -81,7 +98,7 @@ template<> inline t_config_enum_values& ConfigOptionEnum<InfillPattern>::get_enu
|
|||
return keys_map;
|
||||
}
|
||||
|
||||
template<> inline t_config_enum_values& ConfigOptionEnum<SupportMaterialPattern>::get_enum_values() {
|
||||
template<> inline const t_config_enum_values& ConfigOptionEnum<SupportMaterialPattern>::get_enum_values() {
|
||||
static t_config_enum_values keys_map;
|
||||
if (keys_map.empty()) {
|
||||
keys_map["rectilinear"] = smpRectilinear;
|
||||
|
@ -91,7 +108,7 @@ template<> inline t_config_enum_values& ConfigOptionEnum<SupportMaterialPattern>
|
|||
return keys_map;
|
||||
}
|
||||
|
||||
template<> inline t_config_enum_values& ConfigOptionEnum<SeamPosition>::get_enum_values() {
|
||||
template<> inline const t_config_enum_values& ConfigOptionEnum<SeamPosition>::get_enum_values() {
|
||||
static t_config_enum_values keys_map;
|
||||
if (keys_map.empty()) {
|
||||
keys_map["random"] = spRandom;
|
||||
|
@ -102,7 +119,7 @@ template<> inline t_config_enum_values& ConfigOptionEnum<SeamPosition>::get_enum
|
|||
return keys_map;
|
||||
}
|
||||
|
||||
template<> inline t_config_enum_values& ConfigOptionEnum<FilamentType>::get_enum_values() {
|
||||
template<> inline const t_config_enum_values& ConfigOptionEnum<FilamentType>::get_enum_values() {
|
||||
static t_config_enum_values keys_map;
|
||||
if (keys_map.empty()) {
|
||||
keys_map["PLA"] = ftPLA;
|
||||
|
@ -126,6 +143,11 @@ public:
|
|||
PrintConfigDef();
|
||||
|
||||
static void handle_legacy(t_config_option_key &opt_key, std::string &value);
|
||||
|
||||
private:
|
||||
void init_common_params();
|
||||
void init_fff_params();
|
||||
void init_sla_params();
|
||||
};
|
||||
|
||||
// The one and only global definition of SLic3r configuration options.
|
||||
|
@ -822,6 +844,73 @@ protected:
|
|||
}
|
||||
};
|
||||
|
||||
class SLAMaterialConfig : public StaticPrintConfig
|
||||
{
|
||||
STATIC_PRINT_CONFIG_CACHE(SLAMaterialConfig)
|
||||
public:
|
||||
ConfigOptionFloat layer_height;
|
||||
ConfigOptionFloat initial_layer_height;
|
||||
ConfigOptionFloat exposure_time;
|
||||
ConfigOptionFloat initial_exposure_time;
|
||||
ConfigOptionFloats material_correction_printing;
|
||||
ConfigOptionFloats material_correction_curing;
|
||||
protected:
|
||||
void initialize(StaticCacheBase &cache, const char *base_ptr)
|
||||
{
|
||||
OPT_PTR(layer_height);
|
||||
OPT_PTR(initial_layer_height);
|
||||
OPT_PTR(exposure_time);
|
||||
OPT_PTR(initial_exposure_time);
|
||||
OPT_PTR(material_correction_printing);
|
||||
OPT_PTR(material_correction_curing);
|
||||
}
|
||||
};
|
||||
|
||||
class SLAPrinterConfig : public StaticPrintConfig
|
||||
{
|
||||
STATIC_PRINT_CONFIG_CACHE(SLAPrinterConfig)
|
||||
public:
|
||||
ConfigOptionEnum<PrinterTechnology> printer_technology;
|
||||
ConfigOptionPoints bed_shape;
|
||||
ConfigOptionFloat max_print_height;
|
||||
ConfigOptionFloat display_width;
|
||||
ConfigOptionFloat display_height;
|
||||
ConfigOptionInt display_pixels_x;
|
||||
ConfigOptionInt display_pixels_y;
|
||||
ConfigOptionFloats printer_correction;
|
||||
protected:
|
||||
void initialize(StaticCacheBase &cache, const char *base_ptr)
|
||||
{
|
||||
OPT_PTR(printer_technology);
|
||||
OPT_PTR(bed_shape);
|
||||
OPT_PTR(max_print_height);
|
||||
OPT_PTR(display_width);
|
||||
OPT_PTR(display_height);
|
||||
OPT_PTR(display_pixels_x);
|
||||
OPT_PTR(display_pixels_y);
|
||||
OPT_PTR(printer_correction);
|
||||
}
|
||||
};
|
||||
|
||||
class SLAFullPrintConfig : public SLAPrinterConfig, public SLAMaterialConfig
|
||||
{
|
||||
STATIC_PRINT_CONFIG_CACHE_DERIVED(SLAFullPrintConfig)
|
||||
SLAFullPrintConfig() : SLAPrinterConfig(0), SLAMaterialConfig(0) { initialize_cache(); *this = s_cache_SLAFullPrintConfig.defaults(); }
|
||||
|
||||
public:
|
||||
// Validate the SLAFullPrintConfig. Returns an empty string on success, otherwise an error message is returned.
|
||||
// std::string validate();
|
||||
|
||||
protected:
|
||||
// Protected constructor to be called to initialize ConfigCache::m_default.
|
||||
SLAFullPrintConfig(int) : SLAPrinterConfig(0), SLAMaterialConfig(0) {}
|
||||
void initialize(StaticCacheBase &cache, const char *base_ptr)
|
||||
{
|
||||
this->SLAPrinterConfig ::initialize(cache, base_ptr);
|
||||
this->SLAMaterialConfig::initialize(cache, base_ptr);
|
||||
}
|
||||
};
|
||||
|
||||
#undef STATIC_PRINT_CONFIG_CACHE
|
||||
#undef STATIC_PRINT_CONFIG_CACHE_BASE
|
||||
#undef STATIC_PRINT_CONFIG_CACHE_DERIVED
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue