Skip to content

Commit 3cb6da6

Browse files
authored
Part skip from Orca for Bambu printers (SoftFever#10875)
Ported part skip from BambuStudio. Thanks bambulab! <img width="1350" height="902" alt="image" src="https://github.com/user-attachments/assets/d7f89950-3420-4ea5-bbb6-e53c875e7422" /> Haven't fully tested yet! ### Minimum Firmware Requirements (from BambuStudio release page): - **X1C**: v01.09.02.12 or later - **H2D**: v01.02.00.00 or later - **Other models**: Currently not supported. Feature support coming in future firmware updates. > ⚠️ Make sure your printer firmware is up to date to use this feature.
2 parents f0b89ea + 2582c65 commit 3cb6da6

39 files changed

+4451
-172
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,3 +39,6 @@ src/OrcaSlicer-doc/
3939
resources/profiles/user/default
4040
*.code-workspace
4141
deps_src/build/
42+
test.js
43+
/.cache/
44+
.clangd

deps/OpenCV/OpenCV.cmake

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ orcaslicer_add_cmake_project(OpenCV
5353
-DWITH_OPENJPEG=OFF
5454
-DWITH_QUIRC=OFF
5555
-DWITH_VTK=OFF
56+
-DWITH_JPEG=OFF
5657
-DWITH_WEBP=OFF
5758
-DENABLE_PRECOMPILED_HEADERS=OFF
5859
-DINSTALL_TESTS=OFF

deps_src/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ project(deps_src)
66
# Header-only libraries (INTERFACE)
77
add_subdirectory(agg)
88
add_subdirectory(ankerl)
9+
add_subdirectory(earcut)
910
add_subdirectory(fast_float)
1011
add_subdirectory(nanosvg)
1112
add_subdirectory(nlohmann)

deps_src/earcut/CHANGELOG.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
## Earcut.hpp changelog
2+
3+
### master
4+
5+
- Fixed a bunch of rare edge cases that led to bad triangulation (parity with Earcut v2.2.2)
6+
- Removed use of deprecated `std::allocator::construct`
7+
- Fixed a minor z-order hashing bug
8+
- Improved visualization app, better docs
9+
10+
### v0.12.4
11+
12+
- Fixed a crash in Crash in Earcut::findHoleBridge
13+
- Added coverage checks
14+
- Added macOS, MinGW builds
15+
16+
### v0.12.3
17+
18+
- Fixed -Wunused-lambda-capture
19+
20+
### v0.12.2
21+
22+
- Fixed potential division by zero
23+
- Fixed -fsanitize=integer warning
24+
25+
### v0.12.1
26+
27+
- Fixed cast precision warning

deps_src/earcut/CMakeLists.txt

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
cmake_minimum_required(VERSION 3.13)
2+
project(earcut)
3+
4+
add_library(earcut INTERFACE)
5+
6+
target_include_directories(earcut SYSTEM
7+
INTERFACE
8+
${CMAKE_CURRENT_SOURCE_DIR}
9+
)
10+
11+
target_sources(earcut INTERFACE
12+
${CMAKE_CURRENT_SOURCE_DIR}/earcut.hpp
13+
)

deps_src/earcut/LICENSE

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
ISC License
2+
3+
Copyright (c) 2015, Mapbox
4+
5+
Permission to use, copy, modify, and/or distribute this software for any purpose
6+
with or without fee is hereby granted, provided that the above copyright notice
7+
and this permission notice appear in all copies.
8+
9+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
10+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
11+
FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
12+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
13+
OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
14+
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
15+
THIS SOFTWARE.

deps_src/earcut/README.md

Lines changed: 131 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,131 @@
1+
## Earcut
2+
3+
A C++ port of [earcut.js](https://github.com/mapbox/earcut), a fast, [header-only](https://github.com/mapbox/earcut.hpp/blob/master/include/mapbox/earcut.hpp) polygon triangulation library.
4+
5+
[![Travis](https://img.shields.io/travis/com/mapbox/earcut.hpp.svg)](https://travis-ci.com/github/mapbox/earcut.hpp)
6+
[![AppVeyor](https://ci.appveyor.com/api/projects/status/a1ysrqd69mqn7coo/branch/master?svg=true)](https://ci.appveyor.com/project/Mapbox/earcut-hpp-8wm4o/branch/master)
7+
[![Coverage](https://img.shields.io/coveralls/github/mapbox/earcut.hpp.svg)](https://coveralls.io/github/mapbox/earcut.hpp)
8+
[![Coverity Scan](https://img.shields.io/coverity/scan/14000.svg)](https://scan.coverity.com/projects/14000)
9+
[![Average time to resolve an issue](http://isitmaintained.com/badge/resolution/mapbox/earcut.hpp.svg)](http://isitmaintained.com/project/mapbox/earcut.hpp "Average time to resolve an issue")
10+
[![Percentage of issues still open](http://isitmaintained.com/badge/open/mapbox/earcut.hpp.svg)](http://isitmaintained.com/project/mapbox/earcut.hpp "Percentage of issues still open")
11+
[![Mourner](https://img.shields.io/badge/simply-awesome-brightgreen.svg)](https://github.com/mourner/projects)
12+
13+
The library implements a modified ear slicing algorithm, optimized by [z-order curve](http://en.wikipedia.org/wiki/Z-order_curve) hashing and extended to handle holes, twisted polygons, degeneracies and self-intersections in a way that doesn't _guarantee_ correctness of triangulation, but attempts to always produce acceptable results for practical data like geographical shapes.
14+
15+
It's based on ideas from [FIST: Fast Industrial-Strength Triangulation of Polygons](http://www.cosy.sbg.ac.at/~held/projects/triang/triang.html) by Martin Held and [Triangulation by Ear Clipping](http://www.geometrictools.com/Documentation/TriangulationByEarClipping.pdf) by David Eberly.
16+
17+
## Usage
18+
19+
```cpp
20+
#include <earcut.hpp>
21+
```
22+
```cpp
23+
// The number type to use for tessellation
24+
using Coord = double;
25+
26+
// The index type. Defaults to uint32_t, but you can also pass uint16_t if you know that your
27+
// data won't have more than 65536 vertices.
28+
using N = uint32_t;
29+
30+
// Create array
31+
using Point = std::array<Coord, 2>;
32+
std::vector<std::vector<Point>> polygon;
33+
34+
// Fill polygon structure with actual data. Any winding order works.
35+
// The first polyline defines the main polygon.
36+
polygon.push_back({{100, 0}, {100, 100}, {0, 100}, {0, 0}});
37+
// Following polylines define holes.
38+
polygon.push_back({{75, 25}, {75, 75}, {25, 75}, {25, 25}});
39+
40+
// Run tessellation
41+
// Returns array of indices that refer to the vertices of the input polygon.
42+
// e.g: the index 6 would refer to {25, 75} in this example.
43+
// Three subsequent indices form a triangle. Output triangles are clockwise.
44+
std::vector<N> indices = mapbox::earcut<N>(polygon);
45+
```
46+
47+
Earcut can triangulate a simple, planar polygon of any winding order including holes. It will even return a robust, acceptable solution for non-simple poygons. Earcut works on a 2D plane. If you have three or more dimensions, you can project them onto a 2D surface before triangulation, or use a more suitable library for the task (e.g [CGAL](https://doc.cgal.org/latest/Triangulation_3/index.html)).
48+
49+
50+
It is also possible to use your custom point type as input. There are default accessors defined for `std::tuple`, `std::pair`, and `std::array`. For a custom type (like Clipper's `IntPoint` type), do this:
51+
52+
```cpp
53+
// struct IntPoint {
54+
// int64_t X, Y;
55+
// };
56+
57+
namespace mapbox {
58+
namespace util {
59+
60+
template <>
61+
struct nth<0, IntPoint> {
62+
inline static auto get(const IntPoint &t) {
63+
return t.X;
64+
};
65+
};
66+
template <>
67+
struct nth<1, IntPoint> {
68+
inline static auto get(const IntPoint &t) {
69+
return t.Y;
70+
};
71+
};
72+
73+
} // namespace util
74+
} // namespace mapbox
75+
```
76+
77+
You can also use a custom container type for your polygon. Similar to std::vector<T>, it has to meet the requirements of [Container](https://en.cppreference.com/w/cpp/named_req/Container), in particular `size()`, `empty()` and `operator[]`.
78+
79+
<p align="center">
80+
<img src="https://camo.githubusercontent.com/01836f8ba21af844c93d8d3145f4e9976025a696/68747470733a2f2f692e696d6775722e636f6d2f67314e704c54712e706e67" alt="example triangulation"/>
81+
</p>
82+
83+
## Additional build instructions
84+
In case you just want to use the earcut triangulation library; copy and include the header file [`<earcut.hpp>`](https://github.com/mapbox/earcut.hpp/blob/master/include/mapbox/earcut.hpp) in your project and follow the steps documented in the section [Usage](#usage).
85+
86+
If you want to build the test, benchmark and visualization programs instead, follow these instructions:
87+
88+
### Dependencies
89+
90+
Before you continue, make sure to have the following tools and libraries installed:
91+
* git ([Ubuntu](https://help.ubuntu.com/lts/serverguide/git.html)/[Windows/macOS](http://git-scm.com/downloads))
92+
* cmake 3.2+ ([Ubuntu](https://launchpad.net/~george-edison55/+archive/ubuntu/cmake-3.x)/[Windows/macOS](https://cmake.org/download/))
93+
* OpenGL SDK ([Ubuntu](http://packages.ubuntu.com/de/trusty/libgl1-mesa-dev)/[Windows](https://dev.windows.com/en-us/downloads/windows-10-sdk)/[macOS](https://developer.apple.com/opengl/))
94+
* Compiler such as [GCC 4.9+, Clang 3.4+](https://launchpad.net/~ubuntu-toolchain-r/+archive/ubuntu/test), [MSVC12+](https://www.visualstudio.com/)
95+
96+
Note: On some operating systems such as Windows, manual steps are required to add cmake and [git](http://blog.countableset.ch/2012/06/07/adding-git-to-windows-7-path/) to your PATH environment variable.
97+
98+
### Manual compilation
99+
100+
```bash
101+
git clone --recursive https://github.com/mapbox/earcut.hpp.git
102+
cd earcut.hpp
103+
mkdir build
104+
cd build
105+
cmake ..
106+
make
107+
# ./tests
108+
# ./bench
109+
# ./viz
110+
```
111+
112+
### [Visual Studio](https://www.visualstudio.com/), [Eclipse](https://eclipse.org/), [XCode](https://developer.apple.com/xcode/), ...
113+
114+
```batch
115+
git clone --recursive https://github.com/mapbox/earcut.hpp.git
116+
cd earcut.hpp
117+
mkdir project
118+
cd project
119+
cmake .. -G "Visual Studio 14 2015"
120+
::you can also generate projects for "Visual Studio 12 2013", "XCode", "Eclipse CDT4 - Unix Makefiles"
121+
```
122+
After completion, open the generated project with your IDE.
123+
124+
125+
### [CLion](https://www.jetbrains.com/clion/), [Visual Studio 2017+](https://www.visualstudio.com/)
126+
127+
Import the project from https://github.com/mapbox/earcut.hpp.git and you should be good to go!
128+
129+
## Status
130+
131+
This is currently based on [earcut 2.2.4](https://github.com/mapbox/earcut#224-jul-5-2022).

0 commit comments

Comments
 (0)