Fixed layer height equality check needed in order to enable the wipe tower
The change was needed because enabling the new layer-height-modifier made the validation fail, even if there was no real layer height modification
This commit is contained in:
parent
a8f7bb54a5
commit
b43003dfad
2 changed files with 29 additions and 21 deletions
|
@ -1228,24 +1228,35 @@ std::string Print::validate() const
|
||||||
if (has_custom_layering) {
|
if (has_custom_layering) {
|
||||||
const std::vector<coordf_t> &layer_height_profile_tallest = layer_height_profiles[tallest_object_idx];
|
const std::vector<coordf_t> &layer_height_profile_tallest = layer_height_profiles[tallest_object_idx];
|
||||||
for (size_t idx_object = 0; idx_object < m_objects.size(); ++ idx_object) {
|
for (size_t idx_object = 0; idx_object < m_objects.size(); ++ idx_object) {
|
||||||
|
if (idx_object == tallest_object_idx)
|
||||||
|
continue;
|
||||||
const std::vector<coordf_t> &layer_height_profile = layer_height_profiles[idx_object];
|
const std::vector<coordf_t> &layer_height_profile = layer_height_profiles[idx_object];
|
||||||
bool failed = false;
|
|
||||||
if (layer_height_profile_tallest.size() >= layer_height_profile.size()) {
|
// The comparison of the profiles is not just about element-wise equality, some layers may not be
|
||||||
size_t i = 0;
|
// explicitely included. Always remember z and height of last reference layer that in the vector
|
||||||
while (i < layer_height_profile.size() && i < layer_height_profile_tallest.size()) {
|
// and compare to that.
|
||||||
if (std::abs(layer_height_profile_tallest[i] - layer_height_profile[i])) {
|
size_t i = 0; // index into tested profile
|
||||||
failed = true;
|
size_t j = 0; // index into reference profile
|
||||||
|
coordf_t ref_z = -1.;
|
||||||
|
coordf_t next_ref_z = layer_height_profile_tallest[0];
|
||||||
|
coordf_t ref_height = -1.;
|
||||||
|
while (i < layer_height_profile.size()) {
|
||||||
|
coordf_t this_z = layer_height_profile[i];
|
||||||
|
coordf_t this_height = layer_height_profile[i+1];
|
||||||
|
if (next_ref_z < this_z + EPSILON) {
|
||||||
|
ref_z = next_ref_z;
|
||||||
|
do { // one layer can be in the vector several times
|
||||||
|
ref_height = layer_height_profile_tallest[j+1];
|
||||||
|
if (j+2 >= layer_height_profile_tallest.size())
|
||||||
break;
|
break;
|
||||||
|
j += 2;
|
||||||
|
next_ref_z = layer_height_profile_tallest[j];
|
||||||
|
} while (ref_z == next_ref_z);
|
||||||
}
|
}
|
||||||
++ i;
|
if (std::abs(this_height - ref_height) > EPSILON)
|
||||||
if (i == layer_height_profile.size() - 2) // this element contains this objects max z
|
|
||||||
if (layer_height_profile_tallest[i] > layer_height_profile[i]) // the difference does not matter in this case
|
|
||||||
++ i;
|
|
||||||
}
|
|
||||||
} else
|
|
||||||
failed = true;
|
|
||||||
if (failed)
|
|
||||||
return L("The Wipe tower is only supported if all objects have the same layer height profile");
|
return L("The Wipe tower is only supported if all objects have the same layer height profile");
|
||||||
|
i += 2;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1443,11 +1443,8 @@ bool PrintObject::update_layer_height_profile(const ModelObject &model_object, c
|
||||||
layer_height_profile.clear();
|
layer_height_profile.clear();
|
||||||
|
|
||||||
if (layer_height_profile.empty()) {
|
if (layer_height_profile.empty()) {
|
||||||
if (0)
|
//layer_height_profile = layer_height_profile_adaptive(slicing_parameters, model_object.layer_config_ranges, model_object.volumes);
|
||||||
// if (this->layer_height_profile.empty())
|
layer_height_profile = layer_height_profile_from_ranges(slicing_parameters, model_object.layer_config_ranges);
|
||||||
layer_height_profile = layer_height_profile_adaptive(slicing_parameters, model_object.layer_config_ranges, model_object.volumes);
|
|
||||||
else
|
|
||||||
layer_height_profile = layer_height_profile_from_ranges(slicing_parameters, model_object.layer_config_ranges); // #ys_FIXME_experiment
|
|
||||||
updated = true;
|
updated = true;
|
||||||
}
|
}
|
||||||
return updated;
|
return updated;
|
||||||
|
|
Loading…
Reference in a new issue