Skip to content

Commit

Permalink
Merge branch 'main' into CURA-10918_gcomment_on_minlayer_time
Browse files Browse the repository at this point in the history
  • Loading branch information
rburema authored Jun 6, 2024
2 parents ac86cfd + b93f69b commit 8712159
Show file tree
Hide file tree
Showing 226 changed files with 9,218 additions and 7,504 deletions.
5 changes: 3 additions & 2 deletions .clang-tidy
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ Checks: >
-fuchsia-overloaded-operator,
-cppcoreguidelines-avoid-capturing-lambda-coroutines,
-llvm-header-guard,
-bugprone-easily-swappable-parameters
-bugprone-easily-swappable-parameters,
-*-default-arguments-declarations
WarningsAsErrors: '-*'
HeaderFilterRegex: ''
FormatStyle: none
Expand Down Expand Up @@ -52,4 +53,4 @@ CheckOptions:
- key: readability-identifier-length.IgnoredVariableNames
value: '_p|p0|p1|i|j|k|x|X|y|Y|z|Z|a|A|b|B|c|C|d|D|ab|AB|ba|BA|bc|BC|cb|CB|cd|CD|dc|DC|ad|AD|da|DA|ip|os'
- key: readability-identifier-length.IgnoredLoopCounterNames
value: '_p|p0|p1|i|j|k|x|X|y|Y|z|Z|a|A|b|B|c|C|d|D|ab|AB|ba|BA|bc|BC|cb|CB|cd|CD|dc|DC|ad|AD|da|DA|ip|os'
value: '_p|p0|p1|i|j|k|x|X|y|Y|z|Z|a|A|b|B|c|C|d|D|ab|AB|ba|BA|bc|BC|cb|CB|cd|CD|dc|DC|ad|AD|da|DA|ip|os'
31 changes: 28 additions & 3 deletions .github/workflows/conan-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,23 @@ on:
tags:
- '[0-9]+.[0-9]+.[0-9]*'
- '[0-9]+.[0-9]+.[0-9]'
pull_request:
types: [opened, reopened, synchronize]
paths:
- 'include/**'
- 'src/**'
- 'test_package/**'
- 'conanfile.py'
- 'conandata.yml'
- 'CMakeLists.txt'
- '.github/workflows/conan-package.yml'
branches:
- main
- 'CURA-*'
- 'PP-*'
- 'NP-*'
- '[0-9].[0-9]*'
- '[0-9].[0-9][0-9]*'

jobs:
conan-recipe-version:
Expand All @@ -37,24 +54,32 @@ jobs:

conan-package-create-macos:
needs: [ conan-recipe-version, conan-package-export ]
if: ${{ (github.event_name == 'push' && (github.ref_name == 'main' || github.ref_name == 'master' || needs.conan-recipe-version.outputs.is_release_branch == 'true')) }}
if: ${{ ((github.event_name == 'push' && (github.ref_name == 'main' || needs.conan-recipe-version.outputs.is_release_branch == 'true')) || github.event_name == 'pull_request') }}
uses: ultimaker/cura-workflows/.github/workflows/conan-package-create-macos.yml@main
with:
recipe_id_full: ${{ needs.conan-recipe-version.outputs.recipe_id_full }}
secrets: inherit

conan-package-create-windows:
needs: [ conan-recipe-version, conan-package-export ]
if: ${{ (github.event_name == 'push' && (github.ref_name == 'main' || github.ref_name == 'master' || needs.conan-recipe-version.outputs.is_release_branch == 'true')) }}
if: ${{ ((github.event_name == 'push' && (github.ref_name == 'main' || needs.conan-recipe-version.outputs.is_release_branch == 'true')) || github.event_name == 'pull_request') }}
uses: ultimaker/cura-workflows/.github/workflows/conan-package-create-windows.yml@main
with:
recipe_id_full: ${{ needs.conan-recipe-version.outputs.recipe_id_full }}
secrets: inherit

conan-package-create-linux:
needs: [ conan-recipe-version, conan-package-export ]
if: ${{ (github.event_name == 'push' && (github.ref_name == 'main' || github.ref_name == 'master' || needs.conan-recipe-version.outputs.is_release_branch == 'true')) }}
if: ${{ ((github.event_name == 'push' && (github.ref_name == 'main' || needs.conan-recipe-version.outputs.is_release_branch == 'true')) || github.event_name == 'pull_request') }}
uses: ultimaker/cura-workflows/.github/workflows/conan-package-create-linux.yml@main
with:
recipe_id_full: ${{ needs.conan-recipe-version.outputs.recipe_id_full }}
secrets: inherit

conan-package-create-wasm:
needs: [ conan-recipe-version, conan-package-export ]
if: ${{ (github.event_name == 'push' && (github.ref_name == 'main' || needs.conan-recipe-version.outputs.is_release_branch == 'true')) }}
uses: ultimaker/cura-workflows/.github/workflows/conan-package-create-wasm.yml@main
with:
recipe_id_full: ${{ needs.conan-recipe-version.outputs.recipe_id_full }}
secrets: inherit
27 changes: 2 additions & 25 deletions .github/workflows/gcodeanalyzer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,28 +81,6 @@ jobs:
fetch-depth: 1
token: ${{ secrets.GITHUB_TOKEN }}

- name: Determine the corresponding Cura branch
id: curabranch
run: |
status_code=$(curl -s -o /dev/null -w "%{http_code}" "https://api.github.com/repos/ultimaker/cura/branches/${{ github.head_ref }}")
if [ "$status_code" -eq 200 ]; then
echo "The branch exists in Cura"
echo "branch=${{ github.head_ref }}" >> $GITHUB_OUTPUT
else
echo "branch=main" >> $GITHUB_OUTPUT
fi
- name: Checkout Cura
uses: actions/checkout@v3
with:
repository: 'Ultimaker/Cura'
ref: ${{ steps.curabranch.outputs.branch}}
path: 'Cura'
fetch-depth: 1
sparse-checkout: |
resources/definitions
resources/extruders
- name: Sync pip requirements
run: curl -O https://raw.githubusercontent.com/Ultimaker/cura-workflows/main/.github/workflows/requirements-runner.txt
working-directory: CuraEngine/.github/workflows
Expand Down Expand Up @@ -159,15 +137,14 @@ jobs:
${{ runner.os }}-conan-downloads-
- name: Install dependencies
run: conan install . ${{ needs.conan-recipe-version.outputs.recipe_id_full }} -s build_type=Release --build=missing --update -g GitHubActionsRunEnv -g GitHubActionsBuildEnv -c tools.build:skip_test=True
run: conan install . ${{ needs.conan-recipe-version.outputs.recipe_id_full }} -s build_type=Release --build=missing --update -g GitHubActionsRunEnv -g GitHubActionsBuildEnv -c tools.build:skip_test=True -o with_cura_resources=True
working-directory: CuraEngine

- name: Set Environment variables from Conan install (bash)
if: ${{ runner.os != 'Windows' }}
run: |
. ./activate_github_actions_runenv.sh
. ./activate_github_actions_buildenv.sh
echo "CURA_ENGINE_SEARCH_PATH=$GITHUB_WORKSPACE/Cura/resources/definitions:$GITHUB_WORKSPACE/Cura/resources/extruders" >> $GITHUB_ENV
working-directory: CuraEngine/build/Release/generators

- name: Build CuraEngine and tests
Expand All @@ -180,7 +157,7 @@ jobs:
run: |
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
( 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
done
working-directory: CuraEngine

Expand Down
58 changes: 37 additions & 21 deletions .github/workflows/lint-poster.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,72 +10,88 @@ jobs:
# Trigger the job only if the previous (insecure) workflow completed successfully
if: ${{ github.event.workflow_run.conclusion == 'success' }}
runs-on: ubuntu-latest
permissions:
pull-requests: write
steps:
- name: Download analysis results
uses: actions/github-script@v3.1.0
uses: actions/github-script@v7
with:
script: |
let artifacts = await github.actions.listWorkflowRunArtifacts({
const artifacts = await github.rest.actions.listWorkflowRunArtifacts({
owner: context.repo.owner,
repo: context.repo.repo,
run_id: ${{github.event.workflow_run.id }},
});
let matchArtifact = artifacts.data.artifacts.filter((artifact) => {
const matchArtifact = artifacts.data.artifacts.filter((artifact) => {
return artifact.name == "linter-result"
})[0];
let download = await github.actions.downloadArtifact({
const download = await github.rest.actions.downloadArtifact({
owner: context.repo.owner,
repo: context.repo.repo,
artifact_id: matchArtifact.id,
archive_format: "zip",
});
let fs = require("fs");
const fs = require("fs");
fs.writeFileSync("${{github.workspace}}/linter-result.zip", Buffer.from(download.data));
- name: Set environment variables
- name: Extract analysis results
run: |
mkdir linter-result
unzip linter-result.zip -d linter-result
echo "pr_id=$(cat linter-result/pr-id.txt)" >> $GITHUB_ENV
echo "pr_head_repo=$(cat linter-result/pr-head-repo.txt)" >> $GITHUB_ENV
echo "pr_head_ref=$(cat linter-result/pr-head-ref.txt)" >> $GITHUB_ENV
unzip -j linter-result.zip -d linter-result
- name: Set PR details environment variables
uses: actions/github-script@v7
with:
script: |
const assert = require("node:assert").strict;
const fs = require("fs");
function exportVar(varName, fileName, regEx) {
const val = fs.readFileSync("${{ github.workspace }}/linter-result/" + fileName, {
encoding: "ascii"
}).trimEnd();
assert.ok(regEx.test(val), "Invalid value format for " + varName);
core.exportVariable(varName, val);
}
exportVar("PR_ID", "pr-id.txt", /^[0-9]+$/);
exportVar("PR_HEAD_REPO", "pr-head-repo.txt", /^[-./0-9A-Z_a-z]+$/);
exportVar("PR_HEAD_SHA", "pr-head-sha.txt", /^[0-9A-Fa-f]+$/);
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
repository: ${{ env.pr_head_repo }}
ref: ${{ env.pr_head_ref }}
repository: ${{ env.PR_HEAD_REPO }}
ref: ${{ env.PR_HEAD_SHA }}
persist-credentials: false

- name: Redownload analysis results
uses: actions/github-script@v3.1.0
uses: actions/github-script@v7
with:
script: |
let artifacts = await github.actions.listWorkflowRunArtifacts({
const artifacts = await github.rest.actions.listWorkflowRunArtifacts({
owner: context.repo.owner,
repo: context.repo.repo,
run_id: ${{github.event.workflow_run.id }},
});
let matchArtifact = artifacts.data.artifacts.filter((artifact) => {
const matchArtifact = artifacts.data.artifacts.filter((artifact) => {
return artifact.name == "linter-result"
})[0];
let download = await github.actions.downloadArtifact({
const download = await github.rest.actions.downloadArtifact({
owner: context.repo.owner,
repo: context.repo.repo,
artifact_id: matchArtifact.id,
archive_format: "zip",
});
let fs = require("fs");
const fs = require("fs");
fs.writeFileSync("${{github.workspace}}/linter-result.zip", Buffer.from(download.data));
- name: Extract analysis results
run: |
mkdir linter-result
unzip linter-result.zip -d linter-result
unzip -j linter-result.zip -d linter-result
- name: Run clang-tidy-pr-comments action
uses: platisd/clang-tidy-pr-comments
uses: platisd/clang-tidy-pr-comments@v1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
clang_tidy_fixes: linter-result/fixes.yml
pull_request_id: ${{ env.pr_id }}
pull_request_id: ${{ env.PR_ID }}
request_changes: true
2 changes: 1 addition & 1 deletion .github/workflows/lint-tidier.yml
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ jobs:
run: |
echo ${{ github.event.number }} > linter-result/pr-id.txt
echo ${{ github.event.pull_request.head.repo.full_name }} > linter-result/pr-head-repo.txt
echo ${{ github.event.pull_request.head.ref }} > linter-result/pr-head-ref.txt
echo ${{ github.event.pull_request.head.sha }} > linter-result/pr-head-sha.txt
- uses: actions/upload-artifact@v2
with:
Expand Down
16 changes: 13 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ set(engine_SRCS # Except main.cpp.
src/MeshGroup.cpp
src/Mold.cpp
src/multiVolumes.cpp
src/PathOrderPath.cpp
src/path_ordering.cpp
src/Preheat.cpp
src/PrimeTower.cpp
src/raft.cpp
Expand Down Expand Up @@ -135,7 +135,7 @@ set(engine_SRCS # Except main.cpp.
src/utils/ExtrusionLine.cpp
src/utils/ExtrusionSegment.cpp
src/utils/gettime.cpp
src/utils/LinearAlg2D.cpp
src/utils/linearAlg2D.cpp
src/utils/ListPolyIt.cpp
src/utils/Matrix4x3D.cpp
src/utils/MinimumSpanningTree.cpp
Expand All @@ -144,7 +144,6 @@ set(engine_SRCS # Except main.cpp.
src/utils/PolygonsPointIndex.cpp
src/utils/PolygonsSegmentIndex.cpp
src/utils/polygonUtils.cpp
src/utils/polygon.cpp
src/utils/PolylineStitcher.cpp
src/utils/Simplify.cpp
src/utils/SVG.cpp
Expand All @@ -153,6 +152,17 @@ set(engine_SRCS # Except main.cpp.
src/utils/ToolpathVisualizer.cpp
src/utils/VoronoiUtils.cpp
src/utils/VoxelUtils.cpp
src/utils/MixedPolylineStitcher.cpp

src/geometry/Polygon.cpp
src/geometry/Shape.cpp
src/geometry/PointsSet.cpp
src/geometry/SingleShape.cpp
src/geometry/PartsView.cpp
src/geometry/LinesSet.cpp
src/geometry/Polyline.cpp
src/geometry/ClosedPolyline.cpp
src/geometry/MixedLinesSet.cpp
)

add_library(_CuraEngine STATIC ${engine_SRCS} ${engine_PB_SRCS})
Expand Down
48 changes: 26 additions & 22 deletions benchmark/infill_benchmark.h
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
// Copyright (c) 2023 UltiMaker
// Copyright (c) 2024 UltiMaker
// CuraEngine is released under the terms of the AGPLv3 or higher

#ifndef CURAENGINE_INFILL_BENCHMARK_H
#define CURAENGINE_INFILL_BENCHMARK_H

#include <benchmark/benchmark.h>

#include "geometry/OpenLinesSet.h"
#include "geometry/OpenPolyline.h"
#include "geometry/LinesSet.h"
#include "infill.h"

namespace cura
Expand All @@ -14,14 +17,14 @@ class InfillTest : public benchmark::Fixture
{
public:
Settings settings{};
Polygons square_shape;
Polygons ff_holes;
Shape square_shape;
Shape ff_holes;


std::vector<ExtrusionLine> all_paths;


Polygons outline_polygons;
Shape outline_polygons;
EFillMethod pattern{ EFillMethod::LINES };
bool zig_zagify{ true };
bool connect_polygons{ true };
Expand Down Expand Up @@ -58,8 +61,8 @@ class InfillTest : public benchmark::Fixture
ff_holes.back().emplace_back(MM2INT(60), MM2INT(40));
ff_holes.back().emplace_back(MM2INT(90), MM2INT(25));

outline_polygons.add(square_shape);
outline_polygons.add(ff_holes);
outline_polygons.push_back(square_shape);
outline_polygons.push_back(ff_holes);

settings.add("fill_outline_gaps", "false");
settings.add("meshfix_maximum_deviation", "0.1");
Expand Down Expand Up @@ -93,29 +96,30 @@ class InfillTest : public benchmark::Fixture

BENCHMARK_DEFINE_F(InfillTest, Infill_generate_connect)(benchmark::State& st)
{
Infill infill(pattern,
zig_zagify,
connect_polygons,
outline_polygons,
INFILL_LINE_WIDTH,
line_distance,
INFILL_OVERLAP,
INFILL_MULTIPLIER,
FILL_ANGLE,
Z,
SHIFT,
MAX_RESOLUTION,
MAX_DEVIATION); // There are some optional parameters, but these will do for now (future improvement?).
Infill infill(
pattern,
zig_zagify,
connect_polygons,
outline_polygons,
INFILL_LINE_WIDTH,
line_distance,
INFILL_OVERLAP,
INFILL_MULTIPLIER,
FILL_ANGLE,
Z,
SHIFT,
MAX_RESOLUTION,
MAX_DEVIATION); // There are some optional parameters, but these will do for now (future improvement?).

for (auto _ : st)
{
std::vector<VariableWidthLines> result_paths;
Polygons result_polygons;
Polygons result_lines;
Shape result_polygons;
OpenLinesSet result_lines;
infill.generate(result_paths, result_polygons, result_lines, settings, 0, SectionType::INFILL, nullptr, nullptr);
}
}

BENCHMARK_REGISTER_F(InfillTest, Infill_generate_connect)->ArgsProduct({{true, false}, {400, 800, 1200}})->Unit(benchmark::kMillisecond);
BENCHMARK_REGISTER_F(InfillTest, Infill_generate_connect)->ArgsProduct({ { true, false }, { 400, 800, 1200 } })->Unit(benchmark::kMillisecond);
} // namespace cura
#endif // CURAENGINE_INFILL_BENCHMARK_H
Loading

0 comments on commit 8712159

Please sign in to comment.