diff options
-rw-r--r-- | src/slic3r/GUI/CalibrationBedDialog.cpp | 12 | ||||
-rw-r--r-- | src/slic3r/GUI/CalibrationBridgeDialog.cpp | 18 | ||||
-rw-r--r-- | src/slic3r/GUI/CalibrationFlowDialog.cpp | 13 | ||||
-rw-r--r-- | src/slic3r/GUI/CalibrationOverBridgeDialog.cpp | 12 | ||||
-rw-r--r-- | src/slic3r/GUI/CalibrationTempDialog.cpp | 12 |
5 files changed, 59 insertions, 8 deletions
diff --git a/src/slic3r/GUI/CalibrationBedDialog.cpp b/src/slic3r/GUI/CalibrationBedDialog.cpp index cb9c08ea2..70dc488aa 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<size_t> objs_idx = plat->load_files(std::vector<std::string>{ 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 c8a3c6335..611311280 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<ConfigOptionFloat>("brim_width")->value, nozzle_diameter * 5.); const ConfigOptionFloat* extruder_clearance_radius = print_config->option<ConfigOptionFloat>("extruder_clearance_radius"); const ConfigOptionPoints* bed_shape = printer_config->option<ConfigOptionPoints>("bed_shape"); - const float brim_width = std::max(print_config->option<ConfigOptionFloat>("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 42f4ef593..895f05a97 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<size_t> objs_idx = plat->load_files(std::vector<std::string>{ 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 1e58a7f4b..fddd1ceea 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<size_t> objs_idx = plat->load_files(std::vector<std::string>{ 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 7d72f0da9..bb8428e59 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<ConfigOptionPoints>("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<ConfigOptionPoints>("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 |