From 1ceaabea5ce04866b0daa5085ae23d4c45d95435 Mon Sep 17 00:00:00 2001 From: "xun.zhang" Date: Wed, 8 May 2024 16:55:18 +0800 Subject: [PATCH] FIX: wrong wipe tower when open 3mf file 1.wipe tower pos in 3mf was overwritten by default pos when opening 3mf with a different printer profile.This patch fix it jira: STUDIO-5890 Signed-off-by: xun.zhang Change-Id: I12e5d4b80a0ad86194db0682c1763ba4a9492521 --- src/slic3r/GUI/Plater.cpp | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/slic3r/GUI/Plater.cpp b/src/slic3r/GUI/Plater.cpp index 39cce774c..7e45caa3b 100644 --- a/src/slic3r/GUI/Plater.cpp +++ b/src/slic3r/GUI/Plater.cpp @@ -3850,6 +3850,16 @@ std::vector Plater::priv::load_files(const std::vector& input_ //always load config { + // BBS: save the wipe tower pos in file here, will be used later + ConfigOptionFloats* wipe_tower_x_opt = config.opt("wipe_tower_x"); + ConfigOptionFloats* wipe_tower_y_opt = config.opt("wipe_tower_y"); + std::optionalfile_wipe_tower_x; + std::optionalfile_wipe_tower_y; + if (wipe_tower_x_opt) + file_wipe_tower_x = *wipe_tower_x_opt; + if (wipe_tower_y_opt) + file_wipe_tower_y = *wipe_tower_y_opt; + preset_bundle->load_config_model(filename.string(), std::move(config), file_version); ConfigOption* bed_type_opt = preset_bundle->project_config.option("curr_bed_type"); @@ -3928,6 +3938,17 @@ std::vector Plater::priv::load_files(const std::vector& input_ // when for extruder colors are used filament colors q->on_filaments_change(preset_bundle->filament_presets.size()); is_project_file = true; + + //BBS: rewrite wipe tower pos stored in 3mf file , the code above should be seriously reconsidered + { + DynamicConfig& proj_cfg = wxGetApp().preset_bundle->project_config; + ConfigOptionFloats* wipe_tower_x = proj_cfg.opt("wipe_tower_x"); + ConfigOptionFloats* wipe_tower_y = proj_cfg.opt("wipe_tower_y"); + if (file_wipe_tower_x) + *wipe_tower_x = *file_wipe_tower_x; + if (file_wipe_tower_y) + *wipe_tower_y = *file_wipe_tower_y; + } } } if (!silence) wxGetApp().app_config->update_config_dir(path.parent_path().string());