Print bed not considered as object in arrange anymore.
This commit is contained in:
parent
fab3634931
commit
121b6c078b
2 changed files with 23 additions and 17 deletions
|
@ -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
|
#endif // MTUTILS_HPP
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
#include "Model.hpp"
|
#include "Model.hpp"
|
||||||
#include "Geometry.hpp"
|
#include "Geometry.hpp"
|
||||||
#include "SVG.hpp"
|
#include "SVG.hpp"
|
||||||
|
#include "MTUtils.hpp"
|
||||||
|
|
||||||
#include <libnest2d.h>
|
#include <libnest2d.h>
|
||||||
|
|
||||||
|
@ -820,15 +821,13 @@ bool arrange(Model &model, // The model with the geometries
|
||||||
BoundingBox bbb(bed);
|
BoundingBox bbb(bed);
|
||||||
|
|
||||||
auto& cfn = stopcondition;
|
auto& cfn = stopcondition;
|
||||||
|
|
||||||
|
coord_t md = ceil_i(min_obj_distance, 2) - SCALED_EPSILON;
|
||||||
|
|
||||||
auto binbb = Box({
|
auto binbb = Box({libnest2d::Coord{bbb.min(0)} - md,
|
||||||
static_cast<libnest2d::Coord>(bbb.min(0)),
|
libnest2d::Coord{bbb.min(1)} - md},
|
||||||
static_cast<libnest2d::Coord>(bbb.min(1))
|
{libnest2d::Coord{bbb.max(0)} + md,
|
||||||
},
|
libnest2d::Coord{bbb.max(1)} + md});
|
||||||
{
|
|
||||||
static_cast<libnest2d::Coord>(bbb.max(0)),
|
|
||||||
static_cast<libnest2d::Coord>(bbb.max(1))
|
|
||||||
});
|
|
||||||
|
|
||||||
switch(bedhint.type) {
|
switch(bedhint.type) {
|
||||||
case BedShapeType::BOX: {
|
case BedShapeType::BOX: {
|
||||||
|
@ -916,15 +915,13 @@ void find_new_position(const Model &model,
|
||||||
BedShapeHint bedhint = bedShape(bed);
|
BedShapeHint bedhint = bedShape(bed);
|
||||||
|
|
||||||
BoundingBox bbb(bed);
|
BoundingBox bbb(bed);
|
||||||
|
|
||||||
auto binbb = Box({
|
coord_t md = ceil_i(min_obj_distance, 2) - SCALED_EPSILON;
|
||||||
static_cast<libnest2d::Coord>(bbb.min(0)),
|
|
||||||
static_cast<libnest2d::Coord>(bbb.min(1))
|
auto binbb = Box({libnest2d::Coord{bbb.min(0)} - md,
|
||||||
},
|
libnest2d::Coord{bbb.min(1)} - md},
|
||||||
{
|
{libnest2d::Coord{bbb.max(0)} + md,
|
||||||
static_cast<libnest2d::Coord>(bbb.max(0)),
|
libnest2d::Coord{bbb.max(1)} + md});
|
||||||
static_cast<libnest2d::Coord>(bbb.max(1))
|
|
||||||
});
|
|
||||||
|
|
||||||
for(auto it = shapemap.begin(); it != shapemap.end(); ++it) {
|
for(auto it = shapemap.begin(); it != shapemap.end(); ++it) {
|
||||||
if(std::find(toadd.begin(), toadd.end(), it->first) == toadd.end()) {
|
if(std::find(toadd.begin(), toadd.end(), it->first) == toadd.end()) {
|
||||||
|
|
Loading…
Reference in a new issue