diff options
author | tamasmeszaros <meszaros.q@gmail.com> | 2019-07-16 19:33:42 +0300 |
---|---|---|
committer | tamasmeszaros <meszaros.q@gmail.com> | 2019-07-16 19:33:42 +0300 |
commit | 44801f442932dfc3c61c5bbe6aa2eff597e448b5 (patch) | |
tree | 99988ba2fda733dda89b0796c69a80d10b914d5a /src/libnest2d | |
parent | 5446167c1112fda5c2baefd10715ad0af48416d8 (diff) |
Priority for wipe tower, Increased safety distance from bed edges.
* WipeTowerInfo class extended in plater (WipeTower) instead of GLCanvas3D
* Bed origin support in ModelInstance and WipeTower
Diffstat (limited to 'src/libnest2d')
-rw-r--r-- | src/libnest2d/include/libnest2d/libnest2d.hpp | 6 | ||||
-rw-r--r-- | src/libnest2d/include/libnest2d/selections/firstfit.hpp | 5 |
2 files changed, 8 insertions, 3 deletions
diff --git a/src/libnest2d/include/libnest2d/libnest2d.hpp b/src/libnest2d/include/libnest2d/libnest2d.hpp index 11c032fae..d91b3c8f9 100644 --- a/src/libnest2d/include/libnest2d/libnest2d.hpp +++ b/src/libnest2d/include/libnest2d/libnest2d.hpp @@ -68,7 +68,7 @@ class _Item { BBCache(): valid(false) {} } bb_cache_; - int binid_{BIN_ID_UNSET}; + int binid_{BIN_ID_UNSET}, priority_{0}; bool fixed_{false}; public: @@ -130,8 +130,12 @@ public: inline bool isFixed() const noexcept { return fixed_; } inline void markAsFixed(bool fixed = true) { fixed_ = fixed; } + inline void binId(int idx) { binid_ = idx; } inline int binId() const noexcept { return binid_; } + + inline void priority(int p) { priority_ = p; } + inline int priority() const noexcept { return priority_; } /** * @brief Convert the polygon to string representation. The format depends diff --git a/src/libnest2d/include/libnest2d/selections/firstfit.hpp b/src/libnest2d/include/libnest2d/selections/firstfit.hpp index 74207f8cf..5585e565d 100644 --- a/src/libnest2d/include/libnest2d/selections/firstfit.hpp +++ b/src/libnest2d/include/libnest2d/selections/firstfit.hpp @@ -62,9 +62,10 @@ public: placers.back().configure(pconfig); placers.back().preload(ig); } - + auto sortfunc = [](Item& i1, Item& i2) { - return i1.area() > i2.area(); + int p1 = i1.priority(), p2 = i2.priority(); + return p1 == p2 ? i1.area() > i2.area() : p1 > p2; }; std::sort(store_.begin(), store_.end(), sortfunc); |