From 18124b07a213f7ea5c420e9d2cdb52d893e80ed1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luk=C3=A1=C5=A1=20Hejl?= Date: Fri, 10 Jun 2022 11:43:41 +0200 Subject: [PATCH] Fixed a crash when Arachne returns extrusion with zero-length (just two same endpoints). --- src/libslic3r/PerimeterGenerator.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/libslic3r/PerimeterGenerator.cpp b/src/libslic3r/PerimeterGenerator.cpp index a0ea876fc..867cb45c7 100644 --- a/src/libslic3r/PerimeterGenerator.cpp +++ b/src/libslic3r/PerimeterGenerator.cpp @@ -405,7 +405,9 @@ static ExtrusionEntityCollection traverse_extrusions(const PerimeterGenerator &p // Reapply the nearest point search for starting point. // We allow polyline reversal because Clipper may have randomly reversed polylines during clipping. - chain_and_reorder_extrusion_paths(paths, &paths.front().first_point()); + // Arachne sometimes creates extrusion with zero-length (just two same endpoints); + if (!paths.empty()) + chain_and_reorder_extrusion_paths(paths, &paths.front().first_point()); } else { extrusion_paths_append(paths, *extrusion, role, is_external ? perimeter_generator.ext_perimeter_flow : perimeter_generator.perimeter_flow); } @@ -463,6 +465,13 @@ void PerimeterGenerator::process_arachne() Arachne::WallToolPaths wallToolPaths(last_p, ext_perimeter_spacing, perimeter_spacing, coord_t(loop_number + 1), 0, *this->object_config, *this->print_config); std::vector perimeters = wallToolPaths.getToolPaths(); + if (perimeters.size() == 1 && perimeters.front().size() == 2 && perimeters.front().front().junctions.size() == 2) { + for (const Point &pt : last_p.front().points) { + std::cout << "(" << pt.x() << ", " << pt.y() << ")," << std::endl; + } + std::cout << "" << std::endl; + } + int start_perimeter = int(perimeters.size()) - 1; int end_perimeter = -1; int direction = -1;