diff --git a/include/BoostInterface.hpp b/include/BoostInterface.hpp index ff8a47ae29..52cf9e9f84 100644 --- a/include/BoostInterface.hpp +++ b/include/BoostInterface.hpp @@ -13,6 +13,8 @@ using CSegment = cura::PolygonsSegmentIndex; +using CPolygon = boost::polygon::polygon_data; +using CPolygonSet = std::vector; namespace boost { namespace polygon { diff --git a/include/boostpoly/boost_tags.h b/include/boostpoly/boost_tags.h deleted file mode 100644 index 108fcf58bc..0000000000 --- a/include/boostpoly/boost_tags.h +++ /dev/null @@ -1,130 +0,0 @@ -// Copyright (c) 2023 UltiMaker -// curaengine_plugin_generate_infill is released under the terms of the AGPLv3 or higher - -#ifndef INFILL_BOOST_TAGS_H -#define INFILL_BOOST_TAGS_H - -#include "./point_container.h" -#include "./concepts.h" -#include "utils/IntPoint.h" - -#include -#include -#include -#include -#include - -#include - -namespace boost::geometry::traits -{ -template<> -struct tag -{ - using type = point_tag; -}; - -template<> -struct dimension : boost::mpl::int_<2> -{ -}; - -template<> -struct coordinate_type -{ - using type = ClipperLib::cInt; -}; - -template<> -struct coordinate_system -{ - using type = boost::geometry::cs::cartesian; -}; - -template -struct access -{ - static_assert(Index < 2, "Out of range"); - using Point = ClipperLib::IntPoint; - using CoordinateType = typename coordinate_type::type; - constexpr static inline CoordinateType get(Point const& p) noexcept - { - return Index == 0 ? p.X : p.Y; - } - - constexpr static inline void set(Point& p, CoordinateType const& value) noexcept - { - if (Index == 0) - { - p.X = value; - } - else - { - p.Y = value; - } - } -}; - -template<> -struct tag> -{ - using type = linestring_tag; -}; - -template<> -struct point_order> -{ - static const order_selector value = clockwise; -}; - -template<> -struct closure> -{ - static const closure_selector value = open; // TODO: closed?, but when it is closed the order of the points changes -}; - -template<> -struct tag> -{ - using type = ring_tag; -}; - -template<> -struct point_order> -{ - static const order_selector value = counterclockwise; -}; - -template<> -struct closure> -{ - static const closure_selector value = open; // TODO: closed?, but when it is closed the order of the points changes -}; - -template<> -struct tag> -{ - using type = ring_tag; -}; - -template<> -struct point_order -{ - static const order_selector value = counterclockwise; -}; - -template<> -struct closure -{ - static const closure_selector value = open; // TODO: closed?, but when it is closed the order of the points changes -}; - -template<> -struct tag -{ - using type = ring_tag; -}; - -} // namespace boost::geometry::traits - -#endif // INFILL_BOOST_TAGS_H diff --git a/include/boostpoly/concepts.h b/include/boostpoly/concepts.h deleted file mode 100644 index 575f1886a3..0000000000 --- a/include/boostpoly/concepts.h +++ /dev/null @@ -1,102 +0,0 @@ -// Copyright (c) 2023 UltiMaker -// curaengine_plugin_generate_infill is released under the terms of the AGPLv3 or higher - -#ifndef UTILS_CONCEPTS_GEOMETRY_H -#define UTILS_CONCEPTS_GEOMETRY_H - -#include - -#include -#include -#include - - -namespace infill -{ -enum class direction -{ - NA, - CW, - CCW -}; - -namespace concepts -{ - -template -concept closable = requires(T t) { requires std::convertible_to; }; - -template -concept is_closed_point_container = closable && requires(T t) { t.is_closed == true; }; - -template -concept is_open_point_container = closable && requires(T t) { t.is_closed == false; }; - -template -concept directional = requires(T t) { requires std::is_same_v; }; - -template -concept is_clockwise_point_container = directional && requires(T t) { t.winding == direction::CW; }; - -template -concept is_counterclockwise_point_container = directional && requires(T t) { t.winding == direction::CCW; }; - -template -concept point2d_named = requires(T point) { - point.X; - point.Y; -}; - -/*! - * @brief A 2D point, defined either as a named object with X and Y attributes, or as a range of two integral values. - * @details This concept is used to check if a type is a 2D point. A 2D point is a type that has a X and Y member or a type that is a range of integral types with a size of 2. - * @tparam T Type to check - */ -template -concept point2d = point2d_named || (ranges::range && std::integral && std::tuple_size_v == 2); - -template -concept point3d_named = requires(T point) { - point.x; - point.y; - point.z; -}; - -/*! - * @brief A 3D point, defined either as a named object with x, y, and z attributes, or as a range of three integral values. - * @details This concept is used to check if a type is a 3D point. A 3D point is a type that has a x, y and z member or a type that is a range of integral types with a size of 3. - * @tparam T Type to check - */ -template -concept point3d = point3d_named || (ranges::range && std::integral && std::tuple_size_v == 3); - -template -concept point_named = point2d_named || point3d_named; - -/*! - * @brief Either a Point2D or a Point3D - * @details This concept is used to check if a type is a point. A point is a type that is a 2D or 3D point. - * @tparam T Type to check - */ -template -concept point = point2d || point3d; - -template -concept point_ranged = point && ! point2d_named && ! point3d_named; - -template -concept polyline = ranges::range && is_open_point_container && point; - -template -concept polygon = ranges::range && is_closed_point_container && point; - -template -concept polygons = ranges::range && polygon; - -template -concept poly_range = polygon || polyline; - -} // namespace concepts -} // namespace infill - -#endif // UTILS_CONCEPTS_GEOMETRY_H \ No newline at end of file diff --git a/include/boostpoly/geometry.h b/include/boostpoly/geometry.h deleted file mode 100644 index 8281554f64..0000000000 --- a/include/boostpoly/geometry.h +++ /dev/null @@ -1,82 +0,0 @@ -// Copyright (c) 2023 UltiMaker -// curaengine_plugin_generate_infill is released under the terms of the AGPLv3 or higher - -#ifndef CURAENGINE_PLUGIN_INFILL_GENERATE_INCLUDE_INFILL_GEOMETRY_H -#define CURAENGINE_PLUGIN_INFILL_GENERATE_INCLUDE_INFILL_GEOMETRY_H - -#include "./point_container.h" -#include "utils/IntPoint.h" - -#include -#include -#include - -namespace boostpoly -{ - -using BoundingBox = std::vector; - -static BoundingBox computeBoundingBox(const auto& contour) -{ - ClipperLib::IntPoint p_min{ std::numeric_limits::max(), std::numeric_limits::max() }; - ClipperLib::IntPoint p_max{ std::numeric_limits::min(), std::numeric_limits::min() }; - - for (const auto& point : contour) - { - p_min.X = std::min(p_min.X, point.X); - p_min.Y = std::min(p_min.Y, point.Y); - p_max.X = std::max(p_max.X, point.X); - p_max.Y = std::max(p_max.Y, point.Y); - } - - return { p_min, p_max }; -} - -static ClipperLib::IntPoint computeCoG(const auto& contour) -{ - ClipperLib::IntPoint cog{ 0, 0 }; - for (const auto& point : contour) - { - cog.X += point.X; - cog.Y += point.Y; - } - cog.X /= contour.size(); - cog.Y /= contour.size(); - return cog; -} - -static ClipperLib::Paths clip(const auto& polys, const bool& is_poly_closed, const std::vector>& outer_contours) -{ - ClipperLib::Clipper clipper; - ClipperLib::Paths outline_poly; - for (const auto& poly : outer_contours) - { - outline_poly.push_back(poly); - } - clipper.AddPaths(outline_poly, ClipperLib::PolyType::ptClip, true); - - ClipperLib::Paths grid_poly; - for (auto& poly : polys) - { - grid_poly.push_back(poly); - } - clipper.AddPaths(grid_poly, ClipperLib::PolyType::ptSubject, is_poly_closed); - - ClipperLib::Paths ret; - if (! is_poly_closed) - { - ClipperLib::PolyTree result; - clipper.Execute(ClipperLib::ClipType::ctIntersection, result); - ClipperLib::OpenPathsFromPolyTree(result, ret); - } - else - { - clipper.Execute(ClipperLib::ClipType::ctIntersection, ret); - } - return ret; -} - -} // namespace boostpoly - - -#endif // CURAENGINE_PLUGIN_INFILL_GENERATE_INCLUDE_INFILL_GEOMETRY_H diff --git a/include/boostpoly/point_container.h b/include/boostpoly/point_container.h deleted file mode 100644 index 3c98d4bdb8..0000000000 --- a/include/boostpoly/point_container.h +++ /dev/null @@ -1,134 +0,0 @@ -// Copyright (c) 2023 UltiMaker -// curaengine_plugin_generate_infill is released under the terms of the AGPLv3 or higher - -#ifndef UTILS_GEOMETRY_POINT_CONTAINER_H -#define UTILS_GEOMETRY_POINT_CONTAINER_H - -#include "./concepts.h" -#include "utils/IntPoint.h" - -#include -#include - -#include -#include -#include - -namespace boostpoly -{ - -using Point = ClipperLib::IntPoint; - -/*! The base clase of all point based container types - * - * @tparam P - * @tparam IsClosed - * @tparam Direction - * @tparam Container - */ -template -struct point_container : public std::vector

-{ - inline static constexpr bool is_closed = IsClosed; - inline static constexpr direction winding = Direction; - - constexpr point_container() noexcept = default; - constexpr explicit point_container(std::initializer_list

points) noexcept - : std::vector

(points) - { - } -}; - -template -struct polyline : public point_container -{ - constexpr polyline() noexcept = default; - constexpr explicit polyline(std::initializer_list

points) noexcept - : point_container(points) - { - } -}; - -template -struct polygon : public point_container -{ - constexpr polygon() noexcept = default; - constexpr polygon(std::initializer_list

points) noexcept - : point_container(points) - { - } -}; - -template -polygon(std::initializer_list

) -> polygon; - -template -struct polygon_outer : public point_container -{ - constexpr polygon_outer() noexcept = default; - constexpr explicit polygon_outer(std::initializer_list

points) noexcept - : point_container(points) - { - } -}; - -template -polygon_outer(std::initializer_list

) -> polygon_outer

; - -template -struct polygon_inner : public point_container -{ - constexpr polygon_inner() noexcept = default; - constexpr explicit polygon_inner(std::initializer_list

points) noexcept - : point_container(points) - { - } -}; - -template -polygon_inner(std::initializer_list

) -> polygon_inner

; - -template -struct polygons : public std::vector*> -{ - constexpr polygons() noexcept = default; - constexpr explicit polygons(std::initializer_list*> polygons) noexcept - : std::vector*>(polygons) - { - } - - constexpr auto outer() noexcept - { - return polygon_outer{ this->front() }; - } - - constexpr auto inners() noexcept - { - return ranges::views::drop(this->base(), 1) - | ranges::views::transform( - [](auto& p) - { - return polygon_inner{ p }; - }); - } -}; - -template -polygons(polygon_outer

, std::initializer_list>) -> polygons

; - -} // namespace boostpoly - -static inline boostpoly::Point operator-(const boostpoly::Point& p0) -{ - return boostpoly::Point{ -p0.X, -p0.Y }; -} -static inline boostpoly::Point operator+(const boostpoly::Point& p0, const boostpoly::Point& p1) -{ - return boostpoly::Point{ p0.X + p1.X, p0.Y + p1.Y }; -} -static inline boostpoly::Point operator-(const boostpoly::Point& p0, const boostpoly::Point& p1) -{ - return boostpoly::Point{ p0.X - p1.X, p0.Y - p1.Y }; -} - -#endif // UTILS_GEOMETRY_POINT_CONTAINER_H \ No newline at end of file diff --git a/include/utils/ThreadPool.h b/include/utils/ThreadPool.h index 620f697a1e..28f17b8080 100644 --- a/include/utils/ThreadPool.h +++ b/include/utils/ThreadPool.h @@ -228,7 +228,7 @@ void run_multiple_producers_ordered_consumer(ptrdiff_t first, ptrdiff_t last, P& ThreadPool* thread_pool = Application::getInstance().thread_pool; assert(thread_pool); assert(max_pending_per_worker > 0); - const size_t max_pending = 1; // max_pending_per_worker* (thread_pool->thread_count() + 1); + const size_t max_pending = max_pending_per_worker * (thread_pool->thread_count() + 1); MultipleProducersOrderedConsumer(first, last, std::forward

(producer), std::forward(consumer), max_pending).run(*thread_pool); } diff --git a/include/utils/polygon.h b/include/utils/polygon.h index 633066e363..a0adf4666e 100644 --- a/include/utils/polygon.h +++ b/include/utils/polygon.h @@ -1257,8 +1257,6 @@ class Polygons */ Polygons getOutsidePolygons() const; - std::vector splitByOuter() const; - /*! * Exclude holes which have no parts inside of them. * \return the resulting polygons. diff --git a/src/Application.cpp b/src/Application.cpp index 48c3c06bdb..0074940150 100644 --- a/src/Application.cpp +++ b/src/Application.cpp @@ -251,7 +251,7 @@ void Application::startThreadPool(int nworkers) return; // Keep the previous ThreadPool } delete thread_pool; - thread_pool = new ThreadPool(1); // (nthreads); + thread_pool = new ThreadPool(nthreads); } } // namespace cura diff --git a/src/SkeletalTrapezoidation.cpp b/src/SkeletalTrapezoidation.cpp index 173912e945..c391b0d4f6 100644 --- a/src/SkeletalTrapezoidation.cpp +++ b/src/SkeletalTrapezoidation.cpp @@ -412,27 +412,9 @@ void SkeletalTrapezoidation::constructFromPolygons(const Polygons& polys) } } - std::fprintf(stderr, " A %ld", layer_idx); - std::fflush(stderr); - vd_t vonoroi_diagram; construct_voronoi(segments.begin(), segments.end(), &vonoroi_diagram); - std::fprintf(stderr, " B %ld", layer_idx); - std::fflush(stderr); - - /* BOOKMARK! - if - - for (vd_t::cell_type cell : vonoroi_diagram.cells()) - { - if (!cell.incident_edge()) - { // There is no spoon - continue; - } - } - */ - for (vd_t::cell_type cell : vonoroi_diagram.cells()) { if (! cell.incident_edge()) @@ -494,35 +476,10 @@ void SkeletalTrapezoidation::constructFromPolygons(const Polygons& polys) prev_edge->to->data.distance_to_boundary = 0; } - std::fprintf(stderr, " C %ld", layer_idx); - std::fflush(stderr); - - //if (layer_idx == 153) - //{ - AABB aabb(polys); - const std::string filename(fmt::format("C:/tmp_/polyboost/X_{}_{}.svg", layer_idx, std::rand() % 9999)); - SVG svg(filename, aabb); - svg.writePolygons(polys); - - for (const auto& edge : graph.edges) - { - if (edge.from && edge.to) - { - svg.writeLine(edge.from->p, edge.to->p, SVG::Color::RED); - } - } - //} - separatePointyQuadEndNodes(); - std::fprintf(stderr, " D %ld", layer_idx); - std::fflush(stderr); - graph.collapseSmallEdges(); - std::fprintf(stderr, " E %ld", layer_idx); - std::fflush(stderr); - // Set [incident_edge] the the first possible edge that way we can iterate over all reachable edges from node.incident_edge, // without needing to iterate backward for (edge_t& edge : graph.edges) @@ -532,9 +489,6 @@ void SkeletalTrapezoidation::constructFromPolygons(const Polygons& polys) edge.from->incident_edge = &edge; } } - - std::fprintf(stderr, " F %ld", layer_idx); - std::fflush(stderr); } void SkeletalTrapezoidation::separatePointyQuadEndNodes() @@ -578,9 +532,6 @@ void SkeletalTrapezoidation::generateToolpaths(std::vector& updateIsCentral(); - std::fprintf(stderr, " G %ld", layer_idx); - std::fflush(stderr); - filterCentral(central_filter_dist); if (filter_outermost_central_edges) @@ -588,9 +539,6 @@ void SkeletalTrapezoidation::generateToolpaths(std::vector& filterOuterCentral(); } - std::fprintf(stderr, " H %ld", layer_idx); - std::fflush(stderr); - updateBeadCount(); scripta::log( "st_graph_0", @@ -606,7 +554,7 @@ void SkeletalTrapezoidation::generateToolpaths(std::vector& [](const auto& edge) { return static_cast(edge.data.type); - } }/*, + } }, scripta::PointVDI{ "distance_to_boundary", [](const auto& node) { @@ -621,10 +569,7 @@ void SkeletalTrapezoidation::generateToolpaths(std::vector& [](const auto& node) { return node->data.transition_ratio; - } }*/); - - std::fprintf(stderr, " I", layer_idx); - std::fflush(stderr); + } }); filterNoncentralRegions(); scripta::log( diff --git a/src/WallToolPaths.cpp b/src/WallToolPaths.cpp index 7645c0c8c6..51a42c7168 100644 --- a/src/WallToolPaths.cpp +++ b/src/WallToolPaths.cpp @@ -20,20 +20,12 @@ #include - - - -#include -#include -#include #include #include #include #include "mapbox/geometry/wagyu/wagyu.hpp" - - namespace cura { @@ -131,18 +123,11 @@ const std::vector& WallToolPaths::generate() return toolpaths; } - - { // begin: debug - - - //if (layer_idx == 153) - //{ - std::fprintf(stderr, "!!!\n"); - + { // begin: test fix polygons using map_pt = mapbox::geometry::point; - using map_ring = mapbox::geometry::linear_ring; //map_pt>; - using map_poly = mapbox::geometry::polygon; //map_ring>; - using map_mpoly = mapbox::geometry::multi_polygon; //map_poly>; + using map_ring = mapbox::geometry::linear_ring; + using map_poly = mapbox::geometry::polygon; + using map_mpoly = mapbox::geometry::multi_polygon; map_mpoly mwpoly; @@ -173,181 +158,31 @@ const std::vector& WallToolPaths::generate() Polygons polys; { - int randi = std::rand() % 9999; - const std::string filename(fmt::format("C:/tmp_/wgu_out/{}_{}.svg", layer_idx, randi)); - SVG svg(filename, AABB(prepared_outline), 1.0); - SVG::Color col = SVG::Color::RED; - const std::vector arr = { SVG::Color::RED, SVG::Color::ORANGE, SVG::Color::MAGENTA, SVG::Color::GRAY }; for (const auto& poly : sln) { - //polys.emplace_back(); - - - col = arr[std::rand() % 4]; for (const auto& ring : poly) { Polygon npoly; - //polys.back().emplace_back(); - auto last = ring.back(); bool first = true; for (const auto& pt : ring) { - //polys.back().back().emplace_back(pt.x * 5, pt.y * 5); if (first || pt != ring.back()) { npoly.emplace_back(pt.x * 4, pt.y * 4); first = false; } - - svg.writeLine({ last.x * 4, last.y * 4 }, { pt.x * 4, pt.y * 4 }, col); last = pt; } - col = SVG::Color::GREEN; - polys.add(npoly); } - - } - - polys = polys.unionPolygons(); polys.removeColinearEdges(); - - svg.writePolygons(polys); - - } - - - //mapbox::geometry::wagyu::correct_topology() - //} - - - - - - namespace bg = boost::geometry; - - const AABB aabb(polys); //prepared_outline); - const int randi = std::rand() % 9999; - - bg::model::multi_polygon>> bmpoly; - - const auto polyvec = polys.splitIntoParts(); //prepared_outline.splitIntoParts(); - //const auto polyvec = polys.splitByOuter(); - for (const auto& [i, poly_] : polyvec | ranges::views::enumerate) - { - const auto poly = poly_.unionPolygons(); - - const std::string filename(fmt::format("C:/tmp_/polyboost/{}__{}_{}.svg", layer_idx, randi, i)); - SVG svg(filename, aabb, 1.0); - - bg::model::polygon> bpoly; - - Point last = poly.paths[0].back(); - //bpoly.outer().emplace_back(static_cast(last.X), static_cast(last.Y)); - for (const auto& point : poly.paths[0]) - { - bpoly.outer().emplace_back(static_cast(point.X), static_cast(point.Y)); - - //svg.writePoint(point, false, 2.0f, SVG::Color::RED); - svg.writeLine(last, point, SVG::Color::RED); - - last = point; - } - - for (const auto& path : poly.paths | ranges::views::drop(1)) - { - bpoly.inners().emplace_back(); - last = path.back(); - //bpoly.inners().back().emplace_back(static_cast(last.X), static_cast(last.Y)); - for (const auto& point : path) - { - bpoly.inners().back().emplace_back(static_cast(point.X), static_cast(point.Y)); - - //svg.writePoint(point, false, 2.0f, SVG::Color::GREEN); - svg.writeLine(last, point, SVG::Color::GREEN); - - last = point; - } - } - - const bool check_touch = bg::touches(bpoly); - if (check_touch) - { - const std::string wkt{ bg::to_wkt(bpoly) }; - std::fprintf(stderr, "\n\n[!] TOUCH-SELF [!]\n%s\n%s\n", filename.c_str(), wkt.c_str()); - - //if (layer_idx != 153) - //{ - return {}; // NOTE! REMOVES POLYGONS! - //} - } - //else - //{ - // std::fprintf(stderr, "1.\n"); - //} - - const bool check_intersect = bg::intersects(bpoly); - if (check_intersect) - { - const std::string wkt{ bg::to_wkt(bpoly) }; - std::fprintf(stderr, "\n\n[!] INTERSECT-SELF [!]\n%s\n%s\n", filename.c_str(), wkt.c_str()); - - //if (layer_idx != 153) - //{ - return {}; // NOTE! REMOVES POLYGONS! - //} - } - //else - //{ - // std::fprintf(stderr, "2.\n"); - //} - - /* - const bool check_valid = bg::is_valid(bpoly); - if (! check_valid) - { - std::fprintf(stderr, "\n\n[!] INVALID SITUATION [!]\n\n\n"); - } - else - { - std::fprintf(stderr, "#"); - } - */ - - bmpoly.push_back(bpoly); - } - - const bool check_touch = bg::touches(bmpoly); - if (check_touch) - { - const std::string wkt{ bg::to_wkt(bmpoly) }; - std::fprintf(stderr, "\n\n[!!] MULTI: TOUCH-SELF [!!]\n%d\n%s\n", layer_idx, wkt.c_str()); - - return {}; // NOTE! REMOVES POLYGONS! - } - //else - //{ - // std::fprintf(stderr, "1.\n"); - //} - - const bool check_intersect = bg::intersects(bmpoly); - if (check_intersect) - { - const std::string wkt{ bg::to_wkt(bmpoly) }; - std::fprintf(stderr, "\n\n[!!] MULTI: INTERSECT-SELF [!!]\n%d\n%s\n", layer_idx, wkt.c_str()); - - return {}; // NOTE! REMOVES POLYGONS! } prepared_outline = polys; - - } // end: debug - - - std::fprintf(stderr, "START in LAYER %d {\n", layer_idx); + } // end: test fix polygons const coord_t wall_transition_length = settings.get("wall_transition_length"); @@ -400,9 +235,6 @@ const std::vector& WallToolPaths::generate() scripta::PointVDI{ "width", &ExtrusionJunction::w }, scripta::PointVDI{ "perimeter_index", &ExtrusionJunction::perimeter_index }); - std::fprintf(stderr, " Z", layer_idx); - std::fflush(stderr); - stitchToolPaths(toolpaths, settings); scripta::log( "toolpaths_1", @@ -472,9 +304,6 @@ const std::vector& WallToolPaths::generate() scripta::CellVDI{ "inset_idx", &ExtrusionLine::inset_idx }, scripta::PointVDI{ "width", &ExtrusionJunction::w }, scripta::PointVDI{ "perimeter_index", &ExtrusionJunction::perimeter_index }); - - std::fprintf(stderr, "} END in LAYER %d\n", layer_idx); - return toolpaths; } diff --git a/src/gcodeExport.cpp b/src/gcodeExport.cpp index 42632b638a..629f7b824b 100644 --- a/src/gcodeExport.cpp +++ b/src/gcodeExport.cpp @@ -1271,8 +1271,8 @@ void GCodeExport::startExtruder(const size_t new_extruder) } } - //const auto start_code_duration = extruder_settings.get("machine_extruder_start_code_duration"); - //estimateCalculator.addTime(start_code_duration); + const auto start_code_duration = extruder_settings.get("machine_extruder_start_code_duration"); + estimateCalculator.addTime(start_code_duration); Application::getInstance().communication->setExtruderForSend(Application::getInstance().current_slice->scene.extruders[new_extruder]); Application::getInstance().communication->sendCurrentPosition(getPositionXY()); @@ -1322,8 +1322,8 @@ void GCodeExport::switchExtruder(size_t new_extruder, const RetractionConfig& re } } - //const auto end_code_duration = old_extruder_settings.get("machine_extruder_end_code_duration"); - //estimateCalculator.addTime(end_code_duration); + const auto end_code_duration = old_extruder_settings.get("machine_extruder_end_code_duration"); + estimateCalculator.addTime(end_code_duration); startExtruder(new_extruder); } diff --git a/src/utils/polygon.cpp b/src/utils/polygon.cpp index a1a73bee5b..447d5de056 100644 --- a/src/utils/polygon.cpp +++ b/src/utils/polygon.cpp @@ -552,29 +552,6 @@ Polygons Polygons::getOutsidePolygons() const return ret; } -std::vector Polygons::splitByOuter() const -{ - std::vector ret; - ClipperLib::Clipper clipper(clipper_init); - ClipperLib::PolyTree poly_tree; - constexpr bool paths_are_closed_polys = true; - clipper.AddPaths(paths, ClipperLib::ptSubject, paths_are_closed_polys); - clipper.Execute(ClipperLib::ctUnion, poly_tree); - - for (int outer_poly_idx = 0; outer_poly_idx < poly_tree.ChildCount(); outer_poly_idx++) - { - ClipperLib::PolyNode* child = poly_tree.Childs[outer_poly_idx]; - ret.emplace_back(); - - ret.back().emplace_back(child->Contour); - for (const auto& insides : child->Childs) - { - ret.back().emplace_back(insides->Contour); // FIXME!! This means only 1st level holes will be taken along! Should be enough to debug, but not OK in general. - } - } - return ret; -} - Polygons Polygons::removeEmptyHoles() const { Polygons ret;