Yet another attempt to fix the layer height profile validation
This commit is contained in:
parent
650489dd8a
commit
24dc4c0f23
1 changed files with 22 additions and 13 deletions
|
@ -602,10 +602,10 @@ std::string Print::validate() const
|
||||||
return "The Wipe Tower is currently only supported with the relative extruder addressing (use_relative_e_distances=1).";
|
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();
|
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
|
const PrintObject* tallest_object = this->objects.front(); // let's find the tallest object
|
||||||
for (const auto* object : objects)
|
for (const auto* object : objects)
|
||||||
if (object->layer_height_profile.size() > most_layered_object->layer_height_profile.size())
|
if (*(object->layer_height_profile.end()-2) > *(tallest_object->layer_height_profile.end()-2) )
|
||||||
most_layered_object = object;
|
tallest_object = object;
|
||||||
|
|
||||||
for (PrintObject *object : this->objects) {
|
for (PrintObject *object : this->objects) {
|
||||||
SlicingParameters slicing_params = object->slicing_parameters();
|
SlicingParameters slicing_params = object->slicing_parameters();
|
||||||
|
@ -622,17 +622,26 @@ std::string Print::validate() const
|
||||||
object->update_layer_height_profile();
|
object->update_layer_height_profile();
|
||||||
object->layer_height_profile_valid = was_layer_height_profile_valid;
|
object->layer_height_profile_valid = was_layer_height_profile_valid;
|
||||||
|
|
||||||
if ( this->config.variable_layer_height ) {
|
if ( this->config.variable_layer_height ) { // comparing layer height profiles
|
||||||
int i = 0;
|
bool failed = false;
|
||||||
while ( i < object->layer_height_profile.size() ) {
|
if (tallest_object->layer_height_profile.size() >= object->layer_height_profile.size() ) {
|
||||||
if (std::abs(most_layered_object->layer_height_profile[i] - object->layer_height_profile[i]) > EPSILON)
|
int i = 0;
|
||||||
return "The Wipe tower is only supported if all objects have the same layer height profile";
|
while ( i < object->layer_height_profile.size() && i < tallest_object->layer_height_profile.size()) {
|
||||||
++i;
|
if (std::abs(tallest_object->layer_height_profile[i] - object->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,
|
failed = true;
|
||||||
// it does not have to match - we will step over it
|
break;
|
||||||
if (most_layered_object->layer_height_profile[i] > object->layer_height_profile[i])
|
}
|
||||||
++i;
|
++i;
|
||||||
|
if (i == object->layer_height_profile.size()-2) // this element contains this objects max z
|
||||||
|
if (tallest_object->layer_height_profile[i] > object->layer_height_profile[i]) // the difference does not matter in this case
|
||||||
|
++i;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
failed = true;
|
||||||
|
|
||||||
|
if (failed)
|
||||||
|
return "The Wipe tower is only supported if all objects have the same layer height profile";
|
||||||
}
|
}
|
||||||
|
|
||||||
/*for (size_t i = 5; i < object->layer_height_profile.size(); i += 2)
|
/*for (size_t i = 5; i < object->layer_height_profile.size(); i += 2)
|
||||||
|
|
Loading…
Reference in a new issue