Calibration: retraction test

This commit is contained in:
SoftFever 2023-05-07 01:22:13 +08:00
parent a14943665b
commit 99230aabac
9 changed files with 226 additions and 14 deletions

View file

@ -8368,6 +8368,64 @@ void Plater::calib_max_vol_speed(const Calib_Params& params)
p->background_process.fff_print()->set_calib_params(new_params);
}
void Plater::calib_retraction(const Calib_Params& params)
{
const auto calib_retraction_name = wxString::Format(L"Retraction test");
new_project(false, false, calib_retraction_name);
wxGetApp().mainframe->select_tab(size_t(MainFrame::tp3DEditor));
if (params.mode != CalibMode::Calib_Retraction_tower)
return;
add_model(false, Slic3r::resources_dir() + "/calib/retraction/retraction_tower.stl");
auto print_config = &wxGetApp().preset_bundle->prints.get_edited_preset().config;
auto filament_config = &wxGetApp().preset_bundle->filaments.get_edited_preset().config;
auto printer_config = &wxGetApp().preset_bundle->printers.get_edited_preset().config;
auto obj = model().objects[0];
//auto bed_shape = printer_config->option<ConfigOptionPoints>("printable_area")->values;
//BoundingBoxf bed_ext = get_extents(bed_shape);
//auto scale_obj = (bed_ext.size().x() - 10) / obj->bounding_box().size().x();
//if (scale_obj < 1.0)
// obj->scale(scale_obj, 1, 1);
//const ConfigOptionFloats* nozzle_diameter_config = printer_config->option<ConfigOptionFloats>("nozzle_diameter");
//assert(nozzle_diameter_config->values.size() > 0);
//double nozzle_diameter = nozzle_diameter_config->values[0];
//double line_width = nozzle_diameter * 1.75;
double layer_height = 0.2;
auto max_lh = printer_config->option<ConfigOptionFloats>("max_layer_height");
if (max_lh->values[0] < layer_height)
max_lh->values[0] = { layer_height };
obj->config.set_key_value("wall_loops", new ConfigOptionInt(2));
obj->config.set_key_value("top_shell_layers", new ConfigOptionInt(0));
obj->config.set_key_value("bottom_shell_layers", new ConfigOptionInt(1));
obj->config.set_key_value("sparse_infill_density", new ConfigOptionPercent(0));
obj->config.set_key_value("initial_layer_print_height", new ConfigOptionFloat(layer_height));
obj->config.set_key_value("layer_height", new ConfigOptionFloat(layer_height));
changed_objects({ 0 });
//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();
// cut upper
auto obj_bb = obj->bounding_box();
auto height = (params.end - params.start + 1) / params.step;
if (height < obj_bb.size().z()) {
std::array<Vec3d, 4> plane_pts = get_cut_plane(obj_bb, height);
cut(0, 0, plane_pts, ModelObjectCutAttribute::KeepLower);
}
p->background_process.fff_print()->set_calib_params(params);
}
void Plater::calib_VFA(const Calib_Params& params)
{
const auto calib_vfa_name = wxString::Format(L"VFA test");