diff --git a/src/slic3r/GUI/CalibrationBedDialog.cpp b/src/slic3r/GUI/CalibrationBedDialog.cpp index cb9c08ea2f9..70dc488aa98 100644 --- a/src/slic3r/GUI/CalibrationBedDialog.cpp +++ b/src/slic3r/GUI/CalibrationBedDialog.cpp @@ -1,6 +1,7 @@ #include "CalibrationBedDialog.hpp" #include "I18N.hpp" #include "libslic3r/Utils.hpp" +#include "AppConfig.hpp" #include "GUI.hpp" #include "GUI_ObjectList.hpp" #include "Tab.hpp" @@ -31,6 +32,12 @@ void CalibrationBedDialog::create_geometry(wxCommandEvent& event_args) { Plater* plat = this->main_frame->plater(); Model& model = plat->model(); plat->reset(); + bool autocenter = gui_app->app_config->get("autocenter") == "1"; + if(autocenter) { + //disable aut-ocenter for this calibration. + gui_app->app_config->set("autocenter", "0"); + } + std::vector objs_idx = plat->load_files(std::vector{ Slic3r::resources_dir()+"/calibration/bed_leveling/patch.amf", Slic3r::resources_dir()+"/calibration/bed_leveling/patch.amf", @@ -133,7 +140,10 @@ void CalibrationBedDialog::create_geometry(wxCommandEvent& event_args) { // plat->schedule_background_process(); plat->reslice(); plat->select_view_3D("Preview"); - + if (autocenter) { + //re-enable auto-center after this calibration. + gui_app->app_config->set("autocenter", "1"); + } } } // namespace GUI diff --git a/src/slic3r/GUI/CalibrationBridgeDialog.cpp b/src/slic3r/GUI/CalibrationBridgeDialog.cpp index c8a3c63350e..6113112802b 100644 --- a/src/slic3r/GUI/CalibrationBridgeDialog.cpp +++ b/src/slic3r/GUI/CalibrationBridgeDialog.cpp @@ -1,6 +1,7 @@ #include "CalibrationBridgeDialog.hpp" #include "I18N.hpp" #include "libslic3r/Utils.hpp" +#include "AppConfig.hpp" #include "GUI.hpp" #include "GUI_ObjectList.hpp" #include "Tab.hpp" @@ -51,6 +52,12 @@ void CalibrationBridgeDialog::create_geometry(std::string setting_to_test, bool Model& model = plat->model(); plat->reset(); + bool autocenter = gui_app->app_config->get("autocenter") == "1"; + if (autocenter) { + //disable auto-center for this calibration. + gui_app->app_config->set("autocenter", "0"); + } + int idx_steps = steps->GetSelection(); int idx_nb = nb_tests->GetSelection(); size_t step = 5 + (idx_steps == wxNOT_FOUND ? 0 : idx_steps * 5); @@ -89,15 +96,15 @@ void CalibrationBridgeDialog::create_geometry(std::string setting_to_test, bool } /// --- translate ---; + const float brim_width = std::max(print_config->option("brim_width")->value, nozzle_diameter * 5.); const ConfigOptionFloat* extruder_clearance_radius = print_config->option("extruder_clearance_radius"); const ConfigOptionPoints* bed_shape = printer_config->option("bed_shape"); - const float brim_width = std::max(print_config->option("brim_width")->value, nozzle_diameter * 5.); Vec2d bed_size = BoundingBoxf(bed_shape->values).size(); Vec2d bed_min = BoundingBoxf(bed_shape->values).min; - float offsety = 2 + 10 * 1 + extruder_clearance_radius->value + brim_width + (brim_width> extruder_clearance_radius->value ? brim_width - extruder_clearance_radius->value :0); + float offsety = 2 + 10 * 1 + extruder_clearance_radius->value + brim_width + (brim_width > extruder_clearance_radius->value ? brim_width - extruder_clearance_radius->value : 0); model.objects[objs_idx[0]]->translate({ bed_min.x() + bed_size.x() / 2, bed_min.y() + bed_size.y() / 2, 0 }); for (int i = 1; i < nb_items; i++) { - model.objects[objs_idx[i]]->translate({ bed_min.x() + bed_size.x() / 2, bed_min.y() + bed_size.y() / 2 + (i%2==0?-1:1) * offsety * ((i+1)/2), 0 }); + model.objects[objs_idx[i]]->translate({ bed_min.x() + bed_size.x() / 2, bed_min.y() + bed_size.y() / 2 + (i % 2 == 0 ? -1 : 1) * offsety * ((i + 1) / 2), 0 }); } //TODO: if not enough space, forget about complete_objects @@ -135,6 +142,11 @@ void CalibrationBridgeDialog::create_geometry(std::string setting_to_test, bool plat->reslice(); plat->select_view_3D("Preview"); + + if (autocenter) { + //re-enable auto-center after this calibration. + gui_app->app_config->set("autocenter", "1"); + } } } // namespace GUI diff --git a/src/slic3r/GUI/CalibrationFlowDialog.cpp b/src/slic3r/GUI/CalibrationFlowDialog.cpp index 42f4ef593d3..895f05a9743 100644 --- a/src/slic3r/GUI/CalibrationFlowDialog.cpp +++ b/src/slic3r/GUI/CalibrationFlowDialog.cpp @@ -1,6 +1,7 @@ #include "CalibrationFlowDialog.hpp" #include "I18N.hpp" #include "libslic3r/Utils.hpp" +#include "AppConfig.hpp" #include "GUI.hpp" #include "GUI_ObjectList.hpp" #include "Tab.hpp" @@ -35,6 +36,13 @@ void CalibrationFlowDialog::create_geometry(float start, float delta) { Plater* plat = this->main_frame->plater(); Model& model = plat->model(); plat->reset(); + + bool autocenter = gui_app->app_config->get("autocenter") == "1"; + if (autocenter) { + //disable auto-center for this calibration. + gui_app->app_config->set("autocenter", "0"); + } + std::vector objs_idx = plat->load_files(std::vector{ Slic3r::resources_dir()+"/calibration/filament_flow/filament_flow_test_cube.amf", Slic3r::resources_dir()+"/calibration/filament_flow/filament_flow_test_cube.amf", @@ -150,6 +158,11 @@ void CalibrationFlowDialog::create_geometry(float start, float delta) { plat->reslice(); plat->select_view_3D("Preview"); + + if (autocenter) { + //re-enable auto-center after this calibration. + gui_app->app_config->set("autocenter", "1"); + } } } // namespace GUI diff --git a/src/slic3r/GUI/CalibrationOverBridgeDialog.cpp b/src/slic3r/GUI/CalibrationOverBridgeDialog.cpp index 1e58a7f4b85..fddd1ceea23 100644 --- a/src/slic3r/GUI/CalibrationOverBridgeDialog.cpp +++ b/src/slic3r/GUI/CalibrationOverBridgeDialog.cpp @@ -1,6 +1,7 @@ #include "CalibrationOverBridgeDialog.hpp" #include "I18N.hpp" #include "libslic3r/Utils.hpp" +#include "AppConfig.hpp" #include "GUI.hpp" #include "GUI_ObjectList.hpp" #include "Tab.hpp" @@ -31,6 +32,12 @@ void CalibrationOverBridgeDialog::create_geometry(wxCommandEvent& event_args) { Plater* plat = this->main_frame->plater(); Model& model = plat->model(); plat->reset(); + bool autocenter = gui_app->app_config->get("autocenter") == "1"; + if (autocenter) { + //disable aut-ocenter for this calibration. + gui_app->app_config->set("autocenter", "0"); + } + std::vector objs_idx = plat->load_files(std::vector{ Slic3r::resources_dir()+"/calibration/over-bridge_tuning/over-bridge_flow_ratio_test.amf", Slic3r::resources_dir()+"/calibration/over-bridge_tuning/over-bridge_flow_ratio_test.amf", @@ -117,6 +124,11 @@ void CalibrationOverBridgeDialog::create_geometry(wxCommandEvent& event_args) { plat->reslice(); plat->select_view_3D("Preview"); + + if (autocenter) { + //re-enable auto-center after this calibration. + gui_app->app_config->set("autocenter", "1"); + } } } // namespace GUI diff --git a/src/slic3r/GUI/CalibrationTempDialog.cpp b/src/slic3r/GUI/CalibrationTempDialog.cpp index 7d72f0da904..bb8428e590e 100644 --- a/src/slic3r/GUI/CalibrationTempDialog.cpp +++ b/src/slic3r/GUI/CalibrationTempDialog.cpp @@ -1,6 +1,7 @@ #include "CalibrationTempDialog.hpp" #include "I18N.hpp" #include "libslic3r/Utils.hpp" +#include "AppConfig.hpp" #include "GUI.hpp" #include "GUI_ObjectList.hpp" #include "Tab.hpp" @@ -107,10 +108,13 @@ void CalibrationTempDialog::create_geometry(wxCommandEvent& event_args) { /// --- translate --- - const ConfigOptionPoints* bed_shape = printerConfig->option("bed_shape"); - Vec2d bed_size = BoundingBoxf(bed_shape->values).size(); - Vec2d bed_min = BoundingBoxf(bed_shape->values).min; - model.objects[objs_idx[0]]->translate({ bed_min.x() + bed_size.x() / 2, bed_min.y() + bed_size.y() / 2, 0 }); + bool autocenter = gui_app->app_config->get("autocenter") == "1"; + if (!autocenter) { + const ConfigOptionPoints* bed_shape = printerConfig->option("bed_shape"); + Vec2d bed_size = BoundingBoxf(bed_shape->values).size(); + Vec2d bed_min = BoundingBoxf(bed_shape->values).min; + model.objects[objs_idx[0]]->translate({ bed_min.x() + bed_size.x() / 2, bed_min.y() + bed_size.y() / 2, 0 }); + } /// --- main config, please modify object config when possible --- DynamicPrintConfig new_print_config = *printConfig; //make a copy