diff --git a/resources/calib/pressure_advance_test.stl b/resources/calib/PresureAdvnace/pressure_advance_test.stl similarity index 100% rename from resources/calib/pressure_advance_test.stl rename to resources/calib/PresureAdvnace/pressure_advance_test.stl diff --git a/resources/calib/PresureAdvnace/tower_with_seam.stl b/resources/calib/PresureAdvnace/tower_with_seam.stl new file mode 100644 index 0000000000..325ffb1d70 Binary files /dev/null and b/resources/calib/PresureAdvnace/tower_with_seam.stl differ diff --git a/src/libslic3r/GCode.cpp b/src/libslic3r/GCode.cpp index 0b3ec8a643..29231c0e18 100644 --- a/src/libslic3r/GCode.cpp +++ b/src/libslic3r/GCode.cpp @@ -1633,7 +1633,7 @@ void GCode::_do_export(Print& print, GCodeOutputStream &file, ThumbnailsGenerato this->m_objSupportsWithBrim.insert(iter->first); } if (this->m_objsWithBrim.empty() && this->m_objSupportsWithBrim.empty()) m_brim_done = true; - if (print.is_calib_mode() == Calib_PA_DDE || print.is_calib_mode() == Calib_PA_Bowden) { + if (print.calib_mode() == Calib_PA_DDE || print.calib_mode() == Calib_PA_Bowden) { std::string gcode; auto s = m_config.inner_wall_speed.value; gcode += m_writer.set_acceleration((unsigned int)floor(m_config.outer_wall_acceleration.value + 0.5)); @@ -1645,7 +1645,7 @@ void GCode::_do_export(Print& print, GCodeOutputStream &file, ThumbnailsGenerato m_config.outer_wall_speed = print.default_region_config().outer_wall_speed; m_config.inner_wall_speed = print.default_region_config().inner_wall_speed; calib_pressure_advance pa_test(this); - if(print.is_calib_mode() == Calib_PA_DDE) + if(print.calib_mode() == Calib_PA_DDE) gcode += pa_test.generate_test(); else gcode +=pa_test.generate_test(0.0,0.02); @@ -2589,6 +2589,12 @@ GCode::LayerResult GCode::process_layer( config.set_key_value("max_layer_z", new ConfigOptionFloat(m_max_layer_z)); } + if (print.calib_mode() == Calib_PA_Tower_DDE) { + gcode += writer().set_pressure_advance(static_cast(print_z) * 0.002); + } + else if(print.calib_mode() == Calib_PA_Tower_Bowden) { + gcode += writer().set_pressure_advance(static_cast(print_z) * 0.02); + } //BBS if (first_layer) { //BBS: set first layer global acceleration diff --git a/src/libslic3r/Print.hpp b/src/libslic3r/Print.hpp index a7e3d4807a..337981df2c 100644 --- a/src/libslic3r/Print.hpp +++ b/src/libslic3r/Print.hpp @@ -91,7 +91,9 @@ enum PrintObjectStep { enum CalibMode { Calib_None = 0, Calib_PA_DDE, - Calib_PA_Bowden + Calib_PA_Bowden, + Calib_PA_Tower_DDE, + Calib_PA_Tower_Bowden }; // A PrintRegion object represents a group of volumes to print @@ -741,8 +743,8 @@ public: //SoftFever bool &is_BBL_printer() { return m_isBBLPrinter; } const bool is_BBL_printer() const { return m_isBBLPrinter; } - CalibMode& is_calib_mode() { return m_calib_mode; } - const CalibMode is_calib_mode() const { return m_calib_mode; } + CalibMode& calib_mode() { return m_calib_mode; } + const CalibMode calib_mode() const { return m_calib_mode; } protected: // Invalidates the step, and its depending steps in Print. bool invalidate_step(PrintStep step); diff --git a/src/slic3r/GUI/MainFrame.cpp b/src/slic3r/GUI/MainFrame.cpp index 0d96f63762..f5fe4941b9 100644 --- a/src/slic3r/GUI/MainFrame.cpp +++ b/src/slic3r/GUI/MainFrame.cpp @@ -12,6 +12,7 @@ //#include #include #include +#include #include #include @@ -2460,18 +2461,37 @@ void MainFrame::init_menubar_as_editor() m_topbar->AddDropDownSubMenu(helpMenu, _L("Help")); // SoftFever calibrations - append_menu_item(m_topbar->GetCalibMenu(), wxID_ANY, _L("PA - DDE"), _L("Calibrate PA - DDE"), - [this](wxCommandEvent&) { if (m_plater) m_plater->calib_pa(false); }, "", nullptr, + auto pa_menu = new wxMenu(); + // PA + append_menu_item(pa_menu, wxID_ANY, _L("Line method - DDE"), _L(""), + [this](wxCommandEvent&) { if (m_plater) m_plater->calib_pa(true, false); }, "", nullptr, [this]() {return m_plater->is_view3D_shown();; }, this); - append_menu_item(m_topbar->GetCalibMenu(), wxID_ANY, _L("PA - Bowden"), _L("Calibrate PA - Bowden"), - [this](wxCommandEvent&) { if (m_plater) m_plater->calib_pa(true); }, "", nullptr, + append_menu_item(pa_menu, wxID_ANY, _L("Line method - Bowden"), _L(""), + [this](wxCommandEvent&) { if (m_plater) m_plater->calib_pa(true, true); }, "", nullptr, [this]() {return m_plater->is_view3D_shown();; }, this); - append_menu_item(m_topbar->GetCalibMenu(), wxID_ANY, _L("Flowrate - Pass 1"), _L("Flowrate - Pass 1"), + append_menu_item(pa_menu, wxID_ANY, _L("Tower method - DDE"), _L(""), + [this](wxCommandEvent&) { if (m_plater) m_plater->calib_pa(false, false); }, "", nullptr, + [this]() {return m_plater->is_view3D_shown();; }, this); + append_menu_item(pa_menu, wxID_ANY, _L("Tower method - Bowden"), _L(""), + [this](wxCommandEvent&) { if (m_plater) m_plater->calib_pa(false, true); }, "", nullptr, + [this]() {return m_plater->is_view3D_shown();; }, this); + m_topbar->GetCalibMenu()->AppendSubMenu(pa_menu, _L("Presure/Linear Advance")); + + // Flowrate + auto flowrate_menu = new wxMenu(); + append_menu_item(flowrate_menu, wxID_ANY, _L("Pass 1"), _L("Flow rate test - Pass 1"), [this](wxCommandEvent&) { if (m_plater) m_plater->calib_flowrate(1); }, "", nullptr, [this]() {return m_plater->is_view3D_shown();; }, this); - append_menu_item(m_topbar->GetCalibMenu(), wxID_ANY, _L("Flowrate - Pass 2"), _L("Flowrate - Pass 2"), + append_menu_item(flowrate_menu, wxID_ANY, _L("Pass 2"), _L("Flow rate test - Pass 2"), [this](wxCommandEvent&) { if (m_plater) m_plater->calib_flowrate(2); }, "", nullptr, [this]() {return m_plater->is_view3D_shown();; }, this); + m_topbar->GetCalibMenu()->AppendSubMenu(flowrate_menu, _L("Flow rate")); + + // help + auto calib_help_menu = append_menu_item(m_topbar->GetCalibMenu(), wxID_ANY, _L("Tutorial"), _L("Calibration help"), + [this](wxCommandEvent&) { wxLaunchDefaultBrowser("https://github.com/SoftFever/BambuStudio-SoftFever/wiki/Calibration", wxBROWSER_NEW_WINDOW); }, "", nullptr, + [this]() {return m_plater->is_view3D_shown();; }, this); + #else m_menubar->Append(fileMenu, wxString::Format("&%s", _L("File"))); if (editMenu) diff --git a/src/slic3r/GUI/Plater.cpp b/src/slic3r/GUI/Plater.cpp index 5351ce08a2..9ef895094f 100644 --- a/src/slic3r/GUI/Plater.cpp +++ b/src/slic3r/GUI/Plater.cpp @@ -7865,13 +7865,49 @@ void Plater::add_model(bool imperial_units/* = false*/, std::string fname/* = " } } -void Plater::calib_pa(bool bowden) { +void Plater::calib_pa(bool line_method, bool bowden) { const auto calib_pa_name = "Pressure Advance Test"; new_project(false, false, calib_pa_name); - add_model(false, Slic3r::resources_dir() + "/calib/pressure_advance_test.stl"); wxGetApp().mainframe->select_tab(size_t(MainFrame::tp3DEditor)); + if (line_method) { + add_model(false, Slic3r::resources_dir() + "/calib/PresureAdvnace/pressure_advance_test.stl"); + p->background_process.fff_print()->calib_mode() = bowden ? Calib_PA_Bowden : Calib_PA_DDE; + } + else { + add_model(false, Slic3r::resources_dir() + "/calib/PresureAdvnace/tower_with_seam.stl"); + p->background_process.fff_print()->calib_mode() = bowden ? Calib_PA_Tower_Bowden: Calib_PA_Tower_DDE; + auto print_config = &wxGetApp().preset_bundle->prints.get_edited_preset().config; + auto printer_config = &wxGetApp().preset_bundle->printers.get_edited_preset().config; + auto filament_config = &wxGetApp().preset_bundle->filaments.get_edited_preset().config; + filament_config->set_key_value("slow_down_layer_time", new ConfigOptionFloats{ 1.0f }); + print_config->set_key_value("default_jerk", new ConfigOptionFloat(1.0f)); + print_config->set_key_value("outer_wall_jerk", new ConfigOptionFloat(1.0f)); + print_config->set_key_value("inner_wall_jerk", new ConfigOptionFloat(1.0f)); + print_config->set_key_value("top_surface_jerk", new ConfigOptionFloat(1.0f)); + model().objects[0]->config.set_key_value("seam_position", new ConfigOptionEnum(spRear)); + + changed_objects({ 0 }); + wxGetApp().get_tab(Preset::TYPE_PRINT)->update_dirty(); + wxGetApp().get_tab(Preset::TYPE_FILAMENT)->update_dirty(); + + + // automatic selection of added objects + // update printable state for new volumes on canvas3D + wxGetApp().plater()->canvas3D()->update_instance_printable_state_for_objects({0}); + + Selection& selection = p->view3D->get_canvas3d()->get_selection(); + selection.clear(); + selection.add_object(0, false); + + // BBS: update object list selection + p->sidebar->obj_list()->update_selections(); + selection.notify_instance_update(-1, -1); + if (p->view3D->get_canvas3d()->get_gizmos_manager().is_enabled()) + // this is required because the selected object changed and the flatten on face an sla support gizmos need to be updated accordingly + p->view3D->get_canvas3d()->update_gizmos_on_off_state(); + + } - p->background_process.fff_print()->is_calib_mode() = bowden ? Calib_PA_Bowden : Calib_PA_DDE; } diff --git a/src/slic3r/GUI/Plater.hpp b/src/slic3r/GUI/Plater.hpp index d604237621..aef8479e3c 100644 --- a/src/slic3r/GUI/Plater.hpp +++ b/src/slic3r/GUI/Plater.hpp @@ -226,7 +226,7 @@ public: void refresh_print(); // SoftFever - void calib_pa(bool bowden = false); + void calib_pa(bool line_method = true, bool bowden = false); void calib_flowrate(int pass); ModelObject* add_part(ModelObject* model_object, std::string input_file, Vec3d move, Vec3d scale);