From 79d5a389288322eb20bf554dd2c18d9a3b6dddc9 Mon Sep 17 00:00:00 2001 From: Pavel Mikus Date: Fri, 3 Feb 2023 15:25:21 +0100 Subject: [PATCH] Create validation error when both avoid crossing curled overhangs and avoid crossing perimeters are both enabled together Update of the previous fix of extra perimeters - do not allow changing the direction of the paths after they have been sorted --- src/libslic3r/PerimeterGenerator.cpp | 14 +++++++++++++- src/libslic3r/Print.cpp | 4 ++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/libslic3r/PerimeterGenerator.cpp b/src/libslic3r/PerimeterGenerator.cpp index bdc51dea6..134efc926 100644 --- a/src/libslic3r/PerimeterGenerator.cpp +++ b/src/libslic3r/PerimeterGenerator.cpp @@ -728,6 +728,7 @@ ExtrusionPaths sort_and_connect_extra_perimeters(const std::vector connected_shells; connected_shells.reserve(extra_perims.size()); for (const ExtrusionPaths &ps : extra_perims) { + // this will also filter away empty paths connected_shells.push_back(reconnect_extrusion_paths(ps, 1.0 * extrusion_spacing)); } @@ -845,7 +846,18 @@ first_point_found: } } - ExtrusionPaths reconnected = reconnect_extrusion_paths(sorted_paths, extrusion_spacing * 2.0); + ExtrusionPaths reconnected; + reconnected.reserve(sorted_paths.size()); + for (const ExtrusionPath &path : sorted_paths) { + if (!reconnected.empty() && (reconnected.back().last_point() - path.first_point()).cast().squaredNorm() < + extrusion_spacing * extrusion_spacing * 4.0) { + reconnected.back().polyline.points.insert(reconnected.back().polyline.points.end(), path.polyline.points.begin(), + path.polyline.points.end()); + } else { + reconnected.push_back(path); + } + } + ExtrusionPaths filtered; filtered.reserve(reconnected.size()); for (ExtrusionPath &p : reconnected) { diff --git a/src/libslic3r/Print.cpp b/src/libslic3r/Print.cpp index ced6cd2a3..6314c67f6 100644 --- a/src/libslic3r/Print.cpp +++ b/src/libslic3r/Print.cpp @@ -474,6 +474,10 @@ std::string Print::validate(std::string* warning) const return L("Some objects are too tall and cannot be printed without extruder collisions."); } + if (m_config.avoid_crossing_perimeters && m_config.avoid_crossing_curled_overhangs) { + return L("Avoid crossing perimeters option and avoid crossing curled overhangs option cannot be both enabled together."); + } + if (m_config.spiral_vase) { size_t total_copies_count = 0; for (const PrintObject *object : m_objects)