FIX: avoid wipe tower conflict with objects

Use a more accurate way to estimate wipe tower:
1. read wipe configure from front-end (the positions may be different at
different plates).
2. when depth is unavailable, use all materials to estimate depth (the
estimated wipe tower may be larger than the actual generated one).

Change-Id: I42ffd03d9817b57f5023a6820cda0032509c6fe5
(cherry picked from commit 77ba9757023afb9160c996eeea6ead8a27b50ce4)
This commit is contained in:
manch1n 2023-04-07 21:52:59 +08:00 committed by Lane.Wei
parent 67d95d3fc8
commit dd473bdc3f
6 changed files with 71 additions and 35 deletions

View file

@ -241,9 +241,15 @@ void ArrangeJob::prepare_all() {
}
// 准备料塔。逻辑如下:
// 1. 如果料塔被禁用,或是逐件打印,则不需要料塔
// 2. 以下两种情况需要料塔1某对象是多色对象2打开了支撑且支撑体与接触面使用的是不同材料
// 3. 如果允许不同材料落在相同盘则以下情况也需要料塔1所有选定对象中使用了多种热床温度相同的材料比如颜色不同的PLA
// 1. 以下几种情况不需要料塔:
// 1料塔被禁用
// 2逐件打印
// 3不允许不同材料落在相同盘且没有多色对象
// 2. 以下情况需要料塔:
// 1某对象是多色对象
// 2打开了支撑且支撑体与接触面使用的是不同材料
// 3允许不同材料落在相同盘且所有选定对象中使用了多种热床温度相同的材料
// 所有对象都是单色的但不同对象的材料不同例如对象A使用红色PLA对象B使用白色PLA
void ArrangeJob::prepare_wipe_tower()
{
bool need_wipe_tower = false;
@ -257,7 +263,7 @@ void ArrangeJob::prepare_wipe_tower()
// need wipe tower if some object has multiple extruders (has paint-on colors or support material)
for (const auto &item : m_selected) {
std::set<int> obj_extruders;
for (int id : item.extrude_ids) obj_extruders.insert(id);
obj_extruders.insert(item.extrude_ids.begin(), item.extrude_ids.end());
if (obj_extruders.size() > 1) {
need_wipe_tower = true;
BOOST_LOG_TRIVIAL(info) << "arrange: need wipe tower because object " << item.name << " has multiple extruders (has paint-on colors)";
@ -266,6 +272,7 @@ void ArrangeJob::prepare_wipe_tower()
}
// if multile extruders have same bed temp, we need wipe tower
// 允许不同材料落在相同盘,且所有选定对象中使用了多种热床温度相同的材料
if (params.allow_multi_materials_on_same_plate) {
std::map<int, std::set<int>> bedTemp2extruderIds;
for (const auto &item : m_selected)
@ -301,9 +308,11 @@ 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());
for (int bedid = 0; bedid < MAX_NUM_PLATES; bedid++) {
if (!plates_have_wipe_tower[bedid]) {
wipe_tower_ap.translation = {0, 0};
wipe_tower_ap.poly.contour.points = canvas3D->estimate_wipe_tower_points(bedid);
wipe_tower_ap.bed_idx = bedid;
m_unselected.emplace_back(wipe_tower_ap);
}