Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/prusa3d/PrusaSlicer.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEnrico Turri <enricoturri@seznam.cz>2018-05-02 15:45:42 +0300
committerEnrico Turri <enricoturri@seznam.cz>2018-05-02 15:45:42 +0300
commit81636abaa9896ced6f05a2e72698f16dc2a3dd45 (patch)
tree2cb8b27268e13cfa792cddaebfa0f43aa66f12e2 /xs/src/libslic3r/Print.cpp
parent65679975cea3f9898469ab2a7b8446647efcfa07 (diff)
parent3deeda0f7389b9ee9461acd49979580010e9fdf2 (diff)
Merge branch 'master' of https://github.com/prusa3d/Slic3r into scene_manipulators
Diffstat (limited to 'xs/src/libslic3r/Print.cpp')
-rw-r--r--xs/src/libslic3r/Print.cpp35
1 files changed, 22 insertions, 13 deletions
diff --git a/xs/src/libslic3r/Print.cpp b/xs/src/libslic3r/Print.cpp
index 585977ba7..5f50af8ac 100644
--- a/xs/src/libslic3r/Print.cpp
+++ b/xs/src/libslic3r/Print.cpp
@@ -598,10 +598,10 @@ std::string Print::validate() const
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
+ const PrintObject* tallest_object = this->objects.front(); // let's find the tallest object
for (const auto* object : objects)
- if (object->layer_height_profile.size() > most_layered_object->layer_height_profile.size())
- most_layered_object = object;
+ if (*(object->layer_height_profile.end()-2) > *(tallest_object->layer_height_profile.end()-2) )
+ tallest_object = object;
for (PrintObject *object : this->objects) {
SlicingParameters slicing_params = object->slicing_parameters();
@@ -618,17 +618,26 @@ std::string Print::validate() const
object->update_layer_height_profile();
object->layer_height_profile_valid = was_layer_height_profile_valid;
- if ( this->config.variable_layer_height ) {
- int i = 0;
- 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;
+ if ( this->config.variable_layer_height ) { // comparing layer height profiles
+ bool failed = false;
+ if (tallest_object->layer_height_profile.size() >= object->layer_height_profile.size() ) {
+ int i = 0;
+ while ( i < object->layer_height_profile.size() && i < tallest_object->layer_height_profile.size()) {
+ if (std::abs(tallest_object->layer_height_profile[i] - object->layer_height_profile[i])) {
+ failed = true;
+ break;
+ }
+ ++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)