Ported filament shrinkage compensation for XY and independent Z from Prusa Slicer (fixing MMU painting, seam painting, support painting issues) (#6507)

* Ported filament shrinkage compensation from Prusa Slicer. Updated logic to be 100 = no shrinkage to be consistent with orca definitions

* Code comments update

* Merge branch 'main' into Filament-Shrinkage-compension---port-from-Prusa-slicer

* Merge remote-tracking branch 'upstream/main' into Filament-Shrinkage-compension---port-from-Prusa-slicer

* Merge branch 'main' into Filament-Shrinkage-compension---port-from-Prusa-slicer
This commit is contained in:
Ioannis Giannakas 2024-08-28 16:15:39 +01:00 committed by GitHub
parent d1e7bb2762
commit 0ba4181a06
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
17 changed files with 198 additions and 52 deletions

View file

@ -2966,12 +2966,15 @@ void PrintObject::generate_support_preview()
void PrintObject::update_slicing_parameters()
{
if (!m_slicing_params.valid)
m_slicing_params = SlicingParameters::create_from_config(
this->print()->config(), m_config, this->model_object()->max_z(), this->object_extruders());
// Orca: updated function call for XYZ shrinkage compensation
if (!m_slicing_params.valid) {
m_slicing_params = SlicingParameters::create_from_config(this->print()->config(), m_config, this->model_object()->max_z(),
this->object_extruders(), this->print()->shrinkage_compensation());
}
}
SlicingParameters PrintObject::slicing_parameters(const DynamicPrintConfig& full_config, const ModelObject& model_object, float object_max_z)
// Orca: XYZ shrinkage compensation has introduced the const Vec3d &object_shrinkage_compensation parameter to the function below
SlicingParameters PrintObject::slicing_parameters(const DynamicPrintConfig &full_config, const ModelObject &model_object, float object_max_z, const Vec3d &object_shrinkage_compensation)
{
PrintConfig print_config;
PrintObjectConfig object_config;
@ -3006,7 +3009,7 @@ SlicingParameters PrintObject::slicing_parameters(const DynamicPrintConfig& full
if (object_max_z <= 0.f)
object_max_z = (float)model_object.raw_bounding_box().size().z();
return SlicingParameters::create_from_config(print_config, object_config, object_max_z, object_extruders);
return SlicingParameters::create_from_config(print_config, object_config, object_max_z, object_extruders, object_shrinkage_compensation);
}
// returns 0-based indices of extruders used to print the object (without brim, support and other helper extrusions)
@ -3049,7 +3052,7 @@ bool PrintObject::update_layer_height_profile(const ModelObject &model_object, c
// Must not be of even length.
((layer_height_profile.size() & 1) != 0 ||
// Last entry must be at the top of the object.
std::abs(layer_height_profile[layer_height_profile.size() - 2] - slicing_parameters.object_print_z_max + slicing_parameters.object_print_z_min) > 1e-3))
std::abs(layer_height_profile[layer_height_profile.size() - 2] - slicing_parameters.object_print_z_uncompensated_max + slicing_parameters.object_print_z_min) > 1e-3))
layer_height_profile.clear();
if (layer_height_profile.empty() || layer_height_profile[1] != slicing_parameters.first_object_layer_height) {