pressure advance tower

This commit is contained in:
SoftFever 2022-12-27 23:51:53 +08:00
parent 647304f4a2
commit 990d235415
7 changed files with 79 additions and 15 deletions

Binary file not shown.

View file

@ -1633,7 +1633,7 @@ void GCode::_do_export(Print& print, GCodeOutputStream &file, ThumbnailsGenerato
this->m_objSupportsWithBrim.insert(iter->first); this->m_objSupportsWithBrim.insert(iter->first);
} }
if (this->m_objsWithBrim.empty() && this->m_objSupportsWithBrim.empty()) m_brim_done = true; 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; std::string gcode;
auto s = m_config.inner_wall_speed.value; auto s = m_config.inner_wall_speed.value;
gcode += m_writer.set_acceleration((unsigned int)floor(m_config.outer_wall_acceleration.value + 0.5)); 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.outer_wall_speed = print.default_region_config().outer_wall_speed;
m_config.inner_wall_speed = print.default_region_config().inner_wall_speed; m_config.inner_wall_speed = print.default_region_config().inner_wall_speed;
calib_pressure_advance pa_test(this); 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(); gcode += pa_test.generate_test();
else else
gcode +=pa_test.generate_test(0.0,0.02); 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)); 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<int>(print_z) * 0.002);
}
else if(print.calib_mode() == Calib_PA_Tower_Bowden) {
gcode += writer().set_pressure_advance(static_cast<int>(print_z) * 0.02);
}
//BBS //BBS
if (first_layer) { if (first_layer) {
//BBS: set first layer global acceleration //BBS: set first layer global acceleration

View file

@ -91,7 +91,9 @@ enum PrintObjectStep {
enum CalibMode { enum CalibMode {
Calib_None = 0, Calib_None = 0,
Calib_PA_DDE, 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 // A PrintRegion object represents a group of volumes to print
@ -741,8 +743,8 @@ public:
//SoftFever //SoftFever
bool &is_BBL_printer() { return m_isBBLPrinter; } bool &is_BBL_printer() { return m_isBBLPrinter; }
const bool is_BBL_printer() const { return m_isBBLPrinter; } const bool is_BBL_printer() const { return m_isBBLPrinter; }
CalibMode& is_calib_mode() { return m_calib_mode; } CalibMode& calib_mode() { return m_calib_mode; }
const CalibMode is_calib_mode() const { return m_calib_mode; } const CalibMode calib_mode() const { return m_calib_mode; }
protected: protected:
// Invalidates the step, and its depending steps in Print. // Invalidates the step, and its depending steps in Print.
bool invalidate_step(PrintStep step); bool invalidate_step(PrintStep step);

View file

@ -12,6 +12,7 @@
//#include <wx/glcanvas.h> //#include <wx/glcanvas.h>
#include <wx/filename.h> #include <wx/filename.h>
#include <wx/debug.h> #include <wx/debug.h>
#include <wx/utils.h>
#include <boost/algorithm/string/predicate.hpp> #include <boost/algorithm/string/predicate.hpp>
#include <boost/log/trivial.hpp> #include <boost/log/trivial.hpp>
@ -2460,18 +2461,37 @@ void MainFrame::init_menubar_as_editor()
m_topbar->AddDropDownSubMenu(helpMenu, _L("Help")); m_topbar->AddDropDownSubMenu(helpMenu, _L("Help"));
// SoftFever calibrations // SoftFever calibrations
append_menu_item(m_topbar->GetCalibMenu(), wxID_ANY, _L("PA - DDE"), _L("Calibrate PA - DDE"), auto pa_menu = new wxMenu();
[this](wxCommandEvent&) { if (m_plater) m_plater->calib_pa(false); }, "", nullptr, // 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); [this]() {return m_plater->is_view3D_shown();; }, this);
append_menu_item(m_topbar->GetCalibMenu(), wxID_ANY, _L("PA - Bowden"), _L("Calibrate PA - Bowden"), append_menu_item(pa_menu, wxID_ANY, _L("Line method - Bowden"), _L(""),
[this](wxCommandEvent&) { if (m_plater) m_plater->calib_pa(true); }, "", nullptr, [this](wxCommandEvent&) { if (m_plater) m_plater->calib_pa(true, true); }, "", nullptr,
[this]() {return m_plater->is_view3D_shown();; }, this); [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](wxCommandEvent&) { if (m_plater) m_plater->calib_flowrate(1); }, "", nullptr,
[this]() {return m_plater->is_view3D_shown();; }, this); [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](wxCommandEvent&) { if (m_plater) m_plater->calib_flowrate(2); }, "", nullptr,
[this]() {return m_plater->is_view3D_shown();; }, this); [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 #else
m_menubar->Append(fileMenu, wxString::Format("&%s", _L("File"))); m_menubar->Append(fileMenu, wxString::Format("&%s", _L("File")));
if (editMenu) if (editMenu)

View file

@ -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"; const auto calib_pa_name = "Pressure Advance Test";
new_project(false, false, calib_pa_name); 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)); 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<SeamPosition>(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;
} }

View file

@ -226,7 +226,7 @@ public:
void refresh_print(); void refresh_print();
// SoftFever // SoftFever
void calib_pa(bool bowden = false); void calib_pa(bool line_method = true, bool bowden = false);
void calib_flowrate(int pass); void calib_flowrate(int pass);
ModelObject* add_part(ModelObject* model_object, std::string input_file, Vec3d move, Vec3d scale); ModelObject* add_part(ModelObject* model_object, std::string input_file, Vec3d move, Vec3d scale);