Scaling correction parameters in material and print conf.
Scaling is applied in sla_trafo but no effect unless set before model import.
This commit is contained in:
parent
703b9bda32
commit
c6b5fe05e4
5 changed files with 38 additions and 26 deletions
src
|
@ -2296,16 +2296,11 @@ void PrintConfigDef::init_sla_params()
|
||||||
def->min = 0;
|
def->min = 0;
|
||||||
def->default_value = new ConfigOptionFloat(15);
|
def->default_value = new ConfigOptionFloat(15);
|
||||||
|
|
||||||
def = this->add("material_correction_printing", coFloats);
|
def = this->add("material_correction", coFloats);
|
||||||
def->full_label = L("Correction for expansion when printing");
|
def->full_label = L("Correction for expansion");
|
||||||
def->tooltip = L("Correction for expansion when printing");
|
def->tooltip = L("Correction for expansion");
|
||||||
def->min = 0;
|
|
||||||
def->default_value = new ConfigOptionFloats( { 1. , 1., 1. } );
|
|
||||||
|
|
||||||
def = this->add("material_correction_curing", coFloats);
|
|
||||||
def->full_label = L("Correction for expansion after curing");
|
|
||||||
def->tooltip = L("Correction for expansion after curing");
|
|
||||||
def->min = 0;
|
def->min = 0;
|
||||||
|
def->mode = comExpert;
|
||||||
def->default_value = new ConfigOptionFloats( { 1. , 1., 1. } );
|
def->default_value = new ConfigOptionFloats( { 1. , 1., 1. } );
|
||||||
|
|
||||||
def = this->add("material_notes", coString);
|
def = this->add("material_notes", coString);
|
||||||
|
|
|
@ -1056,16 +1056,14 @@ public:
|
||||||
ConfigOptionFloat initial_layer_height;
|
ConfigOptionFloat initial_layer_height;
|
||||||
ConfigOptionFloat exposure_time;
|
ConfigOptionFloat exposure_time;
|
||||||
ConfigOptionFloat initial_exposure_time;
|
ConfigOptionFloat initial_exposure_time;
|
||||||
ConfigOptionFloats material_correction_printing;
|
ConfigOptionFloats material_correction;
|
||||||
ConfigOptionFloats material_correction_curing;
|
|
||||||
protected:
|
protected:
|
||||||
void initialize(StaticCacheBase &cache, const char *base_ptr)
|
void initialize(StaticCacheBase &cache, const char *base_ptr)
|
||||||
{
|
{
|
||||||
OPT_PTR(initial_layer_height);
|
OPT_PTR(initial_layer_height);
|
||||||
OPT_PTR(exposure_time);
|
OPT_PTR(exposure_time);
|
||||||
OPT_PTR(initial_exposure_time);
|
OPT_PTR(initial_exposure_time);
|
||||||
OPT_PTR(material_correction_printing);
|
OPT_PTR(material_correction);
|
||||||
OPT_PTR(material_correction_curing);
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -85,17 +85,33 @@ void SLAPrint::clear()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Transformation without rotation around Z and without a shift by X and Y.
|
// Transformation without rotation around Z and without a shift by X and Y.
|
||||||
static Transform3d sla_trafo(const ModelObject &model_object)
|
static Transform3d sla_trafo(const ModelObject &model_object, const SLAPrinterConfig& pconf, const SLAMaterialConfig& mconf)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
Vec3d corr(1., 1., 1.);
|
||||||
|
|
||||||
|
if(pconf.printer_correction.values.size() == 3) {
|
||||||
|
corr(X) = pconf.printer_correction.values[X];
|
||||||
|
corr(Y) = pconf.printer_correction.values[Y];
|
||||||
|
corr(Z) = pconf.printer_correction.values[Z];
|
||||||
|
}
|
||||||
|
|
||||||
|
if(mconf.material_correction.values.size() == 3) {
|
||||||
|
corr(X) *= mconf.material_correction.values[X];
|
||||||
|
corr(Y) *= mconf.material_correction.values[Y];
|
||||||
|
corr(Z) *= mconf.material_correction.values[Z];
|
||||||
|
}
|
||||||
|
|
||||||
ModelInstance &model_instance = *model_object.instances.front();
|
ModelInstance &model_instance = *model_object.instances.front();
|
||||||
Vec3d offset = model_instance.get_offset();
|
Vec3d offset = model_instance.get_offset();
|
||||||
Vec3d rotation = model_instance.get_rotation();
|
Vec3d rotation = model_instance.get_rotation();
|
||||||
offset(0) = 0.;
|
offset(0) = 0.;
|
||||||
offset(1) = 0.;
|
offset(1) = 0.;
|
||||||
rotation(2) = 0.;
|
rotation(2) = 0.;
|
||||||
Transform3d trafo = Geometry::assemble_transform(offset, rotation, model_instance.get_scaling_factor(), model_instance.get_mirror());
|
Transform3d trafo = Geometry::assemble_transform(offset, rotation, model_instance.get_scaling_factor().cwiseProduct(corr), model_instance.get_mirror());
|
||||||
if (model_instance.is_left_handed())
|
if (model_instance.is_left_handed())
|
||||||
trafo = Eigen::Scaling(Vec3d(-1., 1., 1.)) * trafo;
|
trafo = Eigen::Scaling(Vec3d(-1., 1., 1.)) * trafo;
|
||||||
|
|
||||||
return trafo;
|
return trafo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -320,7 +336,7 @@ SLAPrint::ApplyStatus SLAPrint::apply(const Model &model, const DynamicPrintConf
|
||||||
bool sla_trafo_differs =
|
bool sla_trafo_differs =
|
||||||
model_object.instances.empty() != model_object_new.instances.empty() ||
|
model_object.instances.empty() != model_object_new.instances.empty() ||
|
||||||
(! model_object.instances.empty() &&
|
(! model_object.instances.empty() &&
|
||||||
(! sla_trafo(model_object).isApprox(sla_trafo(model_object_new)) ||
|
(! sla_trafo(model_object, m_printer_config, m_material_config).isApprox(sla_trafo(model_object_new, m_printer_config, m_material_config)) ||
|
||||||
model_object.instances.front()->is_left_handed() != model_object_new.instances.front()->is_left_handed()));
|
model_object.instances.front()->is_left_handed() != model_object_new.instances.front()->is_left_handed()));
|
||||||
if (model_parts_differ || sla_trafo_differs) {
|
if (model_parts_differ || sla_trafo_differs) {
|
||||||
// The very first step (the slicing step) is invalidated. One may freely remove all associated PrintObjects.
|
// The very first step (the slicing step) is invalidated. One may freely remove all associated PrintObjects.
|
||||||
|
@ -405,7 +421,7 @@ SLAPrint::ApplyStatus SLAPrint::apply(const Model &model, const DynamicPrintConf
|
||||||
|
|
||||||
// FIXME: this invalidates the transformed mesh in SLAPrintObject
|
// FIXME: this invalidates the transformed mesh in SLAPrintObject
|
||||||
// which is expensive to calculate (especially the raw_mesh() call)
|
// which is expensive to calculate (especially the raw_mesh() call)
|
||||||
print_object->set_trafo(sla_trafo(model_object), model_object.instances.front()->is_left_handed());
|
print_object->set_trafo(sla_trafo(model_object, m_printer_config, m_material_config), model_object.instances.front()->is_left_handed());
|
||||||
|
|
||||||
print_object->set_instances(std::move(new_instances));
|
print_object->set_instances(std::move(new_instances));
|
||||||
print_object->config_apply(config, true);
|
print_object->config_apply(config, true);
|
||||||
|
@ -1423,19 +1439,22 @@ bool SLAPrint::invalidate_state_by_config_options(const std::vector<t_config_opt
|
||||||
if (opt_keys.empty())
|
if (opt_keys.empty())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
static std::unordered_set<std::string> steps_full = {
|
||||||
|
"initial_layer_height",
|
||||||
|
"material_correction",
|
||||||
|
"printer_correction"
|
||||||
|
};
|
||||||
|
|
||||||
// Cache the plenty of parameters, which influence the final rasterization only,
|
// Cache the plenty of parameters, which influence the final rasterization only,
|
||||||
// or they are only notes not influencing the rasterization step.
|
// or they are only notes not influencing the rasterization step.
|
||||||
static std::unordered_set<std::string> steps_rasterize = {
|
static std::unordered_set<std::string> steps_rasterize = {
|
||||||
"exposure_time",
|
"exposure_time",
|
||||||
"initial_exposure_time",
|
"initial_exposure_time",
|
||||||
"material_correction_printing",
|
|
||||||
"material_correction_curing",
|
|
||||||
"display_width",
|
"display_width",
|
||||||
"display_height",
|
"display_height",
|
||||||
"display_pixels_x",
|
"display_pixels_x",
|
||||||
"display_pixels_y",
|
"display_pixels_y",
|
||||||
"display_orientation",
|
"display_orientation"
|
||||||
"printer_correction"
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static std::unordered_set<std::string> steps_ignore = {
|
static std::unordered_set<std::string> steps_ignore = {
|
||||||
|
@ -1459,7 +1478,7 @@ bool SLAPrint::invalidate_state_by_config_options(const std::vector<t_config_opt
|
||||||
steps.emplace_back(slapsMergeSlicesAndEval);
|
steps.emplace_back(slapsMergeSlicesAndEval);
|
||||||
} else if (steps_ignore.find(opt_key) != steps_ignore.end()) {
|
} else if (steps_ignore.find(opt_key) != steps_ignore.end()) {
|
||||||
// These steps have no influence on the output. Just ignore them.
|
// These steps have no influence on the output. Just ignore them.
|
||||||
} else if (opt_key == "initial_layer_height") {
|
} else if (steps_full.find(opt_key) != steps_full.end()) {
|
||||||
steps.emplace_back(slapsMergeSlicesAndEval);
|
steps.emplace_back(slapsMergeSlicesAndEval);
|
||||||
osteps.emplace_back(slaposObjectSlice);
|
osteps.emplace_back(slaposObjectSlice);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -485,7 +485,7 @@ const std::vector<std::string>& Preset::sla_material_options()
|
||||||
s_opts = {
|
s_opts = {
|
||||||
"initial_layer_height",
|
"initial_layer_height",
|
||||||
"exposure_time", "initial_exposure_time",
|
"exposure_time", "initial_exposure_time",
|
||||||
"material_correction_printing", "material_correction_curing",
|
"material_correction",
|
||||||
"material_notes",
|
"material_notes",
|
||||||
"default_sla_material_profile",
|
"default_sla_material_profile",
|
||||||
"compatible_prints", "compatible_prints_condition",
|
"compatible_prints", "compatible_prints_condition",
|
||||||
|
|
|
@ -3233,7 +3233,7 @@ void TabSLAMaterial::build()
|
||||||
|
|
||||||
optgroup = page->new_optgroup(_(L("Corrections")));
|
optgroup = page->new_optgroup(_(L("Corrections")));
|
||||||
optgroup->label_width = 19 * m_em_unit;//190;
|
optgroup->label_width = 19 * m_em_unit;//190;
|
||||||
std::vector<std::string> corrections = { "material_correction_printing", "material_correction_curing" };
|
std::vector<std::string> corrections = {"material_correction"};
|
||||||
std::vector<std::string> axes{ "X", "Y", "Z" };
|
std::vector<std::string> axes{ "X", "Y", "Z" };
|
||||||
for (auto& opt_key : corrections) {
|
for (auto& opt_key : corrections) {
|
||||||
auto line = Line{ m_config->def()->get(opt_key)->full_label, "" };
|
auto line = Line{ m_config->def()->get(opt_key)->full_label, "" };
|
||||||
|
|
Loading…
Reference in a new issue