From a62940191622d6bffe588437fbeccb9b6a92f65c Mon Sep 17 00:00:00 2001 From: tamasmeszaros <meszaros.q@gmail.com> Date: Mon, 4 Jan 2021 20:33:17 +0100 Subject: [PATCH] Fix for "bed fill" discarding selected instance transformation. fixes #5621 --- src/slic3r/GUI/Jobs/FillBedJob.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/slic3r/GUI/Jobs/FillBedJob.cpp b/src/slic3r/GUI/Jobs/FillBedJob.cpp index 9286e4735..1948c8fbb 100644 --- a/src/slic3r/GUI/Jobs/FillBedJob.cpp +++ b/src/slic3r/GUI/Jobs/FillBedJob.cpp @@ -73,9 +73,14 @@ void FillBedJob::prepare() // This is the maximum number of items, the real number will always be close but less. int needed_items = (bed_area - fixed_area) / poly_area; - ModelInstance *mi = model_object->instances[0]; + int sel_id = m_plater->get_selection().get_instance_idx(); + // if the selection is not a single instance, choose the first as template + sel_id = std::max(sel_id, 0); + ModelInstance *mi = model_object->instances[sel_id]; + ArrangePolygon template_ap = get_arrange_poly(PtrWrapper{mi}, m_plater); + for (int i = 0; i < needed_items; ++i) { - ArrangePolygon ap; + ArrangePolygon ap = template_ap; ap.poly = m_selected.front().poly; ap.bed_idx = arrangement::UNARRANGED; ap.setter = [this, mi](const ArrangePolygon &p) {