FIX: filling bed fails if the bed is already full

JIRA: STUDIO-6490

Signed-off-by: Kunlong Ma <kunlong.ma@bambulab.com>
Change-Id: I71b5a01a95cdffef7c0750e6347fa8911dcd781d
This commit is contained in:
Kunlong Ma 2024-03-22 20:20:40 +08:00 committed by Lane.Wei
parent 262eea6b35
commit 8c4773d7fc
2 changed files with 8 additions and 6 deletions

View File

@ -286,10 +286,12 @@ void FillBedJob::finalize()
else
ap.bed_idx = cur_plate;
ap.row = ap.bed_idx / plate_cols;
ap.col = ap.bed_idx % plate_cols;
ap.translation(X) += bed_stride_x(m_plater) * ap.col;
ap.translation(Y) -= bed_stride_y(m_plater) * ap.row;
if (m_selected.size() <= 100) {
ap.row = ap.bed_idx / plate_cols;
ap.col = ap.bed_idx % plate_cols;
ap.translation(X) += bed_stride_x(m_plater) * ap.col;
ap.translation(Y) -= bed_stride_y(m_plater) * ap.row;
}
ap.apply();

View File

@ -12738,8 +12738,8 @@ std::vector<Vec2f> Plater::get_empty_cells(const Vec2f step)
Vec2d vmin(box.min.x(), box.min.y()), vmax(box.max.x(), box.max.y());
exclude_boxs.emplace_back(vmin, vmax);
}
for (float x = min_x; x < bbox.max.x() - step(0) / 2; x += step(0))
for (float y = min_y; y < bbox.max.y() - step(1) / 2; y += step(1)) {
for (float x = min_x + bbox.min.x(); x < bbox.max.x() - step(0) / 2; x += step(0))
for (float y = min_y + bbox.min.y(); y < bbox.max.y() - step(1) / 2; y += step(1)) {
bool in_exclude = false;
BoundingBoxf cell(Vec2d(x - step(0) / 2, y - step(1) / 2), Vec2d(x + step(0) / 2, y + step(1) / 2));
for (auto& box : exclude_boxs) {