diff --git a/src/libslic3r/Arrange.cpp b/src/libslic3r/Arrange.cpp index cf27977d5..9b4f493ef 100644 --- a/src/libslic3r/Arrange.cpp +++ b/src/libslic3r/Arrange.cpp @@ -86,18 +86,21 @@ template void fill_config(PConf& pcfg, const ArrangeParams ¶ms) { if (params.is_seq_print) { - // Align the arranged pile into the center of the bin - pcfg.alignment = PConf::Alignment::CENTER; // Start placing the items from the center of the print bed pcfg.starting_point = PConf::Alignment::BOTTOM_LEFT; } else { - // Align the arranged pile into the center of the bin - pcfg.alignment = PConf::Alignment::CENTER; // Start placing the items from the center of the print bed pcfg.starting_point = PConf::Alignment::TOP_RIGHT; } + if (params.do_final_align) { + // Align the arranged pile into the center of the bin + pcfg.alignment = PConf::Alignment::CENTER; + }else + pcfg.alignment = PConf::Alignment::DONT_ALIGN; + + // Try 4 angles (45 degree step) and find the one with min cost if (params.allow_rotations) pcfg.rotations = {0., PI / 4., PI/2, 3. * PI / 4. }; @@ -542,12 +545,6 @@ public: if (items.empty()) return; auto binbb = sl::boundingBox(m_bin); - // BBS: excluded region (virtual object but not wipe tower) should not affect final alignment - //bool all_is_excluded_region = std::all_of(items.begin(), items.end(), [](Item &itm) { return itm.is_virt_object && !itm.is_wipe_tower; }); - //if (!all_is_excluded_region) - // cfg.alignment = PConfig::Alignment::DONT_ALIGN; - //else - // cfg.alignment = PConfig::Alignment::CENTER; auto starting_point = cfg.starting_point == PConfig::Alignment::BOTTOM_LEFT ? binbb.minCorner() : binbb.center(); // if we have wipe tower, items should be arranged around wipe tower @@ -559,15 +556,7 @@ public: } cfg.object_function = [this, binbb, starting_point](const Item &item, const ItemGroup &packed_items) { - // 在我们的摆盘中,没有天然的固定对象。固定对象只有:屏蔽区域、挤出补偿区域、料塔。 - // 对于屏蔽区域,摆入的对象仍然是可以向右上滑动的; - // 对挤出料塔,摆入的对象不能滑动(必须围绕料塔) - bool pack_around_wipe_tower = std::any_of(packed_items.begin(), packed_items.end(), [](Item& itm) { return itm.is_wipe_tower; }); - //if(pack_around_wipe_tower) - return fixed_overfit(objfunc(item, starting_point), binbb); - //else { - // return fixed_overfit_topright_sliding(objfunc(item, starting_point), binbb, m_excluded_and_extruCali_regions); - //} + return fixed_overfit(objfunc(item, starting_point), binbb); }; }; diff --git a/src/libslic3r/Arrange.hpp b/src/libslic3r/Arrange.hpp index 4fd62ad22..a9b7cc484 100644 --- a/src/libslic3r/Arrange.hpp +++ b/src/libslic3r/Arrange.hpp @@ -114,6 +114,8 @@ struct ArrangeParams { bool allow_rotations = false; + bool do_final_align = true; + //BBS: add specific arrange params bool allow_multi_materials_on_same_plate = true; bool avoid_extrusion_cali_region = true; diff --git a/src/slic3r/GUI/Jobs/FillBedJob.cpp b/src/slic3r/GUI/Jobs/FillBedJob.cpp index 866ecaea3..b6ecbaae9 100644 --- a/src/slic3r/GUI/Jobs/FillBedJob.cpp +++ b/src/slic3r/GUI/Jobs/FillBedJob.cpp @@ -228,6 +228,8 @@ void FillBedJob::process() params.on_packed = [&do_stop] (const ArrangePolygon &ap) { do_stop = ap.bed_idx > 0 && ap.priority == 0; }; + // final align用的是凸包,在有fixed item的情况下可能找到的参考点位置是错的,这里就不做了。见STUDIO-3265 + params.do_final_align = false; arrangement::arrange(m_selected, m_unselected, m_bedpts, params);