mirror of
https://git.mirrors.martin98.com/https://github.com/SoftFever/OrcaSlicer.git
synced 2025-08-06 00:06:13 +08:00
add YOLO linear flow rate calibration
This commit is contained in:
parent
58f8b044df
commit
8932d1f3ec
BIN
resources/calib/filament_flow/Orca-LinearFlow.3mf
Normal file
BIN
resources/calib/filament_flow/Orca-LinearFlow.3mf
Normal file
Binary file not shown.
@ -2820,6 +2820,10 @@ void MainFrame::init_menubar_as_editor()
|
||||
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);
|
||||
append_menu_item(flowrate_menu, wxID_ANY, _L("Linear"), _L("Flow rate test - Linear"),
|
||||
[this](wxCommandEvent&) { if (m_plater) m_plater->calib_flowrate_linear(); }, "", nullptr,
|
||||
[this]() {return m_plater->is_view3D_shown();; }, this);
|
||||
|
||||
m_topbar->GetCalibMenu()->AppendSubMenu(flowrate_menu, _L("Flow rate"));
|
||||
append_menu_item(m_topbar->GetCalibMenu(), wxID_ANY, _L("Pressure advance"), _L("Pressure advance"),
|
||||
[this](wxCommandEvent&) {
|
||||
@ -2907,6 +2911,9 @@ void MainFrame::init_menubar_as_editor()
|
||||
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);
|
||||
append_menu_item(flowrate_menu, wxID_ANY, _L("Linear"), _L("Flow rate test - Linear"),
|
||||
[this](wxCommandEvent&) { if (m_plater) m_plater->calib_flowrate_linear(); }, "", nullptr,
|
||||
[this]() {return m_plater->is_view3D_shown();; }, this);
|
||||
append_submenu(calib_menu,flowrate_menu,wxID_ANY,_L("Flow rate"),_L("Flow rate"),"",
|
||||
[this]() {return m_plater->is_view3D_shown();; });
|
||||
|
||||
|
@ -9729,6 +9729,101 @@ void Plater::calib_flowrate(int pass) {
|
||||
wxGetApp().get_tab(Preset::TYPE_PRINTER)->reload_config();
|
||||
}
|
||||
|
||||
void Plater::calib_flowrate_linear() {
|
||||
|
||||
const wxString calib_name(L"Orca Flow Calibration - Linear");
|
||||
if (new_project(false, false, calib_name) == wxID_CANCEL)
|
||||
return;
|
||||
|
||||
wxGetApp().mainframe->select_tab(size_t(MainFrame::tp3DEditor));
|
||||
|
||||
add_model(false, (boost::filesystem::path(Slic3r::resources_dir()) / "calib" / "filament_flow" / "Orca-LinearFlow.3mf").string());
|
||||
|
||||
auto print_config = &wxGetApp().preset_bundle->prints.get_edited_preset().config;
|
||||
auto printerConfig = &wxGetApp().preset_bundle->printers.get_edited_preset().config;
|
||||
auto filament_config = &wxGetApp().preset_bundle->filaments.get_edited_preset().config;
|
||||
|
||||
/// --- scale ---
|
||||
// model is created for a 0.4 nozzle, scale z with nozzle size.
|
||||
const ConfigOptionFloats* nozzle_diameter_config = printerConfig->option<ConfigOptionFloats>("nozzle_diameter");
|
||||
assert(nozzle_diameter_config->values.size() > 0);
|
||||
float nozzle_diameter = nozzle_diameter_config->values[0];
|
||||
float xyScale = nozzle_diameter / 0.6;
|
||||
//scale z to have 8 layers
|
||||
double first_layer_height = print_config->option<ConfigOptionFloat>("initial_layer_print_height")->value;
|
||||
double layer_height = nozzle_diameter / 2.0; // prefer 0.2 layer height for 0.4 nozzle
|
||||
first_layer_height = std::max(first_layer_height, layer_height);
|
||||
|
||||
float zscale = (first_layer_height + 7 * layer_height) / 1.6;
|
||||
// only enlarge
|
||||
if (xyScale > 1.2) {
|
||||
for (auto _obj : model().objects)
|
||||
_obj->scale(xyScale, xyScale, zscale);
|
||||
}
|
||||
else {
|
||||
for (auto _obj : model().objects)
|
||||
_obj->scale(1, 1, zscale);
|
||||
}
|
||||
|
||||
auto cur_flowrate = filament_config->option<ConfigOptionFloats>("filament_flow_ratio")->get_at(0);
|
||||
Flow infill_flow = Flow(nozzle_diameter * 1.2f, layer_height, nozzle_diameter);
|
||||
double filament_max_volumetric_speed = filament_config->option<ConfigOptionFloats>("filament_max_volumetric_speed")->get_at(0);
|
||||
double max_infill_speed = filament_max_volumetric_speed / (infill_flow.mm3_per_mm() * (cur_flowrate+0.35)/cur_flowrate);
|
||||
double internal_solid_speed = std::floor(std::min(print_config->opt_float("internal_solid_infill_speed"), max_infill_speed));
|
||||
double top_surface_speed = std::floor(std::min(print_config->opt_float("top_surface_speed"), max_infill_speed));
|
||||
|
||||
// adjust parameters
|
||||
for (auto _obj : model().objects) {
|
||||
_obj->ensure_on_bed();
|
||||
_obj->config.set_key_value("wall_loops", new ConfigOptionInt(1));
|
||||
_obj->config.set_key_value("only_one_wall_top", new ConfigOptionBool(true));
|
||||
_obj->config.set_key_value("thick_internal_bridges", new ConfigOptionBool(false));
|
||||
_obj->config.set_key_value("sparse_infill_density", new ConfigOptionPercent(35));
|
||||
_obj->config.set_key_value("min_width_top_surface", new ConfigOptionFloatOrPercent(100,true));
|
||||
_obj->config.set_key_value("bottom_shell_layers", new ConfigOptionInt(1));
|
||||
_obj->config.set_key_value("top_shell_layers", new ConfigOptionInt(4));
|
||||
_obj->config.set_key_value("top_shell_thickness", new ConfigOptionFloat(0));
|
||||
_obj->config.set_key_value("bottom_shell_thickness", new ConfigOptionFloat(0));
|
||||
_obj->config.set_key_value("detect_thin_wall", new ConfigOptionBool(true));
|
||||
_obj->config.set_key_value("filter_out_gap_fill", new ConfigOptionFloat(0));
|
||||
_obj->config.set_key_value("sparse_infill_pattern", new ConfigOptionEnum<InfillPattern>(ipRectilinear));
|
||||
_obj->config.set_key_value("top_surface_line_width", new ConfigOptionFloatOrPercent(nozzle_diameter * 1.2f, false));
|
||||
_obj->config.set_key_value("internal_solid_infill_line_width", new ConfigOptionFloatOrPercent(nozzle_diameter * 1.2f, false));
|
||||
_obj->config.set_key_value("top_surface_pattern", new ConfigOptionEnum<InfillPattern>(ipMonotonic));
|
||||
_obj->config.set_key_value("top_solid_infill_flow_ratio", new ConfigOptionFloat(1.0f));
|
||||
_obj->config.set_key_value("infill_direction", new ConfigOptionFloat(45));
|
||||
_obj->config.set_key_value("solid_infill_direction", new ConfigOptionFloat(135));
|
||||
_obj->config.set_key_value("rotate_solid_infill_direction", new ConfigOptionBool(true));
|
||||
_obj->config.set_key_value("ironing_type", new ConfigOptionEnum<IroningType>(IroningType::NoIroning));
|
||||
_obj->config.set_key_value("internal_solid_infill_speed", new ConfigOptionFloat(internal_solid_speed));
|
||||
_obj->config.set_key_value("top_surface_speed", new ConfigOptionFloat(top_surface_speed));
|
||||
_obj->config.set_key_value("seam_slope_type", new ConfigOptionEnum<SeamScarfType>(SeamScarfType::None));
|
||||
print_config->set_key_value("max_volumetric_extrusion_rate_slope", new ConfigOptionFloat(0));
|
||||
|
||||
// extract flowrate from name, filename format: flowrate_xxx
|
||||
std::string obj_name = _obj->name;
|
||||
assert(obj_name.length() > 9);
|
||||
obj_name = obj_name.substr(9);
|
||||
if (obj_name[0] == 'm')
|
||||
obj_name[0] = '-';
|
||||
auto modifier = stof(obj_name);
|
||||
_obj->config.set_key_value("print_flow_ratio", new ConfigOptionFloat(1.0f + modifier/cur_flowrate));
|
||||
}
|
||||
|
||||
print_config->set_key_value("layer_height", new ConfigOptionFloat(layer_height));
|
||||
print_config->set_key_value("alternate_extra_wall", new ConfigOptionBool(false));
|
||||
print_config->set_key_value("initial_layer_print_height", new ConfigOptionFloat(first_layer_height));
|
||||
print_config->set_key_value("reduce_crossing_wall", new ConfigOptionBool(true));
|
||||
|
||||
wxGetApp().get_tab(Preset::TYPE_PRINT)->update_dirty();
|
||||
wxGetApp().get_tab(Preset::TYPE_FILAMENT)->update_dirty();
|
||||
wxGetApp().get_tab(Preset::TYPE_PRINTER)->update_dirty();
|
||||
wxGetApp().get_tab(Preset::TYPE_PRINT)->reload_config();
|
||||
wxGetApp().get_tab(Preset::TYPE_FILAMENT)->reload_config();
|
||||
wxGetApp().get_tab(Preset::TYPE_PRINTER)->reload_config();
|
||||
|
||||
}
|
||||
|
||||
void Plater::calib_temp(const Calib_Params& params) {
|
||||
const auto calib_temp_name = wxString::Format(L"Nozzle temperature test");
|
||||
new_project(false, false, calib_temp_name);
|
||||
|
@ -260,6 +260,7 @@ public:
|
||||
// SoftFever
|
||||
void calib_pa(const Calib_Params& params);
|
||||
void calib_flowrate(int pass);
|
||||
void calib_flowrate_linear();
|
||||
void calib_temp(const Calib_Params& params);
|
||||
void calib_max_vol_speed(const Calib_Params& params);
|
||||
void calib_retraction(const Calib_Params& params);
|
||||
|
Loading…
x
Reference in New Issue
Block a user