From 424ef02d8aaedf540868c133c4b19f913bb959fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luk=C3=A1=C5=A1=20Hejl?= Date: Tue, 13 Sep 2022 20:38:15 +0200 Subject: [PATCH] Added a test case for a missing part of a model cased by WallToolPaths::simplifyToolPaths that was reported in #8849. --- tests/libslic3r/test_arachne.cpp | 35 ++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/tests/libslic3r/test_arachne.cpp b/tests/libslic3r/test_arachne.cpp index 2334fbc62..af48c71a1 100644 --- a/tests/libslic3r/test_arachne.cpp +++ b/tests/libslic3r/test_arachne.cpp @@ -451,3 +451,38 @@ TEST_CASE("Arachne - Missing infill", "[ArachneMissingInfill]") { // REQUIRE(wallToolPaths.getInnerContour().size() == 1); } + +// This test case was distilled from GitHub issue #8849. +// Missing part of the model after simplifying generated tool-paths by simplifyToolPaths. +TEST_CASE("Arachne - #8849 - Missing part of model", "[ArachneMissingPart8849]") { + const Polygon poly_0 = { + Point(-29700000, -10600000), + Point(-28200000, -10600000), + Point( 20000000, -10600000), + Point( 20000000, - 9900000), + Point(-28200000, - 9900000), + Point(-28200000, 0), + Point(-29700000, 0), + }; + + Polygons polygons = {poly_0}; + coord_t ext_perimeter_spacing = 449999; + coord_t perimeter_spacing = 757079; + coord_t inset_count = 2; + + Arachne::WallToolPaths wall_tool_paths(polygons, ext_perimeter_spacing, perimeter_spacing, inset_count, 0, 0.32, PrintObjectConfig::defaults(), PrintConfig::defaults()); + wall_tool_paths.generate(); + std::vector perimeters = wall_tool_paths.getToolPaths(); + +#ifdef ARACHNE_DEBUG_OUT + export_perimeters_to_svg(debug_out_path("arachne-missing-part-8849.svg"), polygons, perimeters, union_ex(wall_tool_paths.getInnerContour())); +#endif + + int64_t total_extrusion_length= 0; + for (Arachne::VariableWidthLines &perimeter : perimeters) + for (Arachne::ExtrusionLine &extrusion_line : perimeter) + total_extrusion_length += extrusion_line.getLength(); + + // Total extrusion length should be around 30mm when the part is missing and around 120 when everything is ok. + // REQUIRE(total_extrusion_length >= scaled(120.)); +}