FIX: auto-arrange may fail for sequentially printing tall objects

1. fix sequential printing tall objects. Now the print order is not determined by auto-arrange,
so wee need to add a new rule: lower objects should not exceed height_to_rod.
2. sequential printing is better centered.

Change-Id: Ic320722654f0335d2589060fa14c71a5aaa3f571
This commit is contained in:
Arthur 2022-08-15 11:05:59 +08:00 committed by Lane.Wei
parent 62e6287ab5
commit 06f878f13b
1 changed files with 4 additions and 2 deletions

View File

@ -208,7 +208,7 @@ protected:
double dist_corner_x = ibb.minCorner().x() - origin_pack.x();
if (dist_corner_y < 0 || dist_corner_x<0)
return LARGE_COST_TO_REJECT;
double bindist = norm(dist_corner_y + 0.1 * dist_corner_x
double bindist = norm(dist_corner_y + 1 * dist_corner_x
+ 1 * double(ibb.maxCorner().y() - ibb.minCorner().y())); // occupy as few rows as possible
return bindist;
}
@ -393,7 +393,9 @@ protected:
auto py2 = p.boundingBox().maxCorner().y();
auto inter_min = std::max(iy1, py1); // min y of intersection
auto inter_max = std::min(iy2, py2); // max y of intersection. length=max_y-min_y>0 means intersection exists
if (inter_max - inter_min > 0) {
// if this item is lower than existing ones, this item will be printed first, so should not exceed height_to_rod
if (iy2 < py1) { hasRowHeightConflict |= (item.height > clearance_height_to_rod); }
else if (inter_max - inter_min > 0) {
// if they inter, the one on the left will be printed first
double h = ix1 < px1 ? item.height : p.height;
hasRowHeightConflict |= (h > clearance_height_to_rod);