Bugfix: validation of equal layering rejected even some valid configurations

This commit is contained in:
Lukas Matena 2018-04-16 11:47:35 +02:00
parent b881ae936f
commit 2726267748

View File

@ -598,6 +598,12 @@ std::string Print::validate() const
if (! this->config.use_relative_e_distances)
return "The Wipe Tower is currently only supported with the relative extruder addressing (use_relative_e_distances=1).";
SlicingParameters slicing_params0 = this->objects.front()->slicing_parameters();
const PrintObject* most_layered_object = this->objects.front(); // object with highest layer_height_profile.size() encountered so far
for (const auto* object : objects)
if (object->layer_height_profile.size() > most_layered_object->layer_height_profile.size())
most_layered_object = object;
for (PrintObject *object : this->objects) {
SlicingParameters slicing_params = object->slicing_parameters();
if (std::abs(slicing_params.first_print_layer_height - slicing_params0.first_print_layer_height) > EPSILON ||
@ -614,12 +620,15 @@ std::string Print::validate() const
object->layer_height_profile_valid = was_layer_height_profile_valid;
if ( this->config.variable_layer_height ) {
PrintObject* first_object = this->objects.front();
int i = 0;
while ( i < first_object->layer_height_profile.size() && i < object->layer_height_profile.size() ) {
if (std::abs(first_object->layer_height_profile[i] - object->layer_height_profile[i]) > EPSILON )
while ( i < object->layer_height_profile.size() ) {
if (std::abs(most_layered_object->layer_height_profile[i] - object->layer_height_profile[i]) > EPSILON)
return "The Wipe tower is only supported if all objects have the same layer height profile";
++i;
if (i == object->layer_height_profile.size()-2) // this element contains the objects max z, if the other object is taller,
// it does not have to match - we will step over it
if (most_layered_object->layer_height_profile[i] > object->layer_height_profile[i])
++i;
}
}