FIX: the position of wipe tower is nor correct when multi-plate

Change-Id: Idabea67591102ee0f4595793e1ab027e805ace7a
This commit is contained in:
zhimin.zeng 2023-08-21 16:45:07 +08:00 committed by Lane.Wei
parent 7c89b4d225
commit 981a46920f
2 changed files with 13 additions and 4 deletions

View File

@ -2641,8 +2641,8 @@ void GLCanvas3D::reload_scene(bool refresh_immediately, bool force_full_scene_re
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;
else if (x < margin) {
x = margin;
need_update = true;
}
if (need_update) {
@ -2655,8 +2655,8 @@ void GLCanvas3D::reload_scene(bool refresh_immediately, bool force_full_scene_re
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;
else if (y < margin) {
y = margin;
need_update = true;
}
if (need_update) {

View File

@ -58,6 +58,9 @@ static const int PARTPLATE_TEXT_OFFSET_X1 = 3;
static const int PARTPLATE_TEXT_OFFSET_X2 = 1;
static const int PARTPLATE_TEXT_OFFSET_Y = 1;
static const int PARTPLATE_PLATENAME_OFFSET_Y = 10;
static const float WIPE_TOWER_DEFAULT_X_POS = 15.;
static const float WIPE_TOWER_DEFAULT_Y_POS = 220.;
std::array<unsigned char, 4> PlateTextureForeground = {0x0, 0xae, 0x42, 0xff};
namespace Slic3r {
@ -3418,6 +3421,12 @@ int PartPlateList::create_plate(bool adjust_position)
ConfigOptionFloats* wipe_tower_y = proj_cfg.opt<ConfigOptionFloats>("wipe_tower_y");
wipe_tower_x->values.resize(m_plate_list.size(), wipe_tower_x->values.front());
wipe_tower_y->values.resize(m_plate_list.size(), wipe_tower_y->values.front());
// set the default position, the same with print config(left top)
ConfigOptionFloat wt_x_opt(WIPE_TOWER_DEFAULT_X_POS);
ConfigOptionFloat wt_y_opt(WIPE_TOWER_DEFAULT_Y_POS);
dynamic_cast<ConfigOptionFloats *>(proj_cfg.option("wipe_tower_x"))->set_at(&wt_x_opt, new_index, 0);
dynamic_cast<ConfigOptionFloats *>(proj_cfg.option("wipe_tower_y"))->set_at(&wt_y_opt, new_index, 0);
}
unprintable_plate.set_index(new_index+1);