diff options
author | supermerill <merill@fr.fr> | 2020-10-28 15:28:25 +0300 |
---|---|---|
committer | supermerill <merill@fr.fr> | 2020-10-28 15:28:25 +0300 |
commit | 743430f70c71a9453e1f6e97b936f7c823ddb1ab (patch) | |
tree | 097ff64dd663562eeedf57d885eedae353c261e7 | |
parent | 4d619d109fcd265dfd58ce4cc300538f14cd0874 (diff) |
#598 disable autocenter for calibration
-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/CalibrationRetractionDialog.cpp | 12 | ||||
-rw-r--r-- | src/slic3r/GUI/CalibrationTempDialog.cpp | 12 |
6 files changed, 71 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 94d1c6b07..fd470673f 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 7418ed7b2..959ef3f95 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/CalibrationRetractionDialog.cpp b/src/slic3r/GUI/CalibrationRetractionDialog.cpp index 5a7adc956..d5a26ee89 100644 --- a/src/slic3r/GUI/CalibrationRetractionDialog.cpp +++ b/src/slic3r/GUI/CalibrationRetractionDialog.cpp @@ -1,6 +1,7 @@ #include "CalibrationRetractionDialog.hpp" #include "I18N.hpp" #include "libslic3r/Utils.hpp" +#include "AppConfig.hpp" #include "GUI.hpp" #include "GUI_ObjectList.hpp" #include "Tab.hpp" @@ -98,6 +99,12 @@ void CalibrationRetractionDialog::create_geometry(wxCommandEvent& event_args) { 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"); + } + size_t nb_retract = nb_steps->GetSelection() < 4 ? ((int(nb_steps->GetSelection()) + 1) * 2) : ((int(nb_steps->GetSelection()) - 2) * 5); size_t nb_items = 1; if (decr_temp->GetSelection() == 1) { @@ -256,6 +263,11 @@ void CalibrationRetractionDialog::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 b4874a01d..26cffd7f9 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 = printer_config->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 = printer_config->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 = *print_config; //make a copy |