FIX: CLI: fix a wipe tower position issue

when arrange failed and restore to original
we will compute the position of wipe tower again
we should skip this case
JIRA: STUDIO-4048

Change-Id: I19edc36dfa7ec5a9f6b5ba3a1c1e0767361b3e33
This commit is contained in:
lane.wei 2023-08-18 20:25:53 +08:00 committed by Lane.Wei
parent 5c59b0721f
commit c8651b43f1
1 changed files with 7 additions and 6 deletions

View File

@ -1839,6 +1839,7 @@ int CLI::run(int argc, char **argv)
{
int plate_count = plate_list.get_plate_count();
ConfigOptionFloats *wipe_x_option = nullptr, *wipe_y_option = nullptr;
Vec3d wipe_offset;
if (print_config.has("wipe_tower_x")) {
wipe_x_option = dynamic_cast<ConfigOptionFloats *>(print_config.option("wipe_tower_x"));
wipe_y_option = dynamic_cast<ConfigOptionFloats *>(print_config.option("wipe_tower_y"));
@ -1854,10 +1855,12 @@ int CLI::run(int argc, char **argv)
Vec3d offset = new_center - cur_center;
cur_plate->translate_all_instance(offset);
if (index == 0)
wipe_offset = offset;
if (wipe_x_option) {
BOOST_LOG_TRIVIAL(info) << boost::format("shrink_to_new_bed, plate %1%: wipe tower src: {%2%, %3%}")%(index+1) %wipe_x_option->get_at(index) %wipe_y_option->get_at(index);
ConfigOptionFloat wipe_tower_x(wipe_x_option->get_at(index) + offset(0));
ConfigOptionFloat wipe_tower_y(wipe_y_option->get_at(index) + offset(1));
ConfigOptionFloat wipe_tower_x(wipe_x_option->get_at(index) + wipe_offset(0));
ConfigOptionFloat wipe_tower_y(wipe_y_option->get_at(index) + wipe_offset(1));
wipe_x_option->set_at(&wipe_tower_x, index, 0);
wipe_y_option->set_at(&wipe_tower_y, index, 0);
@ -2534,8 +2537,7 @@ int CLI::run(int argc, char **argv)
finished_arrange = true;
model = original_model;
partplate_list.load_from_3mf_structure(plate_data_src);
translate_models(partplate_list, m_print_config);
partplate_list.reset_size(current_printable_width, current_printable_depth, current_printable_height, true, true);
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << boost::format(": exit arrange process");
}
continue;
@ -2550,8 +2552,7 @@ int CLI::run(int argc, char **argv)
finished_arrange = true;
model = original_model;
partplate_list.load_from_3mf_structure(plate_data_src);
translate_models(partplate_list, m_print_config);
partplate_list.reset_size(current_printable_width, current_printable_depth, current_printable_height, true, true);
duplicate_count = 0;
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << boost::format(": exit arrange process");
continue;