From da5e38f6f6d207d5645f35302d4110cade805f71 Mon Sep 17 00:00:00 2001 From: supermerill Date: Thu, 21 May 2020 00:16:30 +0200 Subject: [PATCH] Calibrations now should get the good settings directory, even on mac, temp calibrations now began by to hot test and the calibration is configurable. --- .../bed_leveling/bed_leveling.html | 16 ++-- .../filament_flow/filament_flow.html | 20 ++--- .../filament_temp/filament_temp.html | 21 +++--- src/slic3r/GUI/CalibrationBedDialog.cpp | 12 +-- src/slic3r/GUI/CalibrationFlowDialog.cpp | 34 ++++----- src/slic3r/GUI/CalibrationTempDialog.cpp | 73 +++++++++++++------ src/slic3r/GUI/CalibrationTempDialog.hpp | 7 +- 7 files changed, 108 insertions(+), 75 deletions(-) diff --git a/resources/calibration/bed_leveling/bed_leveling.html b/resources/calibration/bed_leveling/bed_leveling.html index 74ccd7a36..1ad1195fc 100644 --- a/resources/calibration/bed_leveling/bed_leveling.html +++ b/resources/calibration/bed_leveling/bed_leveling.html @@ -11,17 +11,18 @@

How it works

First, select your printer and your default print profile, with the filament profile for a filament you have. Note that this works with your first extruder if you have multiple ones.

When clicking on the Generate button, the program will create and slice the test print. You have to send it to your printer and print it. After the print end, check the result of each corners and the middle one against the photo below. You will have to tune your printer/firmware to correct the height if needed.

+

Read the notes and advices below for more informations.

Results

- - - - - - - + + + + + + + @@ -44,6 +45,7 @@
  • You can disable/enable z-hop for the first layer by increasing "only lift z"-> above Z" to a higher value than your first layer height. Enbaling it may pull the filament from the bed and diabling may let the nozzle strke & push the deposited filament, so you have to test and keep the best. (Advanced setting, printer -> extruder)
  • Notes

    +

    This test use your current first layer height, but you may want to increase it up to 80% of your nozzle height (before using 'generate') if it's the first time you level your bed, to reduce the risk of a nozzle crash.

    After the filament flow calibration, if it appears that the flow was very wrong, you may want to redo this calibration just after.

    Most of the calibrations need to done is the right order. This one is the first to do. But ou have to have a "good enough" extruder calibration: when you ask for 100mm of filament, that's ~ what the extruder has to scroll into the nozzle.

    This test set the setting "complete individual objects" to true, so you may want to reset your print settigns afterwards

    diff --git a/resources/calibration/filament_flow/filament_flow.html b/resources/calibration/filament_flow/filament_flow.html index e4a588d33..7f526daf8 100644 --- a/resources/calibration/filament_flow/filament_flow.html +++ b/resources/calibration/filament_flow/filament_flow.html @@ -13,11 +13,11 @@

    Exemple:

    - - - - - + + + + + @@ -33,11 +33,11 @@

    Second step, starting from +20%:

    - - - - - + + + + + diff --git a/resources/calibration/filament_temp/filament_temp.html b/resources/calibration/filament_temp/filament_temp.html index 1e472bdc5..d78cb703a 100644 --- a/resources/calibration/filament_temp/filament_temp.html +++ b/resources/calibration/filament_temp/filament_temp.html @@ -7,22 +7,22 @@

    Filament temperature calibration

    You need to do the bed level calibration before this one, and it's preferable to have also done the flow calibration. This calibration will help you to choose the right temperature with respect of bonding, overhangs and ooze. Note that this test is dependant of the cooling you selected. You can print this multiple times with more or less cooling to find your perfect spot.

    -

    This test will print a tower of prints printed with a different temperature for each floor. The middle one will be printed with the current temperature selected in your filament configuration. Each other floor will differ by 5°c. You can choose to generate 5 or 9 floors.

    +

    This test will print a tower of prints printed with a different temperature for each floor. The "middle" one will be printed with the current temperature selected in your filament configuration. The first item, on the build plate will be the hottest and the higher will be the coolest. You can choose the delta of temperature between each test and the number of tests (how many tests below the current temperature, and how many tests hotter than the current) but you can let them as-is to begun.

    Results : observation

    The goal is to choose the highest temperature that doesn't produce artifacts.

    First, you have to analyse the tower. Each floor has the temperature written on it.

    too low, by fartoo low, by fartoo low, by fartoo low, by fartoo low, by fartoo low, by fartoo low, by far
    Too far away
    too low, by fartoo low, by fartoo low, by fartoo low, by fartoo low, by far
    not flat
    too low, by fartoo low, by fartoo low, by fartoo low, by fartoo low, by far
    Not good
    - - - - - - - - - + + + + + + + + + @@ -44,6 +44,7 @@

    Notes

    Most of the calibrations need to done is the right order. This one should be the third.

    +

    The temperature numbers will only be shown between 180 and 285. Higher or lower values won't be displayed but the test will be conducted successfully, you just have to remember them.

    This tower is made with the 3D model created by gaaZolee and available here https://www.thingiverse.com/thing:2729076 with the CC BY-SA 3.0 licence.

    Licence for models used for this calibration test: CC BY-SA 3.0

    diff --git a/src/slic3r/GUI/CalibrationBedDialog.cpp b/src/slic3r/GUI/CalibrationBedDialog.cpp index a3b7e54fe..8da4ce0ce 100644 --- a/src/slic3r/GUI/CalibrationBedDialog.cpp +++ b/src/slic3r/GUI/CalibrationBedDialog.cpp @@ -43,7 +43,7 @@ namespace GUI { //html html_viewer = new wxHtmlWindow(this, wxID_ANY, wxDefaultPosition, wxSize(800, 500), wxHW_SCROLLBAR_AUTO); - html_viewer->LoadPage("./resources/calibration/bed_leveling/bed_leveling.html"); + html_viewer->LoadPage(Slic3r::resources_dir()+"/calibration/bed_leveling/bed_leveling.html"); main_sizer->Add(html_viewer, 1, wxEXPAND | wxALL, 5); wxStdDialogButtonSizer* buttons = new wxStdDialogButtonSizer(); @@ -72,11 +72,11 @@ void CalibrationBedDialog::create_geometry(wxCommandEvent& event_args) { Model& model = plat->model(); plat->reset(); std::vector objs_idx = plat->load_files(std::vector{ - "./resources/calibration/bed_leveling/patch.amf", - "./resources/calibration/bed_leveling/patch.amf", - "./resources/calibration/bed_leveling/patch.amf", - "./resources/calibration/bed_leveling/patch.amf", - "./resources/calibration/bed_leveling/patch.amf"}, true, false); + Slic3r::resources_dir()+"/calibration/bed_leveling/patch.amf", + Slic3r::resources_dir()+"/calibration/bed_leveling/patch.amf", + Slic3r::resources_dir()+"/calibration/bed_leveling/patch.amf", + Slic3r::resources_dir()+"/calibration/bed_leveling/patch.amf", + Slic3r::resources_dir()+"/calibration/bed_leveling/patch.amf"}, true, false); assert(objs_idx.size() == 5); const DynamicPrintConfig* printConfig = this->gui_app->get_tab(Preset::TYPE_PRINT)->get_config(); diff --git a/src/slic3r/GUI/CalibrationFlowDialog.cpp b/src/slic3r/GUI/CalibrationFlowDialog.cpp index 471a5a70a..e8363e0f2 100644 --- a/src/slic3r/GUI/CalibrationFlowDialog.cpp +++ b/src/slic3r/GUI/CalibrationFlowDialog.cpp @@ -44,7 +44,7 @@ namespace GUI { html_viewer = new wxHtmlWindow(this, wxID_ANY, wxDefaultPosition, wxSize(500, 500), wxHW_SCROLLBAR_AUTO); html_viewer->SetMinSize(wxSize(900, 500)); - html_viewer->LoadPage("./resources/calibration/filament_flow/filament_flow.html"); + html_viewer->LoadPage(Slic3r::resources_dir()+"/calibration/filament_flow/filament_flow.html"); main_sizer->Add(html_viewer, 1, wxEXPAND | wxALL, 5); wxStdDialogButtonSizer* buttons = new wxStdDialogButtonSizer(); @@ -130,11 +130,11 @@ void CalibrationFlowDialog::create_geometry(float start, float delta) { Model& model = plat->model(); plat->reset(); std::vector objs_idx = plat->load_files(std::vector{ - "./resources/calibration/filament_flow/filament_flow_test_cube.amf", - "./resources/calibration/filament_flow/filament_flow_test_cube.amf", - "./resources/calibration/filament_flow/filament_flow_test_cube.amf", - "./resources/calibration/filament_flow/filament_flow_test_cube.amf", - "./resources/calibration/filament_flow/filament_flow_test_cube.amf"}, true, false); + Slic3r::resources_dir()+"/calibration/filament_flow/filament_flow_test_cube.amf", + Slic3r::resources_dir()+"/calibration/filament_flow/filament_flow_test_cube.amf", + Slic3r::resources_dir()+"/calibration/filament_flow/filament_flow_test_cube.amf", + Slic3r::resources_dir()+"/calibration/filament_flow/filament_flow_test_cube.amf", + Slic3r::resources_dir()+"/calibration/filament_flow/filament_flow_test_cube.amf"}, true, false); assert(objs_idx.size() == 5); @@ -163,20 +163,20 @@ void CalibrationFlowDialog::create_geometry(float start, float delta) { //add sub-part after scale float zshift = (1 - zscale) / 2; if (delta == 10.f && start == 80.f) { - add_part(model.objects[objs_idx[0]], "./resources/calibration/filament_flow/m20.amf", Vec3d{ 9,0,zshift }); - add_part(model.objects[objs_idx[1]], "./resources/calibration/filament_flow/m10.amf", Vec3d{ 9,0,zshift }); - add_part(model.objects[objs_idx[2]], "./resources/calibration/filament_flow/_0.amf", Vec3d{ 9,0,zshift }); - add_part(model.objects[objs_idx[3]], "./resources/calibration/filament_flow/p10.amf", Vec3d{ 9,0,zshift }); - add_part(model.objects[objs_idx[4]], "./resources/calibration/filament_flow/p20.amf", Vec3d{ 9,0,zshift }); + add_part(model.objects[objs_idx[0]], Slic3r::resources_dir()+"/calibration/filament_flow/m20.amf", Vec3d{ 9,0,zshift }); + add_part(model.objects[objs_idx[1]], Slic3r::resources_dir()+"/calibration/filament_flow/m10.amf", Vec3d{ 9,0,zshift }); + add_part(model.objects[objs_idx[2]], Slic3r::resources_dir()+"/calibration/filament_flow/_0.amf", Vec3d{ 9,0,zshift }); + add_part(model.objects[objs_idx[3]], Slic3r::resources_dir()+"/calibration/filament_flow/p10.amf", Vec3d{ 9,0,zshift }); + add_part(model.objects[objs_idx[4]], Slic3r::resources_dir()+"/calibration/filament_flow/p20.amf", Vec3d{ 9,0,zshift }); } else if (delta == 2.f && start == 92.f) { - add_part(model.objects[objs_idx[0]], "./resources/calibration/filament_flow/m8.amf", Vec3d{ 9,0,zshift }); - add_part(model.objects[objs_idx[1]], "./resources/calibration/filament_flow/m6.amf", Vec3d{ 9,0,zshift }); - add_part(model.objects[objs_idx[2]], "./resources/calibration/filament_flow/m4.amf", Vec3d{ 9,0,zshift }); - add_part(model.objects[objs_idx[3]], "./resources/calibration/filament_flow/m2.amf", Vec3d{ 9,0,zshift }); - add_part(model.objects[objs_idx[4]], "./resources/calibration/filament_flow/_0.amf", Vec3d{ 9,0,zshift }); + add_part(model.objects[objs_idx[0]], Slic3r::resources_dir()+"/calibration/filament_flow/m8.amf", Vec3d{ 9,0,zshift }); + add_part(model.objects[objs_idx[1]], Slic3r::resources_dir()+"/calibration/filament_flow/m6.amf", Vec3d{ 9,0,zshift }); + add_part(model.objects[objs_idx[2]], Slic3r::resources_dir()+"/calibration/filament_flow/m4.amf", Vec3d{ 9,0,zshift }); + add_part(model.objects[objs_idx[3]], Slic3r::resources_dir()+"/calibration/filament_flow/m2.amf", Vec3d{ 9,0,zshift }); + add_part(model.objects[objs_idx[4]], Slic3r::resources_dir()+"/calibration/filament_flow/_0.amf", Vec3d{ 9,0,zshift }); } for (size_t i = 0; i < 5; i++) { - add_part(model.objects[objs_idx[i]], "./resources/calibration/filament_flow/O.amf", Vec3d{ 0,0,zscale/2.f + 0.5 }, Vec3d{1,1,xyScale }); + add_part(model.objects[objs_idx[i]], Slic3r::resources_dir()+"/calibration/filament_flow/O.amf", Vec3d{ 0,0,zscale/2.f + 0.5 }, Vec3d{1,1,xyScale }); } /// --- translate ---; diff --git a/src/slic3r/GUI/CalibrationTempDialog.cpp b/src/slic3r/GUI/CalibrationTempDialog.cpp index 5ff28519d..62df4b57d 100644 --- a/src/slic3r/GUI/CalibrationTempDialog.cpp +++ b/src/slic3r/GUI/CalibrationTempDialog.cpp @@ -43,15 +43,33 @@ namespace GUI { //html html_viewer = new wxHtmlWindow(this, wxID_ANY, wxDefaultPosition, wxSize(800, 500), wxHW_SCROLLBAR_AUTO); - html_viewer->LoadPage("./resources/calibration/filament_temp/filament_temp.html"); + html_viewer->LoadPage(Slic3r::resources_dir()+"/calibration/filament_temp/filament_temp.html"); main_sizer->Add(html_viewer, 1, wxEXPAND | wxALL, 5); + wxString choices_steps[] = { "5","10","15","20" }; + steps = new wxComboBox(this, wxID_ANY, wxString{ "10" }, wxDefaultPosition, wxDefaultSize, 4, choices_steps); + steps->SetToolTip(_(L("Select the step in celcius between two tests."))); + steps->SetSelection(1); + wxString choices_nb[] = { "0","1","2","3","4","5","6","7" }; + nb_down = new wxComboBox(this, wxID_ANY, wxString{ "2" }, wxDefaultPosition, wxDefaultSize, 4, choices_nb); + nb_down->SetToolTip(_(L("Select the number of tests with lower temperature than the current one."))); + nb_down->SetSelection(2); + nb_up = new wxComboBox(this, wxID_ANY, wxString{ "2" }, wxDefaultPosition, wxDefaultSize, 4, choices_nb); + nb_up->SetToolTip(_(L("Select the number of tests with higher temperature than the current one."))); + nb_up->SetSelection(2); wxStdDialogButtonSizer* buttons = new wxStdDialogButtonSizer(); - wxButton* bt = new wxButton(this, wxID_FILE1, _(L("Generate +- 10"))); - bt->Bind(wxEVT_BUTTON, &CalibrationTempDialog::create_geometry_2, this); - buttons->Add(bt); - bt = new wxButton(this, wxID_FILE1, _(L("Generate +- 20"))); - bt->Bind(wxEVT_BUTTON, &CalibrationTempDialog::create_geometry_4, this); + buttons->Add(new wxStaticText(this, wxID_ANY, wxString{ "nb down:" })); + buttons->Add(nb_down); + buttons->AddSpacer(15); + buttons->Add(new wxStaticText(this, wxID_ANY, wxString{ "nb up:" })); + buttons->Add(nb_up); + buttons->AddSpacer(40); + buttons->Add(new wxStaticText(this, wxID_ANY, wxString{ "steps:" })); + buttons->Add(steps); + buttons->AddSpacer(40); + + wxButton* bt = new wxButton(this, wxID_FILE1, _(L("Generate"))); + bt->Bind(wxEVT_BUTTON, &CalibrationTempDialog::create_geometry, this); buttons->Add(bt); wxButton* close = new wxButton(this, wxID_CLOSE, _(L("Close"))); close->Bind(wxEVT_BUTTON, &CalibrationTempDialog::closeMe, this); @@ -116,12 +134,12 @@ ModelObject* CalibrationTempDialog::add_part(ModelObject* model_object, std::str return model.objects.empty()?nullptr: model.objects[0]; } -void CalibrationTempDialog::create_geometry(uint8_t nb_delta) { +void CalibrationTempDialog::create_geometry(wxCommandEvent& event_args) { Plater* plat = this->main_frame->plater(); Model& model = plat->model(); plat->reset(); std::vector objs_idx = plat->load_files(std::vector{ - "./resources/calibration/filament_temp/Smart_compact_temperature_calibration_item.amf"}, true, false); + Slic3r::resources_dir()+"/calibration/filament_temp/Smart_compact_temperature_calibration_item.amf"}, true, false); assert(objs_idx.size() == 1); const DynamicPrintConfig* printConfig = this->gui_app->get_tab(Preset::TYPE_PRINT)->get_config(); @@ -131,8 +149,15 @@ void CalibrationTempDialog::create_geometry(uint8_t nb_delta) { // -- get temps const ConfigOptionInts* temperature_config = filamentConfig->option("temperature"); assert(temperature_config->values.size() >= 1); - int16_t temperature = 5* (temperature_config->values[0]/5); - size_t nb_items = 1 + 2 * nb_delta; + int idx_steps = steps->GetSelection(); + int idx_up = nb_up->GetSelection(); + int idx_down = nb_down->GetSelection(); + int16_t temperature = 5 * (temperature_config->values[0] / 5); + size_t step_temp = 5 + (idx_steps == wxNOT_FOUND ? 0 : (idx_steps * 5)); + size_t nb_items = 1 + (idx_down == wxNOT_FOUND ? 0 : idx_down) + + (idx_up == wxNOT_FOUND ? 0 : idx_up); + //start at the highest temp + temperature = temperature + step_temp * (idx_up == wxNOT_FOUND ? 0 : idx_up); /// --- scale --- //model is created for a 0.4 nozzle, scale xy with nozzle size. @@ -153,15 +178,15 @@ void CalibrationTempDialog::create_geometry(uint8_t nb_delta) { std::vectortower; tower.push_back(model.objects[objs_idx[0]]); float zshift = (1 - xyzScale) / 2; - if (temperature - (int8_t)nb_delta * 5 > 175 && temperature - (int8_t)nb_delta * 5 < 290) { - tower.push_back(add_part(model.objects[objs_idx[0]], "./resources/calibration/filament_temp/t"+std::to_string(temperature - (int8_t)nb_delta * 5 )+".amf", + if (temperature > 175 && temperature < 290) { + tower.push_back(add_part(model.objects[objs_idx[0]], Slic3r::resources_dir()+"/calibration/filament_temp/t"+std::to_string(temperature)+".amf", Vec3d{ xyzScale * 5, - xyzScale * 2.5, zshift - xyzScale * 2.5}, Vec3d{ xyzScale, xyzScale, xyzScale * 0.43 })); } for (int16_t i = 1; i < nb_items; i++) { - tower.push_back(add_part(model.objects[objs_idx[0]], "./resources/calibration/filament_temp/Smart_compact_temperature_calibration_item.amf", + tower.push_back(add_part(model.objects[objs_idx[0]], Slic3r::resources_dir()+"/calibration/filament_temp/Smart_compact_temperature_calibration_item.amf", Vec3d{ 0,0, zshift + i * 10 }, Vec3d{ xyzScale, xyzScale * 0.5, xyzScale })); - if (temperature - (int8_t)nb_delta * 5 + i * 5 > 175 && temperature - (int8_t)nb_delta * 5 + i * 5 < 290) { - tower.push_back(add_part(model.objects[objs_idx[0]], "./resources/calibration/filament_temp/t" + std::to_string(temperature - (int8_t)nb_delta * 5 + i * 5) + ".amf", + if (temperature - i * step_temp > 175 && temperature - i * step_temp < 290) { + tower.push_back(add_part(model.objects[objs_idx[0]], Slic3r::resources_dir()+"/calibration/filament_temp/t" + std::to_string(temperature - i * step_temp) + ".amf", Vec3d{ xyzScale * 5, -xyzScale * 2.5, zshift + xyzScale * (i * 10 - 2.5) }, Vec3d{ xyzScale, xyzScale, xyzScale * 0.43 })); } } @@ -178,13 +203,16 @@ void CalibrationTempDialog::create_geometry(uint8_t nb_delta) { new_print_config.set_key_value("complete_objects", new ConfigOptionBool(false)); /// -- generate the heat change gcode - std::string str_layer_gcode = "{if layer_num > 0 and layer_z <= " + std::to_string(2 * xyzScale) + "}\nM104 S" + std::to_string(temperature - (int8_t)nb_delta * 5); + //std::string str_layer_gcode = "{if layer_num > 0 and layer_z <= " + std::to_string(2 * xyzScale) + "}\nM104 S" + std::to_string(temperature - (int8_t)nb_delta * 5); + // double print_z, std::string gcode,int extruder, std::string color + model.custom_gcode_per_print_z.gcodes.emplace_back(CustomGCode::Item{ nozzle_diameter, "M104 S" + std::to_string(temperature) + " ; ground floor temp tower set", -1, "" }); for (int16_t i = 1; i < nb_items; i++) { - str_layer_gcode += "\n{ elsif layer_z >= " + std::to_string(i * 10 * xyzScale) + " and layer_z <= " + std::to_string((1 + i * 10) * xyzScale) + " }\nM104 S" + std::to_string(temperature - (int8_t)nb_delta * 5 + i * 5); + model.custom_gcode_per_print_z.gcodes.emplace_back(CustomGCode::Item{ (i * 10 * xyzScale) , "M104 S" + std::to_string(temperature - i * step_temp) + " ; floor "+std::to_string(i)+" of the temp tower set", -1, "" }); + //str_layer_gcode += "\n{ elsif layer_z >= " + std::to_string(i * 10 * xyzScale) + " and layer_z <= " + std::to_string((1 + i * 10) * xyzScale) + " }\nM104 S" + std::to_string(temperature - (int8_t)nb_delta * 5 + i * 5); } - str_layer_gcode += "\n{endif}\n"; - DynamicPrintConfig new_printer_config = *printerConfig; //make a copy - new_printer_config.set_key_value("layer_gcode", new ConfigOptionString(str_layer_gcode)); + //str_layer_gcode += "\n{endif}\n"; + //DynamicPrintConfig new_printer_config = *printerConfig; //make a copy + //new_printer_config.set_key_value("layer_gcode", new ConfigOptionString(str_layer_gcode)); /// --- custom config --- float brim_width = printConfig->option("brim_width")->value; @@ -207,11 +235,12 @@ void CalibrationTempDialog::create_geometry(uint8_t nb_delta) { //update plater this->gui_app->get_tab(Preset::TYPE_PRINT)->load_config(new_print_config); plat->on_config_change(new_print_config); - this->gui_app->get_tab(Preset::TYPE_PRINTER)->load_config(new_printer_config); - plat->on_config_change(new_printer_config); + //this->gui_app->get_tab(Preset::TYPE_PRINTER)->load_config(new_printer_config); + //plat->on_config_change(new_printer_config); plat->changed_objects(objs_idx); this->gui_app->get_tab(Preset::TYPE_PRINT)->update_dirty(); this->gui_app->get_tab(Preset::TYPE_PRINTER)->update_dirty(); + plat->is_preview_shown(); //update everything, easier to code. ObjectList* obj = this->gui_app->obj_list(); obj->update_after_undo_redo(); diff --git a/src/slic3r/GUI/CalibrationTempDialog.hpp b/src/slic3r/GUI/CalibrationTempDialog.hpp index fcb7c2d5a..8824d470e 100644 --- a/src/slic3r/GUI/CalibrationTempDialog.hpp +++ b/src/slic3r/GUI/CalibrationTempDialog.hpp @@ -27,14 +27,15 @@ protected: private: void closeMe(wxCommandEvent& event_args); ModelObject* add_part(ModelObject* model_object, std::string input_file, Vec3d move, Vec3d scale = Vec3d{ 1,1,1 }); - void create_geometry_2(wxCommandEvent& event_args) { create_geometry(2); } - void create_geometry_4(wxCommandEvent& event_args) { create_geometry(4); } - void create_geometry(uint8_t nb_delta); + void create_geometry(wxCommandEvent& event_args); wxPanel* create_header(wxWindow* parent, const wxFont& bold_font); wxHtmlWindow* html_viewer; MainFrame* main_frame; GUI_App* gui_app; + wxComboBox* steps; + wxComboBox* nb_down; + wxComboBox* nb_up; };
    too low, by fartoo low, by fartoo low, by fartoo low, by fartoo low, by fartoo low, by fartoo low, by fartoo low, by fartoo low, by far
    TODO