mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-08-14 10:25:56 +08:00
Same settings of the layer height modifier does not guarantee to always produce profiles exactly equal numerically. This is broken since 71ba15b.
This commit is contained in:
parent
69732e4b2a
commit
2ecfdea070
@ -537,7 +537,19 @@ std::string Print::validate(std::string* warning) const
|
|||||||
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)
|
if (idx_object == tallest_object_idx)
|
||||||
continue;
|
continue;
|
||||||
if (layer_height_profiles[idx_object] != layer_height_profiles[tallest_object_idx])
|
// Check that the layer height profiles are equal. This will happen when one object is
|
||||||
|
// a copy of another, or when a layer height modifier is used the same way on both objects.
|
||||||
|
// The latter case might create a floating point inaccuracy mismatch, so compare
|
||||||
|
// element-wise using an epsilon check.
|
||||||
|
bool profiles_equal = layer_height_profiles[idx_object].size() == layer_height_profiles[tallest_object_idx].size();
|
||||||
|
size_t i = 0;
|
||||||
|
const coordf_t eps = 0.5 * EPSILON; // layers closer than EPSILON will be merged later. Let's make
|
||||||
|
// this check a bit more sensitive to make sure we never consider two different layers as one.
|
||||||
|
while (profiles_equal && i < layer_height_profiles[idx_object].size()) {
|
||||||
|
profiles_equal = (std::abs(layer_height_profiles[idx_object][i] - layer_height_profiles[tallest_object_idx][i]) < eps);
|
||||||
|
++i;
|
||||||
|
}
|
||||||
|
if (! profiles_equal)
|
||||||
return L("The Wipe tower is only supported if all objects have the same variable layer height");
|
return L("The Wipe tower is only supported if all objects have the same variable layer height");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user