Fix arrangement of objects larger than the print bed. Issue #2897

This commit is contained in:
tamasmeszaros
2019-09-10 13:31:29 +02:00
parent 2fef16c39a
commit 1c20c4c43d
6 changed files with 56 additions and 33 deletions

View File

@@ -546,7 +546,12 @@ public:
inline explicit _NofitPolyPlacer(const BinType& bin):
Base(bin),
norm_(std::sqrt(sl::area(bin))) {}
norm_(std::sqrt(sl::area(bin)))
{
// In order to not have items out of bin, it will be shrinked by an
// very little empiric offset value.
// sl::offset(bin_, 1e-5 * norm_);
}
_NofitPolyPlacer(const _NofitPolyPlacer&) = default;
_NofitPolyPlacer& operator=(const _NofitPolyPlacer&) = default;
@@ -1179,7 +1184,14 @@ private:
}
void setInitialPosition(Item& item) {
Box&& bb = item.boundingBox();
auto sh = item.rawShape();
sl::translate(sh, item.translation());
sl::rotate(sh, item.rotation());
Box bb = sl::boundingBox(sh);
bb.minCorner() += item.translation();
bb.maxCorner() += item.translation();
Vertex ci, cb;
auto bbin = sl::boundingBox(bin_);