ENH: optimize the efficiency of auto lift

Signed-off-by: qing.zhang <qing.zhang@bambulab.com>
Change-Id: I9c1679cc80ae23ff066df6e2fe98b5530a9d2288
This commit is contained in:
qing.zhang 2023-05-12 17:23:27 +08:00 committed by Lane.Wei
parent 1b0b14c0f2
commit 1d0476fa44
7 changed files with 70 additions and 28 deletions

View file

@ -399,6 +399,20 @@ bool Print::has_brim() const
}
//BBS
std::vector<size_t> Print::layers_sorted_for_object(float start, float end, std::vector<LayerPtrs> &layers_of_objects, std::vector<BoundingBox> &boundingBox_for_objects)
{
std::vector<size_t> idx_of_object_sorted;
size_t idx = 0;
for (const auto &object : m_objects) {
idx_of_object_sorted.push_back(idx++);
object->get_certain_layers(start, end, layers_of_objects, boundingBox_for_objects);
}
std::sort(idx_of_object_sorted.begin(), idx_of_object_sorted.end(),
[boundingBox_for_objects](auto left, auto right) { return boundingBox_for_objects[left].area() > boundingBox_for_objects[right].area(); });
return idx_of_object_sorted;
};
StringObjectException Print::sequential_print_clearance_valid(const Print &print, Polygons *polygons, std::vector<std::pair<Polygon, float>>* height_polygons)
{
StringObjectException single_object_exception;