Skip to content

Commit

Permalink
Merge branch 'main' into CURA-12236_expose-preferred-travel-area-in-c…
Browse files Browse the repository at this point in the history
…ombing
  • Loading branch information
HellAholic authored Jan 13, 2025
2 parents dd95496 + 8c126b3 commit 4b12494
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 36 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/benchmark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@ jobs:
benchmark:
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"
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: "build/Release/benchmark_result.json"
output_file_path: "benchmark_result.json"
data_dir: "dev/bench"
tool: "googlecpp"
alert_threshold: "150%"
Expand Down
27 changes: 11 additions & 16 deletions .github/workflows/gcodeanalyzer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -64,17 +57,19 @@ 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: Build CuraEngine and tests
- name: Install Python requirements
run: |
source build/Release/generators/conanbuild.sh
cmake --preset release
cmake --build --preset release
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"

- 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
Expand All @@ -83,6 +78,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
Expand Down Expand Up @@ -205,8 +202,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
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/lint-formatter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
15 changes: 2 additions & 13 deletions .github/workflows/stress_benchmark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,30 +27,19 @@ permissions:
contents: write
deployments: write

env:
CONAN_LOGIN_USERNAME: ${{ secrets.CONAN_USER }}
CONAN_PASSWORD: ${{ secrets.CONAN_PASS }}


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

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"
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: "build/Release/benchmark_result.json"
output_file_path: "benchmark_result.json"
data_dir: "dev/stress_bench"
tool: "customSmallerIsBetter"
secrets: inherit
24 changes: 20 additions & 4 deletions src/LayerPlan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1322,7 +1322,7 @@ std::vector<LayerPlan::PathCoasting>

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();
}))
Expand Down Expand Up @@ -2512,8 +2512,24 @@ void LayerPlan::writeGCode(GCodeExport& gcode)
{
ExtruderPlan& extruder_plan = extruder_plans_[extruder_plan_idx];

const RetractionAndWipeConfig* retraction_config
= current_mesh ? &current_mesh->retraction_wipe_config : &storage_.retraction_wipe_config_per_extruder[extruder_plan.extruder_nr_];
auto get_retraction_config = [&extruder_nr, this](std::shared_ptr<const SliceMeshStorage>& mesh) -> std::optional<const RetractionAndWipeConfig*>
{
if (mesh)
{
if (extruder_nr == mesh->settings.get<size_t>("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_)
Expand Down Expand Up @@ -2697,7 +2713,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)
{
Expand Down

0 comments on commit 4b12494

Please sign in to comment.