From 0fd3d7df8690b5db00756a0741d848fc34711728 Mon Sep 17 00:00:00 2001 From: "c.lamboo" Date: Mon, 29 Jan 2024 15:26:52 +0100 Subject: [PATCH 01/10] Attempt to fix microsegments CURA-11129 --- src/LayerPlan.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/LayerPlan.cpp b/src/LayerPlan.cpp index c94e1ac857..a79e21d9df 100644 --- a/src/LayerPlan.cpp +++ b/src/LayerPlan.cpp @@ -816,7 +816,7 @@ void LayerPlan::addWallLine( { // This is only relevant for the very fist iteration of the loop // if the start of the line segment is already the same as p0 then no move is required - if (line_poly.front() != p0) + if (vSize2(line_poly.front() - p0) < 10 * 10) { addExtrusionMove(line_poly.front(), roofing_config, SpaceFillType::Polygons, flow, width_factor, spiralize, 1.0_r); } @@ -825,7 +825,7 @@ void LayerPlan::addWallLine( } // if the last point is not yet at p1 then add a move to p1 - if (has_area_above_poly_lines.back().back() != p1) + if (vSize2(has_area_above_poly_lines.back().back() - p1) < 10 * 10) { addExtrusionMove(p1, roofing_config, SpaceFillType::Polygons, flow, width_factor, spiralize, 1.0_r); } From 779c2af618e4dff1570fb8a12aa495419013e4ef Mon Sep 17 00:00:00 2001 From: "c.lamboo" Date: Mon, 29 Jan 2024 15:28:50 +0100 Subject: [PATCH 02/10] Flip sign CURA-11129 --- src/LayerPlan.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/LayerPlan.cpp b/src/LayerPlan.cpp index a79e21d9df..1d629c69eb 100644 --- a/src/LayerPlan.cpp +++ b/src/LayerPlan.cpp @@ -816,7 +816,7 @@ void LayerPlan::addWallLine( { // This is only relevant for the very fist iteration of the loop // if the start of the line segment is already the same as p0 then no move is required - if (vSize2(line_poly.front() - p0) < 10 * 10) + if (vSize2(line_poly.front() - p0) > 10 * 10) { addExtrusionMove(line_poly.front(), roofing_config, SpaceFillType::Polygons, flow, width_factor, spiralize, 1.0_r); } @@ -825,7 +825,7 @@ void LayerPlan::addWallLine( } // if the last point is not yet at p1 then add a move to p1 - if (vSize2(has_area_above_poly_lines.back().back() - p1) < 10 * 10) + if (vSize2(has_area_above_poly_lines.back().back() - p1) > 10 * 10) { addExtrusionMove(p1, roofing_config, SpaceFillType::Polygons, flow, width_factor, spiralize, 1.0_r); } From 637b525c6a51cfb28f613ee65ecdc1562b495c21 Mon Sep 17 00:00:00 2001 From: "c.lamboo" Date: Mon, 29 Jan 2024 16:28:44 +0100 Subject: [PATCH 03/10] Don't split up line segments for roofing config CURA-11129 --- src/LayerPlan.cpp | 55 +---------------------------------------------- 1 file changed, 1 insertion(+), 54 deletions(-) diff --git a/src/LayerPlan.cpp b/src/LayerPlan.cpp index 1d629c69eb..ed3768a97c 100644 --- a/src/LayerPlan.cpp +++ b/src/LayerPlan.cpp @@ -776,60 +776,7 @@ void LayerPlan::addWallLine( if (use_roofing_config) { - // The line segment is wholly or partially in the roofing area. The line is intersected - // with the roofing area into line segments. Each line segment left in this intersection - // will be printed using the roofing config, all removed segments will be printed using - // the default_config. Since the original line segment was straight we can simply print - // to the first and last point of the intersected line segments alternating between - // roofing and default_config's. - Polygons line_polys; - line_polys.addLine(p0, p1); - constexpr bool restitch = false; // only a single line doesn't need stitching - auto has_area_above_poly_lines = roofing_mask_.intersectionPolyLines(line_polys, restitch); - - if (has_area_above_poly_lines.empty()) - { - addExtrusionMove(p1, roofing_config, SpaceFillType::Polygons, flow, width_factor, spiralize, 1.0_r); - } - else - { - // reorder all the line segments so all lines start at p0 and end at p1 - for (auto& line_poly : has_area_above_poly_lines) - { - const Point2LL& line_p0 = line_poly.front(); - const Point2LL& line_p1 = line_poly.back(); - if (vSize2(line_p1 - p0) < vSize2(line_p0 - p0)) - { - std::reverse(line_poly.begin(), line_poly.end()); - } - } - std::sort( - has_area_above_poly_lines.begin(), - has_area_above_poly_lines.end(), - [&](auto& a, auto& b) - { - return vSize2(a.front() - p0) < vSize2(b.front() - p0); - }); - - // add intersected line segments, alternating between roofing and default_config - for (const auto& line_poly : has_area_above_poly_lines) - { - // This is only relevant for the very fist iteration of the loop - // if the start of the line segment is already the same as p0 then no move is required - if (vSize2(line_poly.front() - p0) > 10 * 10) - { - addExtrusionMove(line_poly.front(), roofing_config, SpaceFillType::Polygons, flow, width_factor, spiralize, 1.0_r); - } - - addExtrusionMove(line_poly.back(), default_config, SpaceFillType::Polygons, flow, width_factor, spiralize, 1.0_r); - } - - // if the last point is not yet at p1 then add a move to p1 - if (vSize2(has_area_above_poly_lines.back().back() - p1) > 10 * 10) - { - addExtrusionMove(p1, roofing_config, SpaceFillType::Polygons, flow, width_factor, spiralize, 1.0_r); - } - } + addExtrusionMove(p1, roofing_config, SpaceFillType::Polygons, flow, width_factor, spiralize, 1.0_r); } else if (bridge_wall_mask_.empty()) { From 40eade378438ef67fe3d52736853c364e3ab8213 Mon Sep 17 00:00:00 2001 From: "c.lamboo" Date: Mon, 29 Jan 2024 17:00:41 +0100 Subject: [PATCH 04/10] Revert wall roofing logic CURA-11129 --- src/LayerPlan.cpp | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/LayerPlan.cpp b/src/LayerPlan.cpp index ed3768a97c..781c1e6eb1 100644 --- a/src/LayerPlan.cpp +++ b/src/LayerPlan.cpp @@ -774,11 +774,7 @@ void LayerPlan::addWallLine( return roofing_mask_.empty() || PolygonUtils::polygonCollidesWithLineSegment(roofing_mask_, p0, p1) || ! roofing_mask_.inside(p1, true); }(); - if (use_roofing_config) - { - addExtrusionMove(p1, roofing_config, SpaceFillType::Polygons, flow, width_factor, spiralize, 1.0_r); - } - else if (bridge_wall_mask_.empty()) + if (bridge_wall_mask_.empty()) { // no bridges required addExtrusionMove( From b293aedc573acdb101e1a96e19eab7ad3a2907b6 Mon Sep 17 00:00:00 2001 From: "c.lamboo" Date: Mon, 29 Jan 2024 17:20:14 +0100 Subject: [PATCH 05/10] Test CURA-11129 --- src/LayerPlan.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/LayerPlan.cpp b/src/LayerPlan.cpp index 781c1e6eb1..9148959a88 100644 --- a/src/LayerPlan.cpp +++ b/src/LayerPlan.cpp @@ -774,7 +774,18 @@ void LayerPlan::addWallLine( return roofing_mask_.empty() || PolygonUtils::polygonCollidesWithLineSegment(roofing_mask_, p0, p1) || ! roofing_mask_.inside(p1, true); }(); - if (bridge_wall_mask_.empty()) + if (use_roofing_config) + { + addExtrusionMove( + p1, + default_config, + SpaceFillType::Polygons, + flow, + width_factor, + spiralize, + (overhang_mask_.empty() || (! overhang_mask_.inside(p0, true) && ! overhang_mask_.inside(p1, true))) ? 1.0_r : overhang_speed_factor); + } + else if (bridge_wall_mask_.empty()) { // no bridges required addExtrusionMove( From 1e267c993228b22352437ea7b6ee87a15f102a1a Mon Sep 17 00:00:00 2001 From: "c.lamboo" Date: Mon, 29 Jan 2024 17:31:57 +0100 Subject: [PATCH 06/10] Use roofing config CURA-11129 --- src/LayerPlan.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/LayerPlan.cpp b/src/LayerPlan.cpp index 9148959a88..00264d5f36 100644 --- a/src/LayerPlan.cpp +++ b/src/LayerPlan.cpp @@ -778,7 +778,7 @@ void LayerPlan::addWallLine( { addExtrusionMove( p1, - default_config, + roofing_config, SpaceFillType::Polygons, flow, width_factor, From ed2513931afbe4d284d2937189bb7a237d88e533 Mon Sep 17 00:00:00 2001 From: "c.lamboo" Date: Mon, 29 Jan 2024 18:10:30 +0100 Subject: [PATCH 07/10] Use roofing config CURA-11129 --- src/LayerPlan.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/LayerPlan.cpp b/src/LayerPlan.cpp index 00264d5f36..9c821a94ac 100644 --- a/src/LayerPlan.cpp +++ b/src/LayerPlan.cpp @@ -790,7 +790,7 @@ void LayerPlan::addWallLine( // no bridges required addExtrusionMove( p1, - default_config, + roofing_config, SpaceFillType::Polygons, flow, width_factor, From 434a45561786ea08b4b7f7f32bc6c9eeb65e2a60 Mon Sep 17 00:00:00 2001 From: "c.lamboo" Date: Mon, 29 Jan 2024 19:39:55 +0100 Subject: [PATCH 08/10] Use roofing config CURA-11129 --- src/LayerPlan.cpp | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/src/LayerPlan.cpp b/src/LayerPlan.cpp index 9c821a94ac..cd692665ee 100644 --- a/src/LayerPlan.cpp +++ b/src/LayerPlan.cpp @@ -774,18 +774,7 @@ void LayerPlan::addWallLine( return roofing_mask_.empty() || PolygonUtils::polygonCollidesWithLineSegment(roofing_mask_, p0, p1) || ! roofing_mask_.inside(p1, true); }(); - if (use_roofing_config) - { - addExtrusionMove( - p1, - roofing_config, - SpaceFillType::Polygons, - flow, - width_factor, - spiralize, - (overhang_mask_.empty() || (! overhang_mask_.inside(p0, true) && ! overhang_mask_.inside(p1, true))) ? 1.0_r : overhang_speed_factor); - } - else if (bridge_wall_mask_.empty()) + if (bridge_wall_mask_.empty()) { // no bridges required addExtrusionMove( From 4cd409024b885506b338dc2e3c556bd49c439cb3 Mon Sep 17 00:00:00 2001 From: "c.lamboo" Date: Tue, 30 Jan 2024 13:51:25 +0100 Subject: [PATCH 09/10] Use default config CURA-11129 --- src/LayerPlan.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/LayerPlan.cpp b/src/LayerPlan.cpp index cd692665ee..781c1e6eb1 100644 --- a/src/LayerPlan.cpp +++ b/src/LayerPlan.cpp @@ -779,7 +779,7 @@ void LayerPlan::addWallLine( // no bridges required addExtrusionMove( p1, - roofing_config, + default_config, SpaceFillType::Polygons, flow, width_factor, From 3b771f6b7dcaeafdc04728c33502bf1bc3a887f8 Mon Sep 17 00:00:00 2001 From: "c.lamboo" Date: Tue, 30 Jan 2024 13:57:29 +0100 Subject: [PATCH 10/10] USe roofing config CURA-11129 --- src/LayerPlan.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/LayerPlan.cpp b/src/LayerPlan.cpp index 781c1e6eb1..cd692665ee 100644 --- a/src/LayerPlan.cpp +++ b/src/LayerPlan.cpp @@ -779,7 +779,7 @@ void LayerPlan::addWallLine( // no bridges required addExtrusionMove( p1, - default_config, + roofing_config, SpaceFillType::Polygons, flow, width_factor,