mirror of
https://git.mirrors.martin98.com/https://github.com/bambulab/BambuStudio.git
synced 2025-09-28 23:03:13 +08:00
FIX: when filling bed, some objects would be placed out of bed bound
Jira: STUDIO-11996 Change-Id: I149be826821c6ae9a1b33304086337fb7775dc68
This commit is contained in:
parent
ac805e7d91
commit
58387fd0d5
@ -230,11 +230,16 @@ void FillBedJob::process()
|
|||||||
|
|
||||||
if (m_selected.size() > 100){
|
if (m_selected.size() > 100){
|
||||||
// too many items, just find grid empty cells to put them
|
// too many items, just find grid empty cells to put them
|
||||||
Vec2f step = unscaled<float>(get_extents(m_selected.front().poly).size()) + Vec2f(m_selected.front().brim_width, m_selected.front().brim_width);
|
Vec2f step = unscaled<float>(get_extents(m_selected.front().poly).size()) + 2 * Vec2f(m_selected.front().brim_width, m_selected.front().brim_width);
|
||||||
|
|
||||||
|
// calc the polygon position offset based on origin, in order to normalize the initial position of the arrange polygon
|
||||||
|
auto offset_on_origin = m_selected.front().poly.contour.bounding_box().center();
|
||||||
|
|
||||||
std::vector<Vec2f> empty_cells = Plater::get_empty_cells(step);
|
std::vector<Vec2f> empty_cells = Plater::get_empty_cells(step);
|
||||||
size_t n=std::min(m_selected.size(), empty_cells.size());
|
size_t n=std::min(m_selected.size(), empty_cells.size());
|
||||||
for (size_t i = 0; i < n; i++) {
|
for (size_t i = 0; i < n; i++) {
|
||||||
m_selected[i].translation = scaled<coord_t>(empty_cells[i]);
|
m_selected[i].translation = scaled<coord_t>(empty_cells[i]);
|
||||||
|
m_selected[i].translation -= offset_on_origin;
|
||||||
m_selected[i].bed_idx= 0;
|
m_selected[i].bed_idx= 0;
|
||||||
}
|
}
|
||||||
for (size_t i = n; i < m_selected.size(); i++) {
|
for (size_t i = n; i < m_selected.size(); i++) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user