Added method for relative correction retrieval.
This commit is contained in:
parent
ecdd4b6e7a
commit
f0d106e5f0
2 changed files with 26 additions and 16 deletions
|
@ -85,22 +85,10 @@ 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, const SLAPrinterConfig& pconf, const SLAMaterialConfig& mconf)
|
static Transform3d sla_trafo(const SLAPrint& p, const ModelObject &model_object)
|
||||||
{
|
{
|
||||||
|
|
||||||
Vec3d corr(1., 1., 1.);
|
Vec3d corr = p.relative_correction();
|
||||||
|
|
||||||
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();
|
||||||
|
@ -347,7 +335,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, m_printer_config, m_material_config).isApprox(sla_trafo(model_object_new, m_printer_config, m_material_config)) ||
|
(! sla_trafo(*this, model_object_new).isApprox(sla_trafo(*this, model_object_new)) ||
|
||||||
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.
|
||||||
|
@ -432,7 +420,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, m_printer_config, m_material_config), model_object.instances.front()->is_left_handed());
|
print_object->set_trafo(sla_trafo(*this, model_object), 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);
|
||||||
|
@ -1643,6 +1631,25 @@ double SLAPrintObject::get_current_elevation() const
|
||||||
return get_elevation();
|
return get_elevation();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Vec3d SLAPrint::relative_correction() const
|
||||||
|
{
|
||||||
|
Vec3d corr(1., 1., 1.);
|
||||||
|
|
||||||
|
if(printer_config().printer_correction.values.size() == 3) {
|
||||||
|
corr(X) = printer_config().printer_correction.values[X];
|
||||||
|
corr(Y) = printer_config().printer_correction.values[Y];
|
||||||
|
corr(Z) = printer_config().printer_correction.values[Z];
|
||||||
|
}
|
||||||
|
|
||||||
|
if(material_config().material_correction.values.size() == 3) {
|
||||||
|
corr(X) *= material_config().material_correction.values[X];
|
||||||
|
corr(Y) *= material_config().material_correction.values[Y];
|
||||||
|
corr(Z) *= material_config().material_correction.values[Z];
|
||||||
|
}
|
||||||
|
|
||||||
|
return corr;
|
||||||
|
}
|
||||||
|
|
||||||
namespace { // dummy empty static containers for return values in some methods
|
namespace { // dummy empty static containers for return values in some methods
|
||||||
const std::vector<ExPolygons> EMPTY_SLICES;
|
const std::vector<ExPolygons> EMPTY_SLICES;
|
||||||
const TriangleMesh EMPTY_MESH;
|
const TriangleMesh EMPTY_MESH;
|
||||||
|
|
|
@ -401,6 +401,9 @@ public:
|
||||||
const SLAMaterialConfig& material_config() const { return m_material_config; }
|
const SLAMaterialConfig& material_config() const { return m_material_config; }
|
||||||
const SLAPrintObjectConfig& default_object_config() const { return m_default_object_config; }
|
const SLAPrintObjectConfig& default_object_config() const { return m_default_object_config; }
|
||||||
|
|
||||||
|
// Extracted value from the configuration objects
|
||||||
|
Vec3d relative_correction() const;
|
||||||
|
|
||||||
std::string output_filename() const override;
|
std::string output_filename() const override;
|
||||||
|
|
||||||
const SLAPrintStatistics& print_statistics() const { return m_print_statistics; }
|
const SLAPrintStatistics& print_statistics() const { return m_print_statistics; }
|
||||||
|
|
Loading…
Reference in a new issue