Print bed not considered as object in arrange anymore.
This commit is contained in:
parent
fab3634931
commit
121b6c078b
@ -191,6 +191,15 @@ template<class C> bool all_of(const C &container) {
|
||||
});
|
||||
}
|
||||
|
||||
template<class X, class Y> inline X ceil_i(X x, Y y)
|
||||
{
|
||||
static_assert(std::is_integral<X>::value &&
|
||||
std::is_integral<Y>::value && sizeof(X) >= sizeof(Y),
|
||||
"");
|
||||
|
||||
return (x % y) ? x / y + 1 : x / y;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endif // MTUTILS_HPP
|
||||
|
@ -2,6 +2,7 @@
|
||||
#include "Model.hpp"
|
||||
#include "Geometry.hpp"
|
||||
#include "SVG.hpp"
|
||||
#include "MTUtils.hpp"
|
||||
|
||||
#include <libnest2d.h>
|
||||
|
||||
@ -820,15 +821,13 @@ bool arrange(Model &model, // The model with the geometries
|
||||
BoundingBox bbb(bed);
|
||||
|
||||
auto& cfn = stopcondition;
|
||||
|
||||
coord_t md = ceil_i(min_obj_distance, 2) - SCALED_EPSILON;
|
||||
|
||||
auto binbb = Box({
|
||||
static_cast<libnest2d::Coord>(bbb.min(0)),
|
||||
static_cast<libnest2d::Coord>(bbb.min(1))
|
||||
},
|
||||
{
|
||||
static_cast<libnest2d::Coord>(bbb.max(0)),
|
||||
static_cast<libnest2d::Coord>(bbb.max(1))
|
||||
});
|
||||
auto binbb = Box({libnest2d::Coord{bbb.min(0)} - md,
|
||||
libnest2d::Coord{bbb.min(1)} - md},
|
||||
{libnest2d::Coord{bbb.max(0)} + md,
|
||||
libnest2d::Coord{bbb.max(1)} + md});
|
||||
|
||||
switch(bedhint.type) {
|
||||
case BedShapeType::BOX: {
|
||||
@ -916,15 +915,13 @@ void find_new_position(const Model &model,
|
||||
BedShapeHint bedhint = bedShape(bed);
|
||||
|
||||
BoundingBox bbb(bed);
|
||||
|
||||
auto binbb = Box({
|
||||
static_cast<libnest2d::Coord>(bbb.min(0)),
|
||||
static_cast<libnest2d::Coord>(bbb.min(1))
|
||||
},
|
||||
{
|
||||
static_cast<libnest2d::Coord>(bbb.max(0)),
|
||||
static_cast<libnest2d::Coord>(bbb.max(1))
|
||||
});
|
||||
|
||||
coord_t md = ceil_i(min_obj_distance, 2) - SCALED_EPSILON;
|
||||
|
||||
auto binbb = Box({libnest2d::Coord{bbb.min(0)} - md,
|
||||
libnest2d::Coord{bbb.min(1)} - md},
|
||||
{libnest2d::Coord{bbb.max(0)} + md,
|
||||
libnest2d::Coord{bbb.max(1)} + md});
|
||||
|
||||
for(auto it = shapemap.begin(); it != shapemap.end(); ++it) {
|
||||
if(std::find(toadd.begin(), toadd.end(), it->first) == toadd.end()) {
|
||||
|
Loading…
Reference in New Issue
Block a user