Use placeholder STL to create needed layers

This commit is contained in:
thewildmage
2023-06-11 21:12:45 -06:00
parent 28420a58da
commit c642fab703
5 changed files with 127 additions and 69 deletions

View File

@@ -8105,13 +8105,17 @@ void Plater::calib_pa(const Calib_Params& params) {
new_project(false, false, calib_pa_name);
wxGetApp().mainframe->select_tab(size_t(MainFrame::tp3DEditor));
if (params.mode == CalibMode::Calib_PA_Line || params.mode == CalibMode::Calib_PA_Pattern) {
auto printer_config = &wxGetApp().preset_bundle->printers.get_edited_preset().config;
auto print_config = &wxGetApp().preset_bundle->prints.get_edited_preset().config;
auto filament_config = &wxGetApp().preset_bundle->filaments.get_edited_preset().config;
if (params.mode == CalibMode::Calib_PA_Line) {
add_model(false, Slic3r::resources_dir() + "/calib/PressureAdvance/pressure_advance_test.stl");
} else if (params.mode == CalibMode::Calib_PA_Pattern) {
_prep_calib_pa_pattern(params, printer_config, print_config, filament_config);
} else {
add_model(false, Slic3r::resources_dir() + "/calib/PressureAdvance/tower_with_seam.stl");
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));
@@ -8134,7 +8138,9 @@ void Plater::calib_pa(const Calib_Params& params) {
std::array<Vec3d, 4> plane_pts = get_cut_plane(obj_bb, new_height);
cut(0, 0, plane_pts, ModelObjectCutAttribute::KeepLower);
}
}
if (params.mode == CalibMode::Calib_PA_Pattern || params.mode == CalibMode::Calib_PA_Tower) {
// automatic selection of added objects
// update printable state for new volumes on canvas3D
wxGetApp().plater()->canvas3D()->update_instance_printable_state_for_objects({0});
@@ -8153,6 +8159,38 @@ void Plater::calib_pa(const Calib_Params& params) {
p->background_process.fff_print()->set_calib_params(params);
}
void Plater::_prep_calib_pa_pattern(const Calib_Params& params, DynamicPrintConfig* printer_config, DynamicPrintConfig* print_config, DynamicPrintConfig* filament_config) {
add_model(false, Slic3r::resources_dir() + "/calib/PressureAdvance/pressure_advance_test.stl");
orient();
CalibPressureAdvancePattern pa_pattern(printer_config, print_config, filament_config);
double first_layer_height = pa_pattern.first_layer_height();
double layer_height = pa_pattern.layer_height();
auto new_height = pa_pattern.max_layer_z();
for (auto i = 0; i < model().objects.size(); ++i) {
auto _obj = model().objects[i];
auto original_height = _obj->get_max_z();
auto zscale = new_height / original_height;
_obj->scale(1, 1, zscale);
changed_object(i);
}
print_config->set_key_value("layer_height", new ConfigOptionFloat(layer_height));
print_config->set_key_value("initial_layer_print_height", new ConfigOptionFloat(first_layer_height));
wxGetApp().get_tab(Preset::TYPE_PRINTER)->update_dirty();
wxGetApp().get_tab(Preset::TYPE_PRINT)->update_dirty();
wxGetApp().get_tab(Preset::TYPE_FILAMENT)->update_dirty();
wxGetApp().get_tab(Preset::TYPE_PRINTER)->reload_config();
wxGetApp().get_tab(Preset::TYPE_PRINT)->reload_config();
wxGetApp().get_tab(Preset::TYPE_FILAMENT)->reload_config();
}
void Plater::calib_flowrate(int pass) {
if (pass != 1 && pass != 2)
return;
@@ -8240,7 +8278,6 @@ void Plater::calib_flowrate(int pass) {
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) {

View File

@@ -234,6 +234,7 @@ public:
// SoftFever
void calib_pa(const Calib_Params& params);
void _prep_calib_pa_pattern(const Calib_Params& params, DynamicPrintConfig* printer_config, DynamicPrintConfig* print_config, DynamicPrintConfig* filament_profile);
void calib_flowrate(int pass);
void calib_temp(const Calib_Params& params);
void calib_max_vol_speed(const Calib_Params& params);