Arrange: Fix fill bed with instances

This commit is contained in:
Martin Šach 2024-11-18 14:49:24 +01:00 committed by Lukas Matena
parent 0aaca75688
commit e588d80e23
2 changed files with 9 additions and 3 deletions

View File

@ -82,8 +82,11 @@ void extract(FillBedTask<ArrItem> &task,
prototype_item_shrinked = itm_conv.convert(arrbl, -SCALED_EPSILON);
});
const int bed_constraint{get_bed_index(*task.prototype_item)};
set_bed_constraint(*task.prototype_item, bed_constraint);
const int bed_constraint{*get_bed_constraint(*task.prototype_item)};
if (bed_constraint != get_bed_index(*task.prototype_item)) {
return;
}
set_bed_index(*task.prototype_item, Unarranged);
auto collect_task_items = [&prototype_geometry_id, &task,
@ -174,7 +177,7 @@ std::unique_ptr<FillBedTaskResult> FillBedTask<ArrItem>::process_native(
void on_packed(ArrItem &itm) override
{
// Stop at the first filler that is not on the physical bed
do_stop = get_bed_index(itm) > get_bed_constraint(itm) && get_priority(itm) == 0;
do_stop = get_bed_index(itm) == -1 && get_priority(itm) == 0;
}
} subctl(ctl, *this);

View File

@ -163,7 +163,10 @@ void arrange(
set_bed_index(*it, Unarranged);
if (bed_constraint && bedidx == *bed_constraint) {
// Leave the item as is as it does not fit on the enforced bed.
auto packed_range = Range{sorted_items.cbegin(),
static_cast<SConstIt>(it)};
was_packed = true;
sel.on_arranged_fn(*it, bed, packed_range, remaining);
}
}
}