From d4853d425b4f8f01669149a4529bfa8380ac8636 Mon Sep 17 00:00:00 2001 From: Erwan MATHIEU Date: Tue, 17 Dec 2024 16:16:18 +0100 Subject: [PATCH 01/12] Use more generic lint formatter --- .github/workflows/lint-formatter.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/lint-formatter.yml b/.github/workflows/lint-formatter.yml index 1c56380978..5316ab9599 100644 --- a/.github/workflows/lint-formatter.yml +++ b/.github/workflows/lint-formatter.yml @@ -15,3 +15,7 @@ on: jobs: lint-formatter-job: uses: ultimaker/cura-workflows/.github/workflows/lint-formatter.yml@main + with: + file_patterns: +(include|src)/**/*.+(h|hpp|c|cpp) + command: clang-format --verbose -i + commit_message: "Apply clang-format" From 2bc7601563ef5c35fb52d52943a57b7d0a8f7fa5 Mon Sep 17 00:00:00 2001 From: Erwan MATHIEU Date: Wed, 18 Dec 2024 16:01:16 +0100 Subject: [PATCH 02/12] Fix wrong retraction settings being CURA-12065 In the case where a mesh was printed with multiple extruders, the used retraction settings were always the one of the main extruder. Now we take the settings of the mesh only if using the main extruder. Mesh-specific settings will then be ignored for other extruders. --- src/LayerPlan.cpp | 41 +++++++++++++++++++++++++++++------------ 1 file changed, 29 insertions(+), 12 deletions(-) diff --git a/src/LayerPlan.cpp b/src/LayerPlan.cpp index 39f3e1b510..f57cba07a4 100644 --- a/src/LayerPlan.cpp +++ b/src/LayerPlan.cpp @@ -57,14 +57,15 @@ GCodePath* LayerPlan::getLatestPathWithConfig( { return &paths.back(); } - paths.emplace_back(GCodePath{ .z_offset = z_offset, - .config = config, - .mesh = current_mesh_, - .space_fill_type = space_fill_type, - .flow = flow, - .width_factor = width_factor, - .spiralize = spiralize, - .speed_factor = speed_factor }); + paths.emplace_back( + GCodePath{ .z_offset = z_offset, + .config = config, + .mesh = current_mesh_, + .space_fill_type = space_fill_type, + .flow = flow, + .width_factor = width_factor, + .spiralize = spiralize, + .speed_factor = speed_factor }); GCodePath* ret = &paths.back(); ret->skip_agressive_merge_hint = mode_skip_agressive_merge_; @@ -1322,7 +1323,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(); })) @@ -2512,8 +2513,24 @@ void LayerPlan::writeGCode(GCodeExport& gcode) { ExtruderPlan& extruder_plan = extruder_plans_[extruder_plan_idx]; - const RetractionAndWipeConfig* retraction_config - = current_mesh ? ¤t_mesh->retraction_wipe_config : &storage_.retraction_wipe_config_per_extruder[extruder_plan.extruder_nr_]; + auto get_retraction_config = [&extruder_nr, this](std::shared_ptr& mesh) -> std::optional + { + if (mesh) + { + if (extruder_nr == mesh->settings.get("extruder_nr")) [[likely]] + { + return &mesh->retraction_wipe_config; + } + + // We are printing a part of a mesh with a different extruder, use this extruder settings instead (mesh-specific settings will be ignored) + return &storage_.retraction_wipe_config_per_extruder[extruder_nr]; + } + + // We have no mesh yet, a more global config should be used + return std::nullopt; + }; + + const RetractionAndWipeConfig* retraction_config = get_retraction_config(current_mesh).value_or(&storage_.retraction_wipe_config_per_extruder[extruder_plan.extruder_nr_]); coord_t z_hop_height = retraction_config->retraction_config.zHop; if (extruder_nr != extruder_plan.extruder_nr_) @@ -2697,7 +2714,7 @@ void LayerPlan::writeGCode(GCodeExport& gcode) if (path.retract) { - retraction_config = path.mesh ? &path.mesh->retraction_wipe_config : retraction_config; + retraction_config = get_retraction_config(path.mesh).value_or(retraction_config); gcode.writeRetraction(retraction_config->retraction_config); if (path.retract_for_nozzle_switch) { From 6bd4aa379a8e0564b00cf915c627cf338751948f Mon Sep 17 00:00:00 2001 From: wawanbreton Date: Wed, 18 Dec 2024 15:02:09 +0000 Subject: [PATCH 03/12] Apply clang-format --- src/LayerPlan.cpp | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/src/LayerPlan.cpp b/src/LayerPlan.cpp index f57cba07a4..5cfdd1d9c2 100644 --- a/src/LayerPlan.cpp +++ b/src/LayerPlan.cpp @@ -57,15 +57,14 @@ GCodePath* LayerPlan::getLatestPathWithConfig( { return &paths.back(); } - paths.emplace_back( - GCodePath{ .z_offset = z_offset, - .config = config, - .mesh = current_mesh_, - .space_fill_type = space_fill_type, - .flow = flow, - .width_factor = width_factor, - .spiralize = spiralize, - .speed_factor = speed_factor }); + paths.emplace_back(GCodePath{ .z_offset = z_offset, + .config = config, + .mesh = current_mesh_, + .space_fill_type = space_fill_type, + .flow = flow, + .width_factor = width_factor, + .spiralize = spiralize, + .speed_factor = speed_factor }); GCodePath* ret = &paths.back(); ret->skip_agressive_merge_hint = mode_skip_agressive_merge_; @@ -1323,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(); })) From 6acce8af65d1b1ff6b2981b8d5ca93a5f40253da Mon Sep 17 00:00:00 2001 From: Erwan MATHIEU Date: Fri, 20 Dec 2024 12:44:27 +0100 Subject: [PATCH 04/12] Remove useless environment variables --- .github/workflows/stress_benchmark.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.github/workflows/stress_benchmark.yml b/.github/workflows/stress_benchmark.yml index 56432c9899..aa1458cfd2 100644 --- a/.github/workflows/stress_benchmark.yml +++ b/.github/workflows/stress_benchmark.yml @@ -27,10 +27,6 @@ permissions: contents: write deployments: write -env: - CONAN_LOGIN_USERNAME: ${{ secrets.CONAN_USER }} - CONAN_PASSWORD: ${{ secrets.CONAN_PASS }} - jobs: check_actor: From a8c7105acea17036301cdb1e038e0bb5889a9f57 Mon Sep 17 00:00:00 2001 From: Erwan MATHIEU Date: Fri, 20 Dec 2024 12:49:07 +0100 Subject: [PATCH 05/12] Fix call to common benchmark workflow --- .github/workflows/stress_benchmark.yml | 7 ------- 1 file changed, 7 deletions(-) diff --git a/.github/workflows/stress_benchmark.yml b/.github/workflows/stress_benchmark.yml index aa1458cfd2..5882ec51d0 100644 --- a/.github/workflows/stress_benchmark.yml +++ b/.github/workflows/stress_benchmark.yml @@ -33,16 +33,9 @@ jobs: uses: ultimaker/cura-workflows/.github/workflows/check-actor.yml@main secrets: inherit - conan-recipe-version: - needs: [ check_actor ] - if: ${{ needs.check_actor.outputs.proceed == 'true' }} - uses: ultimaker/cura-workflows/.github/workflows/conan-recipe-version.yml@main - benchmark: - needs: [ conan-recipe-version ] uses: ultimaker/cura-workflows/.github/workflows/benchmark.yml@main with: - recipe_id_full: ${{ needs.conan-recipe-version.outputs.recipe_id_full }} conan_extra_args: "-o curaengine:enable_benchmarks=True" benchmark_cmd: "stress_benchmark/stress_benchmark -o benchmark_result.json" name: "Stress Benchmark" From b0a18e919b1125b45357f3a5a9f37f022f8ece71 Mon Sep 17 00:00:00 2001 From: Erwan MATHIEU Date: Fri, 20 Dec 2024 12:54:01 +0100 Subject: [PATCH 06/12] Set relative path to output file --- .github/workflows/benchmark.yml | 4 ++-- .github/workflows/stress_benchmark.yml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml index 059ef365cf..7a481ea745 100644 --- a/.github/workflows/benchmark.yml +++ b/.github/workflows/benchmark.yml @@ -38,9 +38,9 @@ jobs: uses: ultimaker/cura-workflows/.github/workflows/benchmark.yml@main with: conan_extra_args: "-o \"curaengine/*:enable_benchmarks=True\"" - benchmark_cmd: "./build/Release/benchmark/benchmarks --benchmark_format=json --benchmark_out=benchmark_result.json" + benchmark_cmd: "benchmark/benchmarks --benchmark_format=json --benchmark_out=benchmark_result.json" name: "C++ Benchmark" - output_file_path: "build/Release/benchmark_result.json" + output_file_path: "benchmark_result.json" data_dir: "dev/bench" tool: "googlecpp" alert_threshold: "150%" diff --git a/.github/workflows/stress_benchmark.yml b/.github/workflows/stress_benchmark.yml index 5882ec51d0..8eed7fdcd6 100644 --- a/.github/workflows/stress_benchmark.yml +++ b/.github/workflows/stress_benchmark.yml @@ -39,7 +39,7 @@ jobs: conan_extra_args: "-o curaengine:enable_benchmarks=True" benchmark_cmd: "stress_benchmark/stress_benchmark -o benchmark_result.json" name: "Stress Benchmark" - output_file_path: "build/Release/benchmark_result.json" + output_file_path: "benchmark_result.json" data_dir: "dev/stress_bench" tool: "customSmallerIsBetter" secrets: inherit From 025fabd97a97dc918c616b9b1c2e4e4c9c609e97 Mon Sep 17 00:00:00 2001 From: Erwan MATHIEU Date: Fri, 20 Dec 2024 13:26:36 +0100 Subject: [PATCH 07/12] Fix build setting syntax --- .github/workflows/stress_benchmark.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/stress_benchmark.yml b/.github/workflows/stress_benchmark.yml index 8eed7fdcd6..401467529c 100644 --- a/.github/workflows/stress_benchmark.yml +++ b/.github/workflows/stress_benchmark.yml @@ -36,7 +36,7 @@ jobs: benchmark: uses: ultimaker/cura-workflows/.github/workflows/benchmark.yml@main with: - conan_extra_args: "-o curaengine:enable_benchmarks=True" + conan_extra_args: "-o \"curaengine/*:enable_benchmarks=True\"" benchmark_cmd: "stress_benchmark/stress_benchmark -o benchmark_result.json" name: "Stress Benchmark" output_file_path: "benchmark_result.json" From caae3ee641d1ee6332fb1987ccf5b2b5401066a6 Mon Sep 17 00:00:00 2001 From: Erwan MATHIEU Date: Fri, 20 Dec 2024 14:09:10 +0100 Subject: [PATCH 08/12] Update gcode analyzer for conan2 --- .github/workflows/gcodeanalyzer.yml | 23 +++++++---------------- 1 file changed, 7 insertions(+), 16 deletions(-) diff --git a/.github/workflows/gcodeanalyzer.yml b/.github/workflows/gcodeanalyzer.yml index be45106c2c..2ea19f0dff 100644 --- a/.github/workflows/gcodeanalyzer.yml +++ b/.github/workflows/gcodeanalyzer.yml @@ -24,20 +24,13 @@ permissions: contents: write deployments: write -# TODO: Make cura-workflows/benchmark.yml generic enough to fit the gcodeanalyzer benchmark jobs: check_actor: uses: ultimaker/cura-workflows/.github/workflows/check-actor.yml@main secrets: inherit - conan-recipe-version: - needs: [ check_actor ] - if: ${{ needs.check_actor.outputs.proceed == 'true' }} - uses: ultimaker/cura-workflows/.github/workflows/conan-recipe-version.yml@main - gcodeanalyzer: - needs: [ conan-recipe-version ] name: Run GCodeAnalyzer on the engine runs-on: ubuntu-latest steps: @@ -64,17 +57,15 @@ jobs: fetch-depth: 1 token: ${{ secrets.GITHUB_TOKEN }} - - name: Install dependencies - run: conan install . ${{ needs.conan-recipe-version.outputs.version_full }} -s "*:build_type=Release" --build=missing --update -g VirtualRunEnv -c tools.build:skip_test=True -o with_cura_resources=True + - name: Install Python requirements + run: pip install git+https://github.com/ultimaker/libcharon@CURA-9495_analyzer_requisites#egg=charon - - name: Build CuraEngine and tests - run: | - source build/Release/generators/conanbuild.sh - cmake --preset release - cmake --build --preset release + - name: Install dependencies and build CuraEngine + run: conan build . -s build_type=Release --build=missing --update -g VirtualRunEnv -o "curaengine/*:with_cura_resources=True" - name: Collect STL-files, run CuraEngine, output GCode-files run: | + source build/Release/generators/conanrun.sh for file in `ls NightlyTestModels/*.stl`; do ( time ./build/Release/CuraEngine slice --force-read-parent --force-read-nondefault -v -p -j $CURA_RESOURCES/definitions/ultimaker_s3.def.json -l $file -o `basename $file .stl`.gcode ) 2> `basename $file .stl`.time @@ -83,6 +74,8 @@ jobs: # TODO: Move this to GCodeAnalyzer - name: Run GCodeAnalyzer on generated GCode files id: gcode_out + shell: python + working-directory: GCodeAnalyzer run: | import sys import os @@ -205,8 +198,6 @@ jobs: with open("../output.json", "w") as outfile: outfile.write(json.dumps(jzon)) - shell: python - working-directory: GCodeAnalyzer - name: Store benchmark result uses: benchmark-action/github-action-benchmark@v1 From 3215ace6847d59a3e72364550f410cc6e9881cb6 Mon Sep 17 00:00:00 2001 From: Erwan MATHIEU Date: Fri, 20 Dec 2024 14:28:47 +0100 Subject: [PATCH 09/12] Add log to analyze contents of cura_resources --- .github/workflows/gcodeanalyzer.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/gcodeanalyzer.yml b/.github/workflows/gcodeanalyzer.yml index 2ea19f0dff..a1bf843a70 100644 --- a/.github/workflows/gcodeanalyzer.yml +++ b/.github/workflows/gcodeanalyzer.yml @@ -66,6 +66,8 @@ jobs: - name: Collect STL-files, run CuraEngine, output GCode-files run: | source build/Release/generators/conanrun.sh + echo $CURA_RESOURCES + ls $CURA_RESOURCES for file in `ls NightlyTestModels/*.stl`; do ( time ./build/Release/CuraEngine slice --force-read-parent --force-read-nondefault -v -p -j $CURA_RESOURCES/definitions/ultimaker_s3.def.json -l $file -o `basename $file .stl`.gcode ) 2> `basename $file .stl`.time From bef3141f20b266c0e53986165e18102887169b9b Mon Sep 17 00:00:00 2001 From: Erwan MATHIEU Date: Fri, 20 Dec 2024 14:51:30 +0100 Subject: [PATCH 10/12] Install missing Python dependency --- .github/workflows/gcodeanalyzer.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/gcodeanalyzer.yml b/.github/workflows/gcodeanalyzer.yml index a1bf843a70..8145b07e83 100644 --- a/.github/workflows/gcodeanalyzer.yml +++ b/.github/workflows/gcodeanalyzer.yml @@ -58,7 +58,9 @@ jobs: token: ${{ secrets.GITHUB_TOKEN }} - name: Install Python requirements - run: pip install git+https://github.com/ultimaker/libcharon@CURA-9495_analyzer_requisites#egg=charon + run: | + pip install pandas + pip install git+https://github.com/ultimaker/libcharon@CURA-9495_analyzer_requisites#egg=charon - name: Install dependencies and build CuraEngine run: conan build . -s build_type=Release --build=missing --update -g VirtualRunEnv -o "curaengine/*:with_cura_resources=True" From 39de9508e7c1ae736ecb95288a73dc54c76f1a61 Mon Sep 17 00:00:00 2001 From: Erwan MATHIEU Date: Fri, 20 Dec 2024 15:22:40 +0100 Subject: [PATCH 11/12] Set unit test setting for benchmarks --- .github/workflows/benchmark.yml | 2 +- .github/workflows/stress_benchmark.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml index 7a481ea745..ee49634a2a 100644 --- a/.github/workflows/benchmark.yml +++ b/.github/workflows/benchmark.yml @@ -37,7 +37,7 @@ jobs: benchmark: uses: ultimaker/cura-workflows/.github/workflows/benchmark.yml@main with: - conan_extra_args: "-o \"curaengine/*:enable_benchmarks=True\"" + conan_extra_args: "-c tools.build:skip_test=False -o \"curaengine/*:enable_benchmarks=True\"" benchmark_cmd: "benchmark/benchmarks --benchmark_format=json --benchmark_out=benchmark_result.json" name: "C++ Benchmark" output_file_path: "benchmark_result.json" diff --git a/.github/workflows/stress_benchmark.yml b/.github/workflows/stress_benchmark.yml index 401467529c..a76be61f33 100644 --- a/.github/workflows/stress_benchmark.yml +++ b/.github/workflows/stress_benchmark.yml @@ -36,7 +36,7 @@ jobs: benchmark: uses: ultimaker/cura-workflows/.github/workflows/benchmark.yml@main with: - conan_extra_args: "-o \"curaengine/*:enable_benchmarks=True\"" + conan_extra_args: "-c tools.build:skip_test=False -o \"curaengine/*:enable_benchmarks=True\"" benchmark_cmd: "stress_benchmark/stress_benchmark -o benchmark_result.json" name: "Stress Benchmark" output_file_path: "benchmark_result.json" From 8c126b3f3061941e55d6568d8d8f76cd0a8622d3 Mon Sep 17 00:00:00 2001 From: HellAholic Date: Fri, 10 Jan 2025 12:34:44 +0000 Subject: [PATCH 12/12] Apply clang-format --- src/LayerPlan.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/LayerPlan.cpp b/src/LayerPlan.cpp index 5cfdd1d9c2..bd6b72ad1d 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(); }))