Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/prusa3d/PrusaSlicer.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortamasmeszaros <meszaros.q@gmail.com>2019-09-10 14:31:29 +0300
committertamasmeszaros <meszaros.q@gmail.com>2019-09-10 14:31:29 +0300
commit1c20c4c43d4c3c448e599c9d169749f522bb8ea5 (patch)
treedb665e8b93c1859a471d9b006042808bee80bf06 /src/libslic3r/Arrange.cpp
parent2fef16c39aea81831ac376caae472b51082d6582 (diff)
Fix arrangement of objects larger than the print bed. Issue #2897
Diffstat (limited to 'src/libslic3r/Arrange.cpp')
-rw-r--r--src/libslic3r/Arrange.cpp25
1 files changed, 18 insertions, 7 deletions
diff --git a/src/libslic3r/Arrange.cpp b/src/libslic3r/Arrange.cpp
index 34e07302a..52168c929 100644
--- a/src/libslic3r/Arrange.cpp
+++ b/src/libslic3r/Arrange.cpp
@@ -350,6 +350,12 @@ public:
m_pck.configure(m_pconf);
}
+ AutoArranger(const TBin & bin,
+ std::function<void(unsigned)> progressind,
+ std::function<bool(void)> stopcond)
+ : AutoArranger{bin, 0 /* no min distance */, progressind, stopcond}
+ {}
+
template<class It> inline void operator()(It from, It to) {
m_rtree.clear();
m_item_count += size_t(to - from);
@@ -553,13 +559,21 @@ BedShapeHint &BedShapeHint::operator=(const BedShapeHint &cpy)
return *this;
}
+template<class Bin> void remove_large_items(std::vector<Item> &items, Bin &&bin)
+{
+ auto it = items.begin();
+ while (it != items.end())
+ sl::isInside(it->transformedShape(), bin) ?
+ ++it : it = items.erase(it);
+}
+
template<class BinT> // Arrange for arbitrary bin type
void _arrange(
std::vector<Item> & shapes,
std::vector<Item> & excludes,
const BinT & bin,
coord_t minobjd,
- std::function<void(unsigned)> prind,
+ std::function<void(unsigned)> progressfn,
std::function<bool()> stopfn)
{
// Integer ceiling the min distance from the bed perimeters
@@ -569,16 +583,13 @@ void _arrange(
auto corrected_bin = bin;
sl::offset(corrected_bin, md);
- AutoArranger<BinT> arranger{corrected_bin, 0, prind, stopfn};
+ AutoArranger<BinT> arranger{corrected_bin, progressfn, stopfn};
auto infl = coord_t(std::ceil(minobjd / 2.0));
for (Item& itm : shapes) itm.inflate(infl);
for (Item& itm : excludes) itm.inflate(infl);
- auto it = excludes.begin();
- while (it != excludes.end())
- sl::isInside(it->transformedShape(), corrected_bin) ?
- ++it : it = excludes.erase(it);
+ remove_large_items(excludes, corrected_bin);
// If there is something on the plate
if (!excludes.empty()) arranger.preload(excludes);
@@ -674,7 +685,7 @@ void arrange(ArrangePolygons & arrangables,
_arrange(items, fixeditems, Box::infinite(), min_obj_dist, pri, cfn);
break;
}
- };
+ }
for(size_t i = 0; i < items.size(); ++i) {
clppr::IntPoint tr = items[i].translation();