From 83d4b26b60bd13c208fc7664c7d5cf0355c092fe Mon Sep 17 00:00:00 2001 From: Erwan MATHIEU Date: Thu, 14 Nov 2024 10:17:52 +0100 Subject: [PATCH 1/2] Apply coasting only on walls CURA-12288 --- src/LayerPlan.cpp | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/LayerPlan.cpp b/src/LayerPlan.cpp index 927e4357f7..d140242353 100644 --- a/src/LayerPlan.cpp +++ b/src/LayerPlan.cpp @@ -1308,7 +1308,7 @@ std::tuple LayerPlan::addSplitWall( std::vector LayerPlan::calculatePathsCoasting(const Settings& extruder_settings, const std::vector& paths, const Point3LL& current_position) const { - std::vector path_coastings; + std::vector path_coastings; path_coastings.resize(paths.size()); if (extruder_settings.get("coasting_enable")) @@ -1322,11 +1322,22 @@ std::vector for (const auto& reversed_chunk : paths | ranges::views::enumerate | ranges::views::reverse | ranges::views::chunk_by( - [](const auto&path_a, const auto&path_b) + [](const auto& path_a, const auto& path_b) { return (! std::get<1>(path_a).isTravelPath()) || std::get<1>(path_b).isTravelPath(); })) { + if (reversed_chunk.empty()) + { + continue; + } + + const PrintFeatureType type = reversed_chunk.front().second.config.getPrintFeatureType(); + if (type != PrintFeatureType::OuterWall && type != PrintFeatureType::InnerWall) + { + continue; + } + double accumulated_volume = 0.0; bool chunk_coasting_point_reached = false; bool chunk_min_volume_reached = false; From 7dff0622921af87902fb945a093338b65f99ed8d Mon Sep 17 00:00:00 2001 From: wawanbreton Date: Thu, 14 Nov 2024 09:18:28 +0000 Subject: [PATCH 2/2] Applied clang-format. --- src/LayerPlan.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/LayerPlan.cpp b/src/LayerPlan.cpp index d140242353..39f3e1b510 100644 --- a/src/LayerPlan.cpp +++ b/src/LayerPlan.cpp @@ -1322,7 +1322,7 @@ std::vector for (const auto& reversed_chunk : paths | ranges::views::enumerate | ranges::views::reverse | ranges::views::chunk_by( - [](const auto& path_a, const auto& path_b) + [](const auto&path_a, const auto&path_b) { return (! std::get<1>(path_a).isTravelPath()) || std::get<1>(path_b).isTravelPath(); }))