From a49d82691e113d2b242a554e1aa01c6688e7690e Mon Sep 17 00:00:00 2001 From: Alessandro Ranellucci Date: Mon, 13 Mar 2017 13:37:25 +0100 Subject: [PATCH] Only use the supplied bounding box (bed shape) as a hint when auto arranging, and revert to unconstrained arrangement on failure (still better than no arranging at all). #2725 --- xs/src/libslic3r/Model.cpp | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/xs/src/libslic3r/Model.cpp b/xs/src/libslic3r/Model.cpp index 3b02c36d5..ca9c0b227 100644 --- a/xs/src/libslic3r/Model.cpp +++ b/xs/src/libslic3r/Model.cpp @@ -255,13 +255,26 @@ bool Model::_arrange(const Pointfs &sizes, coordf_t dist, const BoundingBoxf* bb, Pointfs &out) const { // we supply unscaled data to arrange() - return Slic3r::Geometry::arrange( + bool result = Slic3r::Geometry::arrange( sizes.size(), // number of parts BoundingBoxf(sizes).max, // width and height of a single cell dist, // distance between cells bb, // bounding box of the area to fill out // output positions ); + + if (!result && bb != NULL) { + // Try to arrange again ignoring bb + result = Slic3r::Geometry::arrange( + sizes.size(), // number of parts + BoundingBoxf(sizes).max, // width and height of a single cell + dist, // distance between cells + NULL, // bounding box of the area to fill + out // output positions + ); + } + + return result; } /* arrange objects preserving their instance count