mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-07 23:17:35 -06:00
NEW: add best_object_pos for auto-arranging
For i3 printers, best object position may not be the bed center, we need to align objects to the specified best_object_pos. Jira: STUDIO-4133 Change-Id: I06e31e597d2dd8288eb24a52d836cc8a134a4111
This commit is contained in:
parent
763cff046c
commit
e789489ed9
14 changed files with 49 additions and 23 deletions
|
@ -153,16 +153,16 @@ Points get_shrink_bedpts(const DynamicPrintConfig* print_cfg, const ArrangeParam
|
|||
// Slic3r.
|
||||
template<class PConf>
|
||||
void fill_config(PConf& pcfg, const ArrangeParams ¶ms) {
|
||||
|
||||
if (params.is_seq_print) {
|
||||
// Start placing the items from the center of the print bed
|
||||
pcfg.starting_point = PConf::Alignment::BOTTOM_LEFT;
|
||||
}
|
||||
else {
|
||||
// Start placing the items from the center of the print bed
|
||||
pcfg.starting_point = PConf::Alignment::TOP_RIGHT;
|
||||
}
|
||||
|
||||
|
||||
if (params.is_seq_print) {
|
||||
// Start placing the items from the center of the print bed
|
||||
pcfg.starting_point = PConf::Alignment::BOTTOM_LEFT;
|
||||
}
|
||||
else {
|
||||
// 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;
|
||||
|
@ -564,6 +564,14 @@ public:
|
|||
m_norm = std::sqrt(m_bin_area);
|
||||
fill_config(m_pconf, params);
|
||||
this->params = params;
|
||||
|
||||
// if best object center is not bed center, specify starting point here
|
||||
if (std::abs(this->params.align_center.x() - 0.5) > 0.001 || std::abs(this->params.align_center.y() - 0.5) > 0.001) {
|
||||
auto binbb = sl::boundingBox(m_bin);
|
||||
m_pconf.best_object_pos = binbb.minCorner() + Point{ binbb.width() * this->params.align_center.x(), binbb.height() * this->params.align_center.y() };
|
||||
m_pconf.alignment = PConfig::Alignment::USER_DEFINED;
|
||||
}
|
||||
|
||||
for (auto& region : m_pconf.m_excluded_regions) {
|
||||
Box bb = region.boundingBox();
|
||||
m_excluded_and_extruCali_regions.emplace_back(bb);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue