mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-07-21 09:52:11 +00:00
FIX: auto arrange estimates wrong wipe tower
Jira: STUDIO-4678 Change-Id: Iff2273b464db939a2b5e19f8791bd2a4d67ce8c1 (cherry picked from commit fe4b1f79faeade42300622367fb23d7bd1079785)
This commit is contained in:
@@ -57,7 +57,7 @@ public:
|
||||
ret.is_wipe_tower = true;
|
||||
++ret.priority;
|
||||
|
||||
BOOST_LOG_TRIVIAL(debug) << __FUNCTION__ << " arrange: wipe tower info:" << m_bb << ", m_pos: " << m_pos.transpose();
|
||||
BOOST_LOG_TRIVIAL(debug) << " arrange: wipe tower info:" << m_bb << ", m_pos: " << m_pos.transpose();
|
||||
|
||||
return ret;
|
||||
}
|
||||
@@ -240,6 +240,21 @@ void ArrangeJob::prepare_all() {
|
||||
plate_list.preprocess_exclude_areas(m_unselected, MAX_NUM_PLATES);
|
||||
}
|
||||
|
||||
arrangement::ArrangePolygon estimate_wipe_tower_info(int plate_index, std::set<int>& extruder_ids)
|
||||
{
|
||||
PartPlateList& ppl = wxGetApp().plater()->get_partplate_list();
|
||||
const auto& full_config = wxGetApp().preset_bundle->full_config();
|
||||
int plate_count = ppl.get_plate_count();
|
||||
int plate_index_valid = std::min(plate_index, plate_count - 1);
|
||||
|
||||
// we have to estimate the depth using the extruder number of all plates
|
||||
int extruder_size = extruder_ids.size();
|
||||
|
||||
auto arrange_poly = ppl.get_plate(plate_index_valid)->estimate_wipe_tower_polygon(full_config, plate_index, extruder_size);
|
||||
arrange_poly.bed_idx = plate_index;
|
||||
return arrange_poly;
|
||||
}
|
||||
|
||||
// 准备料塔。逻辑如下:
|
||||
// 1. 以下几种情况不需要料塔:
|
||||
// 1)料塔被禁用,
|
||||
@@ -299,6 +314,14 @@ void ArrangeJob::prepare_wipe_tower()
|
||||
wipe_tower_ap.is_virt_object = true;
|
||||
wipe_tower_ap.is_wipe_tower = true;
|
||||
const GLCanvas3D* canvas3D = static_cast<const GLCanvas3D*>(m_plater->canvas3D());
|
||||
|
||||
std::set<int> extruder_ids;
|
||||
PartPlateList& ppl = wxGetApp().plater()->get_partplate_list();
|
||||
int plate_count = ppl.get_plate_count();
|
||||
if (!only_on_partplate) {
|
||||
extruder_ids = ppl.get_extruders(true);
|
||||
}
|
||||
|
||||
for (int bedid = 0; bedid < MAX_NUM_PLATES; bedid++) {
|
||||
if (auto wti = get_wipe_tower(*m_plater, bedid)) {
|
||||
// wipe tower is already there
|
||||
@@ -307,8 +330,14 @@ void ArrangeJob::prepare_wipe_tower()
|
||||
m_unselected.emplace_back(wipe_tower_ap);
|
||||
}
|
||||
else if (need_wipe_tower) {
|
||||
wipe_tower_ap.translation = { 0, 0 };
|
||||
wipe_tower_ap.poly.contour.points = canvas3D->estimate_wipe_tower_points(bedid, !only_on_partplate);
|
||||
if (only_on_partplate) {
|
||||
int plate_index_valid = std::min(bedid, plate_count - 1);
|
||||
PartPlate* pl = ppl.get_plate(plate_index_valid);
|
||||
auto plate_extruders = pl->get_extruders(true);
|
||||
extruder_ids.clear();
|
||||
extruder_ids.insert(plate_extruders.begin(), plate_extruders.end());
|
||||
}
|
||||
wipe_tower_ap = estimate_wipe_tower_info(bedid, extruder_ids);
|
||||
wipe_tower_ap.bed_idx = bedid;
|
||||
m_unselected.emplace_back(wipe_tower_ap);
|
||||
}
|
||||
@@ -365,7 +394,7 @@ void ArrangeJob::prepare_partplate() {
|
||||
//skip this object due to be not in current plate, treated as locked
|
||||
ap.itemid = m_locked.size();
|
||||
m_locked.emplace_back(std::move(ap));
|
||||
BOOST_LOG_TRIVIAL(debug) << __FUNCTION__ << boost::format(": skip locked instance, obj_id %1%, name %2%") % oidx % mo->name;
|
||||
//BOOST_LOG_TRIVIAL(debug) << __FUNCTION__ << boost::format(": skip locked instance, obj_id %1%, name %2%") % oidx % mo->name;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -523,7 +552,8 @@ void ArrangeJob::process()
|
||||
}
|
||||
BOOST_LOG_TRIVIAL(debug) << "items unselected before arrange: ";
|
||||
for (auto item : m_unselected)
|
||||
BOOST_LOG_TRIVIAL(debug) << item.name << ", bed: " << item.bed_idx << ", trans: " << item.translation.transpose();
|
||||
BOOST_LOG_TRIVIAL(debug) << item.name << ", bed: " << item.bed_idx << ", trans: " << item.translation.transpose()
|
||||
<<", bbox:"<<get_extents(item.poly).min.transpose()<<","<<get_extents(item.poly).max.transpose();
|
||||
}
|
||||
|
||||
arrangement::arrange(m_selected, m_unselected, bedpts, params);
|
||||
|
||||
Reference in New Issue
Block a user