ENH: improve auto arranging's wipe tower logic

1. If there is already a wipe tower on current plate, leave it there regardless need_wipe_tower flag.
This is useful when we have toolchange custom gcodes.
2. Correct wipe tower pos to prevent it outside bed.

Jira: STUDIO-4426
Change-Id: Iedecc7c5fe7ced01533d0a302253841046a7fb42
(cherry picked from commit e8d728e46b12baaf9fb0e87e3d14197ae3616826)
This commit is contained in:
Arthur
2023-09-13 12:17:23 +08:00
committed by Lane.Wei
parent 845a397e37
commit 76d073a9ea
3 changed files with 40 additions and 49 deletions

View File

@@ -4910,6 +4910,12 @@ GLCanvas3D::WipeTowerInfo GLCanvas3D::get_wipe_tower_info(int plate_idx) const
float brim_width = wxGetApp().preset_bundle->prints.get_edited_preset().config.opt_float("prime_tower_brim_width");
wti.m_bb.offset((brim_width));
// BBS: the wipe tower pos might be outside bed
PartPlate* plate = wxGetApp().plater()->get_partplate_list().get_curr_plate();
BoundingBoxf3 build_volume = plate->get_build_volume();
wti.m_pos.x() = std::clamp(wti.m_pos.x(), 0.0, build_volume.max.x() - wti.m_bb.size().x());
wti.m_pos.y() = std::clamp(wti.m_pos.y(), 0.0, build_volume.max.y() - wti.m_bb.size().y());
// BBS: add partplate logic
wti.m_plate_idx = plate_idx;
break;