Merge branch 'tm_relative_correction_xyz_2'
This commit is contained in:
commit
f8e734cd79
@ -182,6 +182,8 @@ Model Model::read_from_archive(const std::string& input_file, DynamicPrintConfig
|
||||
CustomGCode::update_custom_gcode_per_print_z_from_config(model.custom_gcode_per_print_z, config);
|
||||
CustomGCode::check_mode_for_custom_gcode_per_print_z(model.custom_gcode_per_print_z);
|
||||
|
||||
handle_legacy_sla(*config);
|
||||
|
||||
return model;
|
||||
}
|
||||
|
||||
|
@ -303,6 +303,8 @@ void Preset::normalize(DynamicPrintConfig &config)
|
||||
first_layer_height->value = first_layer_height->get_abs_value(layer_height->value);
|
||||
first_layer_height->percent = false;
|
||||
}
|
||||
|
||||
handle_legacy_sla(config);
|
||||
}
|
||||
|
||||
std::string Preset::remove_invalid_keys(DynamicPrintConfig &config, const DynamicPrintConfig &default_config)
|
||||
@ -544,6 +546,9 @@ static std::vector<std::string> s_Preset_sla_material_options {
|
||||
"exposure_time",
|
||||
"initial_exposure_time",
|
||||
"material_correction",
|
||||
"material_correction_x",
|
||||
"material_correction_y",
|
||||
"material_correction_z",
|
||||
"material_notes",
|
||||
"material_vendor",
|
||||
"default_sla_material_profile",
|
||||
@ -559,6 +564,9 @@ static std::vector<std::string> s_Preset_sla_printer_options {
|
||||
"display_orientation",
|
||||
"fast_tilt_time", "slow_tilt_time", "area_fill",
|
||||
"relative_correction",
|
||||
"relative_correction_x",
|
||||
"relative_correction_y",
|
||||
"relative_correction_z",
|
||||
"absolute_correction",
|
||||
"elefant_foot_compensation",
|
||||
"elefant_foot_min_width",
|
||||
|
@ -3146,7 +3146,31 @@ void PrintConfigDef::init_sla_params()
|
||||
def->tooltip = L("Printer scaling correction");
|
||||
def->min = 0;
|
||||
def->mode = comExpert;
|
||||
def->set_default_value(new ConfigOptionFloats( { 1., 1. } ));
|
||||
def->set_default_value(new ConfigOptionFloats( { 1., 1.} ));
|
||||
|
||||
def = this->add("relative_correction_x", coFloat);
|
||||
def->label = L("Printer scaling correction in X axis");
|
||||
def->full_label = L("Printer scaling X axis correction");
|
||||
def->tooltip = L("Printer scaling correction in X axis");
|
||||
def->min = 0;
|
||||
def->mode = comExpert;
|
||||
def->set_default_value(new ConfigOptionFloat(1.));
|
||||
|
||||
def = this->add("relative_correction_y", coFloat);
|
||||
def->label = L("Printer scaling correction in Y axis");
|
||||
def->full_label = L("Printer scaling X axis correction");
|
||||
def->tooltip = L("Printer scaling correction in Y axis");
|
||||
def->min = 0;
|
||||
def->mode = comExpert;
|
||||
def->set_default_value(new ConfigOptionFloat(1.));
|
||||
|
||||
def = this->add("relative_correction_z", coFloat);
|
||||
def->label = L("Printer scaling correction in Z axis");
|
||||
def->full_label = L("Printer scaling X axis correction");
|
||||
def->tooltip = L("Printer scaling correction in Z axis");
|
||||
def->min = 0;
|
||||
def->mode = comExpert;
|
||||
def->set_default_value(new ConfigOptionFloat(1.));
|
||||
|
||||
def = this->add("absolute_correction", coFloat);
|
||||
def->label = L("Printer absolute correction");
|
||||
@ -3292,7 +3316,28 @@ void PrintConfigDef::init_sla_params()
|
||||
def->tooltip = L("Correction for expansion");
|
||||
def->min = 0;
|
||||
def->mode = comExpert;
|
||||
def->set_default_value(new ConfigOptionFloats( { 1. , 1. } ));
|
||||
def->set_default_value(new ConfigOptionFloats( { 1., 1., 1. } ));
|
||||
|
||||
def = this->add("material_correction_x", coFloat);
|
||||
def->full_label = L("Correction for expansion in X axis");
|
||||
def->tooltip = L("Correction for expansion in X axis");
|
||||
def->min = 0;
|
||||
def->mode = comExpert;
|
||||
def->set_default_value(new ConfigOptionFloat(1.));
|
||||
|
||||
def = this->add("material_correction_y", coFloat);
|
||||
def->full_label = L("Correction for expansion in Y axis");
|
||||
def->tooltip = L("Correction for expansion in Y axis");
|
||||
def->min = 0;
|
||||
def->mode = comExpert;
|
||||
def->set_default_value(new ConfigOptionFloat(1.));
|
||||
|
||||
def = this->add("material_correction_z", coFloat);
|
||||
def->full_label = L("Correction for expansion in Z axis");
|
||||
def->tooltip = L("Correction for expansion in Z axis");
|
||||
def->min = 0;
|
||||
def->mode = comExpert;
|
||||
def->set_default_value(new ConfigOptionFloat(1.));
|
||||
|
||||
def = this->add("material_notes", coString);
|
||||
def->label = L("SLA print material notes");
|
||||
@ -3749,7 +3794,16 @@ void PrintConfigDef::handle_legacy(t_config_option_key &opt_key, std::string &va
|
||||
opt_key = "printhost_apikey";
|
||||
} else if (opt_key == "preset_name") {
|
||||
opt_key = "preset_names";
|
||||
} /*else if (opt_key == "material_correction" || opt_key == "relative_correction") {
|
||||
ConfigOptionFloats p;
|
||||
p.deserialize(value);
|
||||
|
||||
if (p.values.size() < 3) {
|
||||
double firstval = p.values.front();
|
||||
p.values.emplace(p.values.begin(), firstval);
|
||||
value = p.serialize();
|
||||
}
|
||||
}*/
|
||||
|
||||
// Ignore the following obsolete configuration keys:
|
||||
static std::set<std::string> ignore = {
|
||||
@ -3866,6 +3920,28 @@ void DynamicPrintConfig::normalize_fdm()
|
||||
}
|
||||
}
|
||||
|
||||
void handle_legacy_sla(DynamicPrintConfig &config)
|
||||
{
|
||||
for (std::string corr : {"relative_correction", "material_correction"}) {
|
||||
if (config.has(corr)) {
|
||||
if (std::string corr_x = corr + "_x"; !config.has(corr_x)) {
|
||||
auto* opt = config.opt<ConfigOptionFloat>(corr_x, true);
|
||||
opt->value = config.opt<ConfigOptionFloats>(corr)->values[0];
|
||||
}
|
||||
|
||||
if (std::string corr_y = corr + "_y"; !config.has(corr_y)) {
|
||||
auto* opt = config.opt<ConfigOptionFloat>(corr_y, true);
|
||||
opt->value = config.opt<ConfigOptionFloats>(corr)->values[0];
|
||||
}
|
||||
|
||||
if (std::string corr_z = corr + "_z"; !config.has(corr_z)) {
|
||||
auto* opt = config.opt<ConfigOptionFloat>(corr_z, true);
|
||||
opt->value = config.opt<ConfigOptionFloats>(corr)->values[1];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void DynamicPrintConfig::set_num_extruders(unsigned int num_extruders)
|
||||
{
|
||||
const auto &defaults = FullPrintConfig::defaults();
|
||||
|
@ -224,6 +224,8 @@ public:
|
||||
{ PrintConfigDef::handle_legacy(opt_key, value); }
|
||||
};
|
||||
|
||||
void handle_legacy_sla(DynamicPrintConfig &config);
|
||||
|
||||
class StaticPrintConfig : public StaticConfig
|
||||
{
|
||||
public:
|
||||
@ -924,6 +926,9 @@ PRINT_CONFIG_CLASS_DEFINE(
|
||||
((ConfigOptionFloat, exposure_time))
|
||||
((ConfigOptionFloat, initial_exposure_time))
|
||||
((ConfigOptionFloats, material_correction))
|
||||
((ConfigOptionFloat, material_correction_x))
|
||||
((ConfigOptionFloat, material_correction_y))
|
||||
((ConfigOptionFloat, material_correction_z))
|
||||
)
|
||||
|
||||
PRINT_CONFIG_CLASS_DEFINE(
|
||||
@ -940,6 +945,9 @@ PRINT_CONFIG_CLASS_DEFINE(
|
||||
((ConfigOptionBool, display_mirror_x))
|
||||
((ConfigOptionBool, display_mirror_y))
|
||||
((ConfigOptionFloats, relative_correction))
|
||||
((ConfigOptionFloat, relative_correction_x))
|
||||
((ConfigOptionFloat, relative_correction_y))
|
||||
((ConfigOptionFloat, relative_correction_z))
|
||||
((ConfigOptionFloat, absolute_correction))
|
||||
((ConfigOptionFloat, elefant_foot_compensation))
|
||||
((ConfigOptionFloat, elefant_foot_min_width))
|
||||
|
@ -807,7 +807,13 @@ bool SLAPrint::invalidate_state_by_config_options(const std::vector<t_config_opt
|
||||
static std::unordered_set<std::string> steps_full = {
|
||||
"initial_layer_height",
|
||||
"material_correction",
|
||||
"material_correction_x",
|
||||
"material_correction_y",
|
||||
"material_correction_z",
|
||||
"relative_correction",
|
||||
"relative_correction_x",
|
||||
"relative_correction_y",
|
||||
"relative_correction_z",
|
||||
"absolute_correction",
|
||||
"elefant_foot_compensation",
|
||||
"elefant_foot_min_width",
|
||||
@ -1047,15 +1053,15 @@ Vec3d SLAPrint::relative_correction() const
|
||||
Vec3d corr(1., 1., 1.);
|
||||
|
||||
if(printer_config().relative_correction.values.size() >= 2) {
|
||||
corr.x() = printer_config().relative_correction.values[0];
|
||||
corr.y() = corr.x();
|
||||
corr.z() = printer_config().relative_correction.values[1];
|
||||
corr.x() = printer_config().relative_correction_x.value;
|
||||
corr.y() = printer_config().relative_correction_y.value;
|
||||
corr.z() = printer_config().relative_correction_z.value;
|
||||
}
|
||||
|
||||
if(material_config().material_correction.values.size() >= 2) {
|
||||
corr.x() *= material_config().material_correction.values[0];
|
||||
corr.y() = corr.x();
|
||||
corr.z() *= material_config().material_correction.values[1];
|
||||
corr.x() *= material_config().material_correction_x.value;
|
||||
corr.y() *= material_config().material_correction_y.value;
|
||||
corr.z() *= material_config().material_correction_z.value;
|
||||
}
|
||||
|
||||
return corr;
|
||||
|
@ -2479,14 +2479,11 @@ void TabPrinter::build_sla()
|
||||
|
||||
optgroup = page->new_optgroup(L("Corrections"));
|
||||
line = Line{ m_config->def()->get("relative_correction")->full_label, "" };
|
||||
// std::vector<std::string> axes{ "X", "Y", "Z" };
|
||||
std::vector<std::string> axes{ "XY", "Z" };
|
||||
int id = 0;
|
||||
std::vector<std::string> axes{ "X", "Y", "Z" };
|
||||
for (auto& axis : axes) {
|
||||
auto opt = optgroup->get_option("relative_correction", id);
|
||||
auto opt = optgroup->get_option(std::string("relative_correction_") + char(std::tolower(axis[0])));
|
||||
opt.opt.label = axis;
|
||||
line.append_option(opt);
|
||||
++id;
|
||||
}
|
||||
optgroup->append_line(line);
|
||||
optgroup->append_single_option_line("absolute_correction");
|
||||
@ -4204,20 +4201,15 @@ void TabSLAMaterial::build()
|
||||
optgroup->append_single_option_line("initial_exposure_time");
|
||||
|
||||
optgroup = page->new_optgroup(L("Corrections"));
|
||||
std::vector<std::string> corrections = {"material_correction"};
|
||||
// std::vector<std::string> axes{ "X", "Y", "Z" };
|
||||
std::vector<std::string> axes{ "XY", "Z" };
|
||||
for (auto& opt_key : corrections) {
|
||||
auto line = Line{ m_config->def()->get(opt_key)->full_label, "" };
|
||||
int id = 0;
|
||||
auto line = Line{ m_config->def()->get("material_correction")->full_label, "" };
|
||||
std::vector<std::string> axes{ "X", "Y", "Z" };
|
||||
for (auto& axis : axes) {
|
||||
auto opt = optgroup->get_option(opt_key, id);
|
||||
auto opt = optgroup->get_option(std::string("material_correction_") + char(std::tolower(axis[0])));
|
||||
opt.opt.label = axis;
|
||||
line.append_option(opt);
|
||||
++id;
|
||||
}
|
||||
|
||||
optgroup->append_line(line);
|
||||
}
|
||||
|
||||
page = add_options_page(L("Notes"), "note.png");
|
||||
optgroup = page->new_optgroup(L("Notes"), 0);
|
||||
|
Loading…
Reference in New Issue
Block a user