FIX: modify the default position of wipe tower

Change-Id: I27eacb73a7e32d20416da785378d3ff0c31f5c23
This commit is contained in:
zhimin.zeng 2023-08-17 09:34:09 +08:00 committed by Lane.Wei
parent 9560a292f2
commit 13857dba34
2 changed files with 19 additions and 2 deletions

View File

@ -3272,7 +3272,7 @@ void PrintConfigDef::init_fff_params()
//def->sidetext = L("mm");
def->mode = comDevelop;
// BBS: change data type to floats to add partplate logic
def->set_default_value(new ConfigOptionFloats{ 165.-10. });
def->set_default_value(new ConfigOptionFloats{ 15. });
def = this->add("wipe_tower_y", coFloats);
//def->label = L("Position Y");

View File

@ -2636,15 +2636,32 @@ void GLCanvas3D::reload_scene(bool refresh_immediately, bool force_full_scene_re
BoundingBoxf3 plate_bbox = wxGetApp().plater()->get_partplate_list().get_plate(plate_id)->get_bounding_box();
coordf_t plate_bbox_x_max_local_coord = plate_bbox.max(0) - plate_origin(0);
coordf_t plate_bbox_y_max_local_coord = plate_bbox.max(1) - plate_origin(1);
bool need_update = false;
if (x + margin + wipe_tower_size(0) > plate_bbox_x_max_local_coord) {
x = plate_bbox_x_max_local_coord - wipe_tower_size(0) - margin;
need_update = true;
}
else if (x < plate_origin(0) + margin) {
x = plate_origin(0) + margin;
need_update = true;
}
if (need_update) {
ConfigOptionFloat wt_x_opt(x);
dynamic_cast<ConfigOptionFloats *>(proj_cfg.option("wipe_tower_x"))->set_at(&wt_x_opt, plate_id, 0);
need_update = false;
}
if (y + margin + wipe_tower_size(1) > plate_bbox_y_max_local_coord) {
y = plate_bbox_y_max_local_coord - wipe_tower_size(1) - margin;
need_update = true;
}
else if (y < plate_origin(1) + margin) {
y = plate_origin(1) + margin;
need_update = true;
}
if (need_update) {
ConfigOptionFloat wt_y_opt(y);
dynamic_cast<ConfigOptionFloats*>(proj_cfg.option("wipe_tower_y"))->set_at(&wt_y_opt, plate_id, 0);
dynamic_cast<ConfigOptionFloats *>(proj_cfg.option("wipe_tower_y"))->set_at(&wt_y_opt, plate_id, 0);
}
int volume_idx_wipe_tower_new = m_volumes.load_wipe_tower_preview(