From 3658c97a946dbc2a6ab93719f4e645f6a2fdd5cb Mon Sep 17 00:00:00 2001 From: Arthur Date: Thu, 21 Mar 2024 11:35:56 +0800 Subject: [PATCH] FIX: sequential_print_clearance_valid not working not working correctly with short objects jira: STUDIO-6489 Change-Id: I33e1a165f448e1c3e272d4045934c63ad345db2f (cherry picked from commit 9348eaa22a056db5384a38ea966cec9ba4a533a7) --- src/libslic3r/Print.cpp | 2 +- src/libslic3r/Print.hpp | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/libslic3r/Print.cpp b/src/libslic3r/Print.cpp index 5240a11a7..e93d1c227 100644 --- a/src/libslic3r/Print.cpp +++ b/src/libslic3r/Print.cpp @@ -518,7 +518,7 @@ StringObjectException Print::sequential_print_clearance_valid(const Print &print polygons->clear(); std::vector intersecting_idxs; - bool all_objects_are_short = std::all_of(print.objects().begin(), print.objects().end(), [&](PrintObject* obj) { return obj->height() < scale_(print.config().nozzle_height.value - MARGIN_HEIGHT); }); + bool all_objects_are_short = print.is_all_objects_are_short(); // Shrink the extruder_clearance_radius a tiny bit, so that if the object arrangement algorithm placed the objects // exactly by satisfying the extruder_clearance_radius, this test will not trigger collision. float obj_distance = all_objects_are_short ? scale_(0.5*MAX_OUTER_NOZZLE_RADIUS-0.1) : scale_(0.5*print.config().extruder_clearance_radius.value-0.1); diff --git a/src/libslic3r/Print.hpp b/src/libslic3r/Print.hpp index 82a57a389..f2123ebf5 100644 --- a/src/libslic3r/Print.hpp +++ b/src/libslic3r/Print.hpp @@ -844,6 +844,10 @@ public: // Unset types are just ignored. static int get_compatible_filament_type(const std::set& types); + bool is_all_objects_are_short() const { + return std::all_of(this->objects().begin(), this->objects().end(), [&](PrintObject* obj) { return obj->height() < scale_(this->config().nozzle_height.value); }); + } + protected: // Invalidates the step, and its depending steps in Print. bool invalidate_step(PrintStep step);