Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into optimized-prime-tower
Browse files Browse the repository at this point in the history
  • Loading branch information
wawanbreton committed Jan 25, 2024
2 parents 0db09b4 + 5c37ca5 commit 13d7956
Show file tree
Hide file tree
Showing 71 changed files with 111 additions and 3,880 deletions.
2 changes: 1 addition & 1 deletion benchmark/holes.wkt

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion benchmark/wall_benchmark.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#include <filesystem>
#include <fstream>
#include <iostream>
#include <spdlog/spdlog.h>

namespace cura
{
Expand Down Expand Up @@ -105,7 +106,7 @@ class HolesWallTestFixture : public benchmark::Fixture

void SetUp(const ::benchmark::State& state)
{
auto wkt_file = std::filesystem::path(__FILE__).parent_path().append("hole.wkt");
auto wkt_file = std::filesystem::path(__FILE__).parent_path().append("holes.wkt");
std::ifstream file{ wkt_file };

std::stringstream buffer;
Expand Down
2 changes: 1 addition & 1 deletion conandata.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version: "5.7.0-alpha.0"
version: "5.7.0-alpha.1"
requirements:
- "arcus/5.3.1"
- "curaengine_grpc_definitions/(latest)@ultimaker/testing"
Expand Down
35 changes: 23 additions & 12 deletions conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
# CuraEngine is released under the terms of the AGPLv3 or higher
from io import StringIO
from os import path
import os

from conan import ConanFile
from conan.errors import ConanInvalidConfiguration
Expand Down Expand Up @@ -90,7 +91,8 @@ def validate(self):

def build_requirements(self):
self.test_requires("standardprojectsettings/[>=0.1.0]@ultimaker/stable")
self.test_requires("protobuf/3.21.9")
if self.options.enable_arcus or self.options.enable_plugins:
self.tool_requires("protobuf/3.21.9")
if not self.conf.get("tools.build:skip_test", False, check_type=bool):
self.test_requires("gtest/1.12.1")
if self.options.enable_benchmarks:
Expand All @@ -104,6 +106,8 @@ def requirements(self):
self.requires(req)
if self.options.get_safe("enable_sentry", False):
self.requires("sentry-native/0.6.5")
if self.options.enable_arcus or self.options.enable_plugins:
self.requires("protobuf/3.21.9")
self.requires("asio-grpc/2.6.0")
self.requires("grpc/1.50.1")
self.requires("clipper/6.4.2@ultimaker/stable")
Expand All @@ -114,7 +118,6 @@ def requirements(self):
self.requires("fmt/10.1.1")
self.requires("range-v3/0.12.0")
self.requires("neargye-semver/0.3.0")
self.requires("protobuf/3.21.9")
self.requires("zlib/1.2.12")
self.requires("openssl/3.2.0")

Expand Down Expand Up @@ -145,15 +148,23 @@ def generate(self):
copy(self, "*.dll", dep.cpp_info.libdirs[0], self.build_folder)
if len(dep.cpp_info.bindirs) > 0:
copy(self, "*.dll", dep.cpp_info.bindirs[0], self.build_folder)

folder_dists = []
if not self.conf.get("tools.build:skip_test", False, check_type=bool):
test_path = path.join(self.build_folder, "tests")
if not path.exists(test_path):
mkdir(self, test_path)
folder_dists.append("tests")
if self.options.enable_benchmarks:
folder_dists.append("benchmark")
folder_dists.append("stress_benchmark")

for dist_folder in folder_dists:
dist_path = path.join(self.build_folder, dist_folder)
if not path.exists(dist_path):
mkdir(self, dist_path)
if len(dep.cpp_info.libdirs) > 0:
copy(self, "*.dylib", dep.cpp_info.libdirs[0], path.join(self.build_folder, "tests"))
copy(self, "*.dll", dep.cpp_info.libdirs[0], path.join(self.build_folder, "tests"))
copy(self, "*.dylib", dep.cpp_info.libdirs[0], path.join(self.build_folder, dist_folder))
copy(self, "*.dll", dep.cpp_info.libdirs[0], path.join(self.build_folder, dist_folder))
if len(dep.cpp_info.bindirs) > 0:
copy(self, "*.dll", dep.cpp_info.bindirs[0], path.join(self.build_folder, "tests"))
copy(self, "*.dll", dep.cpp_info.bindirs[0], path.join(self.build_folder, dist_folder))

def layout(self):
cmake_layout(self)
Expand Down Expand Up @@ -184,13 +195,13 @@ def build(self):

self.output.info("Uploading debug symbols to sentry")
build_source_dir = self.build_path.parent.parent.as_posix()
self.run(f"sentry-cli debug-files upload --include-sources -o {sentry_org} -p {sentry_project} {build_source_dir}")
self.run(f"sentry-cli --auth-token {os.environ['SENTRY_TOKEN']} debug-files upload --include-sources -o {sentry_org} -p {sentry_project} {build_source_dir}")

# create a sentry release and link it to the commit this is based upon
self.output.info(f"Creating a new release {self.version} in Sentry and linking it to the current commit {self.conan_data['commit']}")
self.run(f"sentry-cli releases new -o {sentry_org} -p {sentry_project} {self.version}")
self.run(f"sentry-cli releases set-commits -o {sentry_org} -p {sentry_project} --commit \"Ultimaker/CuraEngine@{self.conan_data['commit']}\" {self.version}")
self.run(f"sentry-cli releases finalize -o {sentry_org} -p {sentry_project} {self.version}")
self.run(f"sentry-cli --auth-token {os.environ['SENTRY_TOKEN']} releases new -o {sentry_org} -p {sentry_project} {self.version}")
self.run(f"sentry-cli --auth-token {os.environ['SENTRY_TOKEN']} releases set-commits -o {sentry_org} -p {sentry_project} --commit \"Ultimaker/CuraEngine@{self.conan_data['commit']}\" {self.version}")
self.run(f"sentry-cli --auth-token {os.environ['SENTRY_TOKEN']} releases finalize -o {sentry_org} -p {sentry_project} {self.version}")

def package(self):
ext = ".exe" if self.settings.os == "Windows" else ""
Expand Down
4 changes: 2 additions & 2 deletions include/utils/polygon.h
Original file line number Diff line number Diff line change
Expand Up @@ -1527,15 +1527,15 @@ class Polygons
*
* @param stream The stream to write to
*/
void writeWkt(std::ostream& stream) const;
[[maybe_unused]] void writeWkt(std::ostream& stream) const;

/*!
* @brief Import the polygon from a WKT string
*
* @param wkt The WKT string to read from
* @return Polygons The polygons read from the stream
*/
static Polygons fromWkt(const std::string& wkt);
[[maybe_unused]] static Polygons fromWkt(const std::string& wkt);
};

/*!
Expand Down
21 changes: 17 additions & 4 deletions src/raft.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ void Raft::generate(SliceDataStorage& storage)
storage.raftInterfaceOutline = storage.raftInterfaceOutline.unionPolygons(ooze_shield_raft);
}

const auto remove_inside_corners = [](Polygons& outline, bool remove_inside_corners, coord_t smoothing)
const auto remove_inside_corners = [](Polygons& outline, bool remove_inside_corners, coord_t smoothing, coord_t line_width)
{
if (remove_inside_corners)
{
Expand Down Expand Up @@ -106,12 +106,25 @@ void Raft::generate(SliceDataStorage& storage)
}
else
{
// Closing operation for smoothing:
outline = outline.offset(smoothing, ClipperLib::jtRound).offset(-smoothing, ClipperLib::jtRound);

// Opening operation to get rid of articfacts created by the closing operation:
outline = outline.offset(-line_width, ClipperLib::jtRound).offset(line_width, ClipperLib::jtRound);
}
};
remove_inside_corners(storage.raftBaseOutline, settings.get<bool>("raft_base_remove_inside_corners"), settings.get<coord_t>("raft_base_smoothing"));
remove_inside_corners(storage.raftInterfaceOutline, settings.get<bool>("raft_interface_remove_inside_corners"), settings.get<coord_t>("raft_interface_smoothing"));
remove_inside_corners(storage.raftSurfaceOutline, settings.get<bool>("raft_surface_remove_inside_corners"), settings.get<coord_t>("raft_surface_smoothing"));
const auto nominal_raft_line_width = settings.get<coord_t>("skirt_brim_line_width");
remove_inside_corners(storage.raftBaseOutline, settings.get<bool>("raft_base_remove_inside_corners"), settings.get<coord_t>("raft_base_smoothing"), nominal_raft_line_width);
remove_inside_corners(
storage.raftInterfaceOutline,
settings.get<bool>("raft_interface_remove_inside_corners"),
settings.get<coord_t>("raft_interface_smoothing"),
nominal_raft_line_width);
remove_inside_corners(
storage.raftSurfaceOutline,
settings.get<bool>("raft_surface_remove_inside_corners"),
settings.get<coord_t>("raft_surface_smoothing"),
nominal_raft_line_width);

if (storage.primeTower.enabled_ && ! storage.primeTower.would_have_actual_tower_)
{
Expand Down
25 changes: 13 additions & 12 deletions src/utils/polygon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,11 @@
#include <range/v3/range/primitives.hpp>
#include <range/v3/to_container.hpp>
#include <range/v3/view/c_str.hpp>
#include <range/v3/view/concat.hpp>
#include <range/v3/view/filter.hpp>
#include <range/v3/view/join.hpp>
#include <range/v3/view/sliding.hpp>
#include <range/v3/view/take.hpp>
#include <range/v3/view/transform.hpp>
#include <range/v3/view/zip.hpp>
#include <spdlog/spdlog.h>
Expand Down Expand Up @@ -808,7 +810,7 @@ Polygons Polygons::toPolygons(ClipperLib::PolyTree& poly_tree)
return ret;
}

Polygons Polygons::fromWkt(const std::string& wkt)
[[maybe_unused]] Polygons Polygons::fromWkt(const std::string& wkt)
{
typedef boost::geometry::model::d2::point_xy<double> point_type;
typedef boost::geometry::model::polygon<point_type> polygon_type;
Expand Down Expand Up @@ -838,24 +840,23 @@ Polygons Polygons::fromWkt(const std::string& wkt)
return ret;
}

void Polygons::writeWkt(std::ostream& stream) const
[[maybe_unused]] void Polygons::writeWkt(std::ostream& stream) const
{
stream << "POLYGON (";
const auto paths_str = paths
| ranges::views::transform(
[](const auto& path)
{
const auto path_str = path
| ranges::views::transform(
[](const auto& point)
{
return fmt::format("{} {}", point.X, point.Y);
})
| ranges::views::join(ranges::views::c_str(", ")) | ranges::to<std::string>();
return "(" + path_str + ")";
const auto line_string = ranges::views::concat(path, path | ranges::views::take(1))
| ranges::views::transform(
[](const auto& point)
{
return fmt::format("{} {}", point.X, point.Y);
})
| ranges::views::join(ranges::views::c_str(", ")) | ranges::to<std::string>();
return "(" + line_string + ")";
})
| ranges::views::join(ranges::views::c_str(" ")) | ranges::to<std::string>();

| ranges::views::join(ranges::views::c_str(", ")) | ranges::to<std::string>();
stream << paths_str;
stream << ")";
}
Expand Down
Loading

0 comments on commit 13d7956

Please sign in to comment.