mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-08 23:46:24 -06:00
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:
parent
67d95d3fc8
commit
dd473bdc3f
6 changed files with 71 additions and 35 deletions
|
@ -1718,6 +1718,36 @@ bool GLCanvas3D::make_current_for_postinit() {
|
|||
return _set_current();
|
||||
}
|
||||
|
||||
Points GLCanvas3D::estimate_wipe_tower_points(int plate_index) const
|
||||
{
|
||||
PartPlateList & ppl = wxGetApp().plater()->get_partplate_list();
|
||||
DynamicPrintConfig &proj_cfg = wxGetApp().preset_bundle->project_config;
|
||||
auto & print = wxGetApp().plater()->get_partplate_list().get_current_fff_print();
|
||||
int plate_count = ppl.get_plate_count();
|
||||
float x = dynamic_cast<const ConfigOptionFloats *>(proj_cfg.option("wipe_tower_x"))->get_at(plate_index);
|
||||
float y = dynamic_cast<const ConfigOptionFloats *>(proj_cfg.option("wipe_tower_y"))->get_at(plate_index);
|
||||
if (plate_index >= plate_count) { plate_index = 0; }
|
||||
float w = dynamic_cast<const ConfigOptionFloat *>(m_config->option("prime_tower_width"))->value;
|
||||
float v = dynamic_cast<const ConfigOptionFloat *>(m_config->option("prime_volume"))->value;
|
||||
Vec3d wipe_tower_size = ppl.get_plate(plate_index)->estimate_wipe_tower_size(w, v);
|
||||
|
||||
if (wipe_tower_size(1) == 0) {
|
||||
// when depth is unavailable (no items on this plate), we have to estimate the depth using the extruder number of all plates
|
||||
std::set<int> extruder_ids;
|
||||
auto pl = ppl.get_plate_list();
|
||||
for (const auto& p : pl) {
|
||||
auto es = p->get_extruders();
|
||||
extruder_ids.insert(es.begin(), es.end());
|
||||
}
|
||||
int extruder_size = extruder_ids.size();
|
||||
wipe_tower_size(1) = extruder_size * print.wipe_tower_data(extruder_size).depth + 2 * print.wipe_tower_data().brim_width;
|
||||
}
|
||||
Vec3d plate_origin = ppl.get_plate(plate_index)->get_origin();
|
||||
Point wt_min_corner{scale_(x), scale_(y)};
|
||||
Point wt_max_corner(scale_(x + wipe_tower_size(0)), scale_(y + wipe_tower_size(1)));
|
||||
return {wt_min_corner, {wt_max_corner.x(), wt_min_corner.y()}, wt_max_corner, {wt_min_corner.x(),wt_max_corner.y()}};
|
||||
}
|
||||
|
||||
void GLCanvas3D::render(bool only_init)
|
||||
{
|
||||
if (m_in_render) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue