From 06403eef65969844d8a09342afbbae74839a424c Mon Sep 17 00:00:00 2001 From: Vojtech Bubnik Date: Fri, 14 Apr 2023 09:21:39 +0200 Subject: [PATCH] SPE-1461 improved error reporting: if the last layer exceeds max print height while the object itself fits, a specific error report is given: "While the object %1% itself fits the build volume, its last layer exceeds the maximum build volume height." Also the name of the object violating print height is reported in the error message. --- src/libslic3r/Print.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/libslic3r/Print.cpp b/src/libslic3r/Print.cpp index 14e77e03fa5..b68d04b2b94 100644 --- a/src/libslic3r/Print.cpp +++ b/src/libslic3r/Print.cpp @@ -518,8 +518,12 @@ std::string Print::validate(std::string* warning) const //FIXME It is quite expensive to generate object layers just to get the print height! if (auto layers = generate_object_layers(print_object.slicing_parameters(), layer_height_profile(print_object_idx)); ! layers.empty() && layers.back() > this->config().max_print_height + EPSILON) { - return _u8L("The print is taller than the maximum allowed height. You might want to reduce the size of your model" - " or change current print settings and retry."); + return + // Test whether the last slicing plane is below or above the print volume. + 0.5 * (layers[layers.size() - 2] + layers.back()) > this->config().max_print_height + EPSILON ? + format(_u8L("The object %1% exceeds the maximum build volume height."), print_object.model_object()->name) : + format(_u8L("While the object %1% itself fits the build volume, its last layer exceeds the maximum build volume height."), print_object.model_object()->name) + + " " + _u8L("You might want to reduce the size of your model or change current print settings and retry."); } }