mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-08 07:27:41 -06:00
ENH: sync master with auto-arranging and brim
auto-arranging considers wipe tower from smooth timelapse Change-Id: I5dd72260c777abfd2894776b2588bb3ff4224416
This commit is contained in:
parent
52a52ffc08
commit
0b4b6cde4f
3 changed files with 31 additions and 44 deletions
|
@ -1130,10 +1130,8 @@ private:
|
||||||
return;
|
return;
|
||||||
{ // find a best position inside NFP of fixed items (excluded regions), so the center of pile is cloest to bed center
|
{ // find a best position inside NFP of fixed items (excluded regions), so the center of pile is cloest to bed center
|
||||||
RawShape objs_convex_hull = sl::convexHull(objs);
|
RawShape objs_convex_hull = sl::convexHull(objs);
|
||||||
for (const Item &item : config_.m_excluded_regions) { excludes.push_back(item.transformedShape()); }
|
|
||||||
for (const Item &item : items_) {
|
for (const Item &item : items_) {
|
||||||
if (item.isFixed()) {
|
if (item.isFixed()) {
|
||||||
if (!(item.is_wipe_tower && !need_wipe_tower))
|
|
||||||
excludes.push_back(item.transformedShape());
|
excludes.push_back(item.transformedShape());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -737,6 +737,7 @@ public:
|
||||||
for (Item itm : items) {
|
for (Item itm : items) {
|
||||||
if (itm.is_wipe_tower) {
|
if (itm.is_wipe_tower) {
|
||||||
starting_point = itm.boundingBox().center();
|
starting_point = itm.boundingBox().center();
|
||||||
|
BOOST_LOG_TRIVIAL(debug) << "arrange we have wipe tower, change starting point to: " << starting_point;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -761,15 +762,13 @@ public:
|
||||||
if (on_packed)
|
if (on_packed)
|
||||||
on_packed(ap);
|
on_packed(ap);
|
||||||
BOOST_LOG_TRIVIAL(debug) << "arrange " + last_packed.name + " succeed!"
|
BOOST_LOG_TRIVIAL(debug) << "arrange " + last_packed.name + " succeed!"
|
||||||
<< ", plate id=" << ap.bed_idx;
|
<< ", plate id=" << ap.bed_idx << ", pos=" << last_packed.translation();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
if (progressind) {
|
m_pck.unfitIndicator([this](std::string name) {
|
||||||
m_pck.unfitIndicator([this, progressind](std::string name) {
|
BOOST_LOG_TRIVIAL(debug) << "arrange progress: " + name;
|
||||||
BOOST_LOG_TRIVIAL(debug) << "arrange not fit: " + name;
|
|
||||||
});
|
});
|
||||||
}
|
|
||||||
|
|
||||||
if (stopcond) m_pck.stopCondition(stopcond);
|
if (stopcond) m_pck.stopCondition(stopcond);
|
||||||
|
|
||||||
|
|
|
@ -257,7 +257,12 @@ void ArrangeJob::prepare_wipe_tower()
|
||||||
// if wipe tower is explicitly disabled, no need to estimate
|
// if wipe tower is explicitly disabled, no need to estimate
|
||||||
DynamicPrintConfig ¤t_config = wxGetApp().preset_bundle->prints.get_edited_preset().config;
|
DynamicPrintConfig ¤t_config = wxGetApp().preset_bundle->prints.get_edited_preset().config;
|
||||||
auto op = current_config.option("enable_prime_tower");
|
auto op = current_config.option("enable_prime_tower");
|
||||||
if (op && op->getBool() == false || params.is_seq_print) return;
|
bool enable_prime_tower = op && op->getBool();
|
||||||
|
if (!enable_prime_tower || params.is_seq_print) return;
|
||||||
|
bool smooth_timelapse = false;
|
||||||
|
auto sop = current_config.option("timelapse_type");
|
||||||
|
if (sop) { smooth_timelapse = sop->getInt() == TimelapseType::tlSmooth; }
|
||||||
|
if (smooth_timelapse) { need_wipe_tower = true; }
|
||||||
|
|
||||||
// estimate if we need wipe tower for all plates:
|
// estimate if we need wipe tower for all plates:
|
||||||
// need wipe tower if some object has multiple extruders (has paint-on colors or support material)
|
// need wipe tower if some object has multiple extruders (has paint-on colors or support material)
|
||||||
|
@ -287,30 +292,20 @@ void ArrangeJob::prepare_wipe_tower()
|
||||||
}
|
}
|
||||||
BOOST_LOG_TRIVIAL(info) << "arrange: need_wipe_tower=" << need_wipe_tower;
|
BOOST_LOG_TRIVIAL(info) << "arrange: need_wipe_tower=" << need_wipe_tower;
|
||||||
|
|
||||||
if (need_wipe_tower) {
|
|
||||||
// check all plates to see if wipe tower is already there
|
// check all plates to see if wipe tower is already there
|
||||||
ArrangePolygon wipe_tower_ap;
|
ArrangePolygon wipe_tower_ap;
|
||||||
std::vector<bool> plates_have_wipe_tower(MAX_NUM_PLATES, false);
|
|
||||||
for (int bedid = 0; bedid < MAX_NUM_PLATES; bedid++)
|
|
||||||
if (auto wti = get_wipe_tower(*m_plater, bedid)) {
|
|
||||||
ArrangePolygon &&ap = get_wipetower_arrange_poly(&wti);
|
|
||||||
wipe_tower_ap = ap;
|
|
||||||
ap.bed_idx = bedid;
|
|
||||||
m_unselected.emplace_back(std::move(ap));
|
|
||||||
plates_have_wipe_tower[bedid] = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// if wipe tower is not init yet (no wipe tower in any plate before arrangement)
|
|
||||||
//if (wipe_tower_ap.poly.empty()) {
|
|
||||||
// auto &print = wxGetApp().plater()->get_partplate_list().get_current_fff_print();
|
|
||||||
// wipe_tower_ap.poly.contour.points = print.first_layer_wipe_tower_corners(false);
|
|
||||||
wipe_tower_ap.name = "WipeTower";
|
wipe_tower_ap.name = "WipeTower";
|
||||||
wipe_tower_ap.is_virt_object = true;
|
wipe_tower_ap.is_virt_object = true;
|
||||||
wipe_tower_ap.is_wipe_tower = true;
|
wipe_tower_ap.is_wipe_tower = true;
|
||||||
//}
|
|
||||||
const GLCanvas3D *canvas3D = static_cast<const GLCanvas3D *>(m_plater->canvas3D());
|
const GLCanvas3D *canvas3D = static_cast<const GLCanvas3D *>(m_plater->canvas3D());
|
||||||
for (int bedid = 0; bedid < MAX_NUM_PLATES; bedid++) {
|
for (int bedid = 0; bedid < MAX_NUM_PLATES; bedid++) {
|
||||||
if (!plates_have_wipe_tower[bedid]) {
|
if (auto wti = get_wipe_tower(*m_plater, bedid)) {
|
||||||
|
// wipe tower is already there
|
||||||
|
wipe_tower_ap = get_wipetower_arrange_poly(&wti);
|
||||||
|
wipe_tower_ap.bed_idx = bedid;
|
||||||
|
m_unselected.emplace_back(wipe_tower_ap);
|
||||||
|
} else if (need_wipe_tower) {
|
||||||
wipe_tower_ap.translation = {0, 0};
|
wipe_tower_ap.translation = {0, 0};
|
||||||
wipe_tower_ap.poly.contour.points = canvas3D->estimate_wipe_tower_points(bedid, !only_on_partplate);
|
wipe_tower_ap.poly.contour.points = canvas3D->estimate_wipe_tower_points(bedid, !only_on_partplate);
|
||||||
wipe_tower_ap.bed_idx = bedid;
|
wipe_tower_ap.bed_idx = bedid;
|
||||||
|
@ -318,7 +313,6 @@ void ArrangeJob::prepare_wipe_tower()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//BBS: prepare current part plate for arranging
|
//BBS: prepare current part plate for arranging
|
||||||
|
@ -515,8 +509,7 @@ void ArrangeJob::process()
|
||||||
double scaled_exclusion_gap = scale_(1);
|
double scaled_exclusion_gap = scale_(1);
|
||||||
partplate_list.preprocess_exclude_areas(params.excluded_regions, 1, scaled_exclusion_gap);
|
partplate_list.preprocess_exclude_areas(params.excluded_regions, 1, scaled_exclusion_gap);
|
||||||
|
|
||||||
BOOST_LOG_TRIVIAL(debug) << "arrange bed_shrink_x=" << params.bed_shrink_x
|
BOOST_LOG_TRIVIAL(debug) << "arrange bedpts:" << bedpts[0].transpose() << ", " << bedpts[1].transpose() << ", " << bedpts[2].transpose() << ", " << bedpts[3].transpose();
|
||||||
<< "; bedpts:" << bedpts[0].transpose() << ", " << bedpts[1].transpose() << ", " << bedpts[2].transpose() << ", " << bedpts[3].transpose();
|
|
||||||
|
|
||||||
params.stopcondition = [this]() { return was_canceled(); };
|
params.stopcondition = [this]() { return was_canceled(); };
|
||||||
|
|
||||||
|
@ -532,8 +525,7 @@ void ArrangeJob::process()
|
||||||
<< ", bed_temp: " << selected.first_bed_temp << ", print_temp: " << selected.print_temp;
|
<< ", bed_temp: " << selected.first_bed_temp << ", print_temp: " << selected.print_temp;
|
||||||
BOOST_LOG_TRIVIAL(debug) << "items unselected before arrange: ";
|
BOOST_LOG_TRIVIAL(debug) << "items unselected before arrange: ";
|
||||||
for (auto item : m_unselected)
|
for (auto item : m_unselected)
|
||||||
if (!item.is_virt_object)
|
BOOST_LOG_TRIVIAL(debug) << item.name << ", bed: " << item.bed_idx << ", trans: " << item.translation.transpose();
|
||||||
BOOST_LOG_TRIVIAL(debug) << item.name << ", extruder: " << item.extrude_ids.back() << ", bed: " << item.bed_idx << ", trans: " << item.translation.transpose();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
arrangement::arrange(m_selected, m_unselected, bedpts, params);
|
arrangement::arrange(m_selected, m_unselected, bedpts, params);
|
||||||
|
@ -548,9 +540,7 @@ void ArrangeJob::process()
|
||||||
<< ", trans: " << unscale<double>(selected.translation(X)) << ","<< unscale<double>(selected.translation(Y));
|
<< ", trans: " << unscale<double>(selected.translation(X)) << ","<< unscale<double>(selected.translation(Y));
|
||||||
BOOST_LOG_TRIVIAL(debug) << "items unselected after arrange: ";
|
BOOST_LOG_TRIVIAL(debug) << "items unselected after arrange: ";
|
||||||
for (auto item : m_unselected)
|
for (auto item : m_unselected)
|
||||||
if (!item.is_virt_object)
|
BOOST_LOG_TRIVIAL(debug) << item.name << ", bed: " << item.bed_idx << ", trans: " << item.translation.transpose();
|
||||||
BOOST_LOG_TRIVIAL(debug) << item.name << ", extruder: " << item.extrude_ids.back() << ", bed: " << item.bed_idx
|
|
||||||
<< ", trans: " << item.translation.transpose();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
arrangement::arrange(m_unprintable, {}, bedpts, params);
|
arrangement::arrange(m_unprintable, {}, bedpts, params);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue