diff --git a/resources/profiles_template/Template.json b/resources/profiles_template/Template.json index c750a0473..8f95fee19 100644 --- a/resources/profiles_template/Template.json +++ b/resources/profiles_template/Template.json @@ -7,20 +7,8 @@ ], "process_list": [ { - "name": "process_0.2_nozzle_template", - "sub_path": "process/process_0.2_nozzle_template.json" - }, - { - "name": "process_0.4_nozzle_template", - "sub_path": "process/process_0.4_nozzle_template.json" - }, - { - "name": "process_0.6_nozzle_template", - "sub_path": "process/process_0.6_nozzle_template.json" - }, - { - "name": "process_0.8_nozzle_template", - "sub_path": "process/process_0.8_nozzle_template.json" + "name": "process template", + "sub_path": "process/process template.json" } ], "filament_list": [ diff --git a/resources/profiles_template/Template/process/process_0.4_nozzle_template.json b/resources/profiles_template/Template/process/process template.json similarity index 98% rename from resources/profiles_template/Template/process/process_0.4_nozzle_template.json rename to resources/profiles_template/Template/process/process template.json index 5ff1801ae..e4b66bea3 100644 --- a/resources/profiles_template/Template/process/process_0.4_nozzle_template.json +++ b/resources/profiles_template/Template/process/process template.json @@ -1,6 +1,6 @@ { "type": "process", - "name": "process_0.4_nozzle_template", + "name": "process template", "instantiation": "false", "adaptive_layer_height": "0", "bridge_flow": "1", diff --git a/resources/profiles_template/Template/process/process_0.2_nozzle_template.json b/resources/profiles_template/Template/process/process_0.2_nozzle_template.json deleted file mode 100644 index 2bad557c8..000000000 --- a/resources/profiles_template/Template/process/process_0.2_nozzle_template.json +++ /dev/null @@ -1,109 +0,0 @@ -{ - "type": "process", - "name": "process_0.2_nozzle_template", - "instantiation": "false", - "adaptive_layer_height": "0", - "bridge_flow": "1", - "bridge_speed": "50", - "brim_width": "5", - "bridge_no_support": "0", - "bottom_surface_pattern": "monotonic", - "bottom_shell_layers": "5", - "bottom_shell_thickness": "0", - "brim_object_gap": "0.1", - "compatible_printers_condition": "", - "default_acceleration": "10000", - "detect_overhang_wall": "1", - "detect_thin_wall": "0", - "draft_shield": "disabled", - "elefant_foot_compensation": "0", - "enable_support": "0", - "enable_prime_tower": "1", - "enable_arc_fitting": "1", - "filename_format": "{input_filename_base}_{filament_type[0]}_{print_time}.gcode", - "gap_infill_speed": "50", - "infill_direction": "45", - "initial_layer_line_width": "0.25", - "initial_layer_print_height": "0.1", - "initial_layer_speed": "40", - "infill_combination": "0", - "infill_wall_overlap": "15%", - "interface_shells": "0", - "inner_wall_line_width": "0.22", - "inner_wall_speed": "150", - "internal_solid_infill_line_width": "0.22", - "internal_solid_infill_speed": "150", - "internal_bridge_support_thickness": "0.8", - "initial_layer_acceleration": "500", - "ironing_flow": "10%", - "ironing_spacing": "0.15", - "ironing_speed": "30", - "ironing_type": "no ironing", - "initial_layer_infill_speed": "70", - "line_width": "0.22", - "layer_height": "0.1", - "minimum_sparse_infill_area": "15", - "max_travel_detour_distance": "0", - "outer_wall_line_width": "0.22", - "outer_wall_speed": "120", - "outer_wall_acceleration": "5000", - "overhang_1_4_speed": "0", - "overhang_2_4_speed": "50", - "overhang_3_4_speed": "30", - "overhang_4_4_speed": "10", - "only_one_wall_top": "1", - "print_sequence": "by layer", - "print_settings_id": "", - "prime_tower_width": "35", - "reduce_crossing_wall": "0", - "reduce_infill_retraction": "1", - "raft_layers": "0", - "resolution": "0.012", - "sparse_infill_density": "15%", - "sparse_infill_pattern": "grid", - "sparse_infill_line_width": "0.22", - "sparse_infill_speed": "100", - "seam_position": "aligned", - "skirt_distance": "2", - "skirt_height": "1", - "spiral_mode": "0", - "standby_temperature_delta": "-5", - "support_filament": "0", - "support_line_width": "0.22", - "support_interface_filament": "0", - "support_on_build_plate_only": "0", - "support_top_z_distance": "0.2", - "support_interface_loop_pattern": "0", - "support_interface_top_layers": "2", - "support_interface_spacing": "0.5", - "support_interface_speed": "80", - "support_interface_pattern": "auto", - "support_base_pattern": "default", - "support_base_pattern_spacing": "2.5", - "support_speed": "150", - "support_threshold_angle": "30", - "support_object_xy_distance": "0.35", - "skirt_loops": "0", - "support_type": "normal(auto)", - "support_style": "default", - "support_bottom_z_distance": "0.2", - "support_interface_bottom_layers": "2", - "support_expansion": "0", - "top_surface_line_width": "0.22", - "top_surface_speed": "150", - "travel_speed": "500", - "tree_support_branch_diameter": "2", - "tree_support_branch_angle": "45", - "tree_support_wall_count": "1", - "top_surface_pattern": "monotonicline", - "top_surface_acceleration": "2000", - "top_shell_layers": "7", - "top_shell_thickness": "0.8", - "wall_loops": "4", - "wall_infill_order": "inner wall/outer wall/infill", - "wipe_tower_no_sparse_layers": "0", - "wall_generator": "classic", - "xy_hole_compensation": "0", - "xy_contour_compensation": "0", - "compatible_printers": [] -} \ No newline at end of file diff --git a/resources/profiles_template/Template/process/process_0.6_nozzle_template.json b/resources/profiles_template/Template/process/process_0.6_nozzle_template.json deleted file mode 100644 index d0ddf96a4..000000000 --- a/resources/profiles_template/Template/process/process_0.6_nozzle_template.json +++ /dev/null @@ -1,109 +0,0 @@ -{ - "type": "process", - "name": "process_0.6_nozzle_template", - "instantiation": "false", - "adaptive_layer_height": "0", - "bridge_flow": "1", - "bridge_speed": "30", - "brim_width": "5", - "bridge_no_support": "0", - "bottom_surface_pattern": "monotonic", - "bottom_shell_layers": "3", - "bottom_shell_thickness": "0", - "brim_object_gap": "0.1", - "compatible_printers_condition": "", - "default_acceleration": "10000", - "detect_overhang_wall": "1", - "detect_thin_wall": "0", - "draft_shield": "disabled", - "elefant_foot_compensation": "0", - "enable_support": "0", - "enable_prime_tower": "1", - "enable_arc_fitting": "1", - "filename_format": "{input_filename_base}_{filament_type[0]}_{print_time}.gcode", - "gap_infill_speed": "50", - "infill_direction": "45", - "initial_layer_line_width": "0.62", - "initial_layer_print_height": "0.3", - "initial_layer_speed": "35", - "infill_combination": "0", - "infill_wall_overlap": "15%", - "interface_shells": "0", - "inner_wall_line_width": "0.62", - "inner_wall_speed": "150", - "internal_solid_infill_line_width": "0.62", - "internal_solid_infill_speed": "150", - "internal_bridge_support_thickness": "0.8", - "initial_layer_acceleration": "500", - "ironing_flow": "10%", - "ironing_spacing": "0.15", - "ironing_speed": "30", - "ironing_type": "no ironing", - "initial_layer_infill_speed": "55", - "line_width": "0.62", - "layer_height": "0.3", - "minimum_sparse_infill_area": "15", - "max_travel_detour_distance": "0", - "outer_wall_line_width": "0.62", - "outer_wall_speed": "120", - "outer_wall_acceleration": "5000", - "overhang_1_4_speed": "0", - "overhang_2_4_speed": "50", - "overhang_3_4_speed": "15", - "overhang_4_4_speed": "10", - "only_one_wall_top": "1", - "print_sequence": "by layer", - "print_settings_id": "", - "prime_tower_width": "35", - "reduce_crossing_wall": "0", - "reduce_infill_retraction": "1", - "raft_layers": "0", - "resolution": "0.012", - "sparse_infill_density": "15%", - "sparse_infill_pattern": "grid", - "sparse_infill_line_width": "0.62", - "sparse_infill_speed": "100", - "seam_position": "aligned", - "skirt_distance": "2", - "skirt_height": "1", - "spiral_mode": "0", - "standby_temperature_delta": "-5", - "support_filament": "0", - "support_line_width": "0.62", - "support_interface_filament": "0", - "support_on_build_plate_only": "0", - "support_top_z_distance": "0.2", - "support_interface_loop_pattern": "0", - "support_interface_top_layers": "2", - "support_interface_spacing": "0.5", - "support_interface_speed": "80", - "support_interface_pattern": "auto", - "support_base_pattern": "default", - "support_base_pattern_spacing": "2.5", - "support_speed": "150", - "support_threshold_angle": "30", - "support_object_xy_distance": "0.35", - "skirt_loops": "0", - "support_type": "normal(auto)", - "support_style": "default", - "support_bottom_z_distance": "0.2", - "support_interface_bottom_layers": "2", - "support_expansion": "0", - "top_surface_line_width": "0.62", - "top_surface_speed": "150", - "travel_speed": "500", - "tree_support_branch_diameter": "2", - "tree_support_branch_angle": "45", - "tree_support_wall_count": "1", - "top_surface_pattern": "monotonicline", - "top_surface_acceleration": "2000", - "top_shell_layers": "3", - "top_shell_thickness": "0.8", - "wall_loops": "2", - "wall_infill_order": "inner wall/outer wall/infill", - "wipe_tower_no_sparse_layers": "0", - "wall_generator": "classic", - "xy_hole_compensation": "0", - "xy_contour_compensation": "0", - "compatible_printers": [] -} \ No newline at end of file diff --git a/resources/profiles_template/Template/process/process_0.8_nozzle_template.json b/resources/profiles_template/Template/process/process_0.8_nozzle_template.json deleted file mode 100644 index c83558c26..000000000 --- a/resources/profiles_template/Template/process/process_0.8_nozzle_template.json +++ /dev/null @@ -1,109 +0,0 @@ -{ - "type": "process", - "name": "process_0.8_nozzle_template", - "instantiation": "false", - "adaptive_layer_height": "0", - "bridge_flow": "1", - "bridge_speed": "30", - "brim_width": "5", - "bridge_no_support": "0", - "bottom_surface_pattern": "monotonic", - "bottom_shell_layers": "3", - "bottom_shell_thickness": "0", - "brim_object_gap": "0.1", - "compatible_printers_condition": "", - "default_acceleration": "10000", - "detect_overhang_wall": "1", - "detect_thin_wall": "0", - "draft_shield": "disabled", - "elefant_foot_compensation": "0", - "enable_support": "0", - "enable_prime_tower": "1", - "enable_arc_fitting": "1", - "filename_format": "{input_filename_base}_{filament_type[0]}_{print_time}.gcode", - "gap_infill_speed": "50", - "infill_direction": "45", - "initial_layer_line_width": "0.82", - "initial_layer_print_height": "0.4", - "initial_layer_speed": "35", - "infill_combination": "0", - "infill_wall_overlap": "15%", - "interface_shells": "0", - "inner_wall_line_width": "0.82", - "inner_wall_speed": "150", - "internal_solid_infill_line_width": "0.82", - "internal_solid_infill_speed": "150", - "internal_bridge_support_thickness": "0.8", - "initial_layer_acceleration": "500", - "ironing_flow": "10%", - "ironing_spacing": "0.15", - "ironing_speed": "30", - "ironing_type": "no ironing", - "initial_layer_infill_speed": "55", - "line_width": "0.82", - "layer_height": "0.4", - "minimum_sparse_infill_area": "15", - "max_travel_detour_distance": "0", - "outer_wall_line_width": "0.82", - "outer_wall_speed": "120", - "outer_wall_acceleration": "5000", - "overhang_1_4_speed": "0", - "overhang_2_4_speed": "50", - "overhang_3_4_speed": "25", - "overhang_4_4_speed": "5", - "only_one_wall_top": "1", - "print_sequence": "by layer", - "print_settings_id": "", - "prime_tower_width": "35", - "reduce_crossing_wall": "0", - "reduce_infill_retraction": "1", - "raft_layers": "0", - "resolution": "0.012", - "sparse_infill_density": "15%", - "sparse_infill_pattern": "grid", - "sparse_infill_line_width": "0.82", - "sparse_infill_speed": "100", - "seam_position": "aligned", - "skirt_distance": "2", - "skirt_height": "1", - "spiral_mode": "0", - "standby_temperature_delta": "-5", - "support_filament": "0", - "support_line_width": "0.82", - "support_interface_filament": "0", - "support_on_build_plate_only": "0", - "support_top_z_distance": "0.2", - "support_interface_loop_pattern": "0", - "support_interface_top_layers": "2", - "support_interface_spacing": "0.5", - "support_interface_speed": "80", - "support_interface_pattern": "auto", - "support_base_pattern": "default", - "support_base_pattern_spacing": "2.5", - "support_speed": "150", - "support_threshold_angle": "30", - "support_object_xy_distance": "0.35", - "skirt_loops": "0", - "support_type": "normal(auto)", - "support_style": "default", - "support_bottom_z_distance": "0.2", - "support_interface_bottom_layers": "2", - "support_expansion": "0", - "top_surface_line_width": "0.82", - "top_surface_speed": "150", - "travel_speed": "500", - "tree_support_branch_diameter": "2", - "tree_support_branch_angle": "45", - "tree_support_wall_count": "1", - "top_surface_pattern": "monotonic", - "top_surface_acceleration": "2000", - "top_shell_layers": "3", - "top_shell_thickness": "0.8", - "wall_loops": "2", - "wall_infill_order": "inner wall/outer wall/infill", - "wipe_tower_no_sparse_layers": "0", - "wall_generator": "classic", - "xy_hole_compensation": "0", - "xy_contour_compensation": "0", - "compatible_printers": [] -} \ No newline at end of file diff --git a/src/slic3r/GUI/CreatePresetsDialog.cpp b/src/slic3r/GUI/CreatePresetsDialog.cpp index b26d0cbf8..e7b4f582a 100644 --- a/src/slic3r/GUI/CreatePresetsDialog.cpp +++ b/src/slic3r/GUI/CreatePresetsDialog.cpp @@ -1978,6 +1978,94 @@ bool CreatePrinterPresetDialog::load_system_and_user_presets_with_curr_model(Pre return true; } +void CreatePrinterPresetDialog::generate_process_presets_data(std::vector presets, std::string nozzle) +{ + BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << " entry, and nozzle is: " << nozzle; + std::unordered_map nozzle_diameter_map_ = nozzle_diameter_map; + for (const Preset *preset : presets) { + float nozzle_dia = nozzle_diameter_map_[nozzle]; + assert(nozzle_dia != 0); + + auto layer_height = dynamic_cast(const_cast(preset)->config.option("layer_height", true)); + if (layer_height) + layer_height->value = nozzle_dia / 2; + else + BOOST_LOG_TRIVIAL(info) << "process template has no layer_height"; + + auto initial_layer_print_height = dynamic_cast(const_cast(preset)->config.option("initial_layer_print_height", true)); + if (initial_layer_print_height) + initial_layer_print_height->value = nozzle_dia / 2; + else + BOOST_LOG_TRIVIAL(info) << "process template has no initial_layer_print_height"; + + auto line_width = dynamic_cast(const_cast(preset)->config.option("line_width", true)); + if (line_width) + line_width->value = nozzle_dia; + else + BOOST_LOG_TRIVIAL(info) << "process template has no line_width"; + + auto initial_layer_line_width = dynamic_cast(const_cast(preset)->config.option("initial_layer_line_width", true)); + if (initial_layer_line_width) + initial_layer_line_width->value = nozzle_dia; + else + BOOST_LOG_TRIVIAL(info) << "process template has no initial_layer_line_width"; + + auto outer_wall_line_width = dynamic_cast(const_cast(preset)->config.option("outer_wall_line_width", true)); + if (outer_wall_line_width) + outer_wall_line_width->value = nozzle_dia; + else + BOOST_LOG_TRIVIAL(info) << "process template has no outer_wall_line_width"; + + auto inner_wall_line_width = dynamic_cast(const_cast(preset)->config.option("inner_wall_line_width", true)); + if (inner_wall_line_width) + inner_wall_line_width->value = nozzle_dia; + else + BOOST_LOG_TRIVIAL(info) << "process template has no inner_wall_line_width"; + + auto top_surface_line_width = dynamic_cast(const_cast(preset)->config.option("top_surface_line_width", true)); + if (top_surface_line_width) + top_surface_line_width->value = nozzle_dia; + else + BOOST_LOG_TRIVIAL(info) << "process template has no top_surface_line_width"; + + auto sparse_infill_line_width = dynamic_cast(const_cast(preset)->config.option("sparse_infill_line_width", true)); + if (sparse_infill_line_width) + sparse_infill_line_width->value = nozzle_dia; + else + BOOST_LOG_TRIVIAL(info) << "process template has no sparse_infill_line_width"; + + auto internal_solid_infill_line_width = dynamic_cast(const_cast(preset)->config.option("internal_solid_infill_line_width", true)); + if (internal_solid_infill_line_width) + internal_solid_infill_line_width->value = nozzle_dia; + else + BOOST_LOG_TRIVIAL(info) << "process template has no internal_solid_infill_line_width"; + + auto support_line_width = dynamic_cast(const_cast(preset)->config.option("support_line_width", true)); + if (support_line_width) + support_line_width->value = nozzle_dia; + else + BOOST_LOG_TRIVIAL(info) << "process template has no support_line_width"; + + auto wall_loops = dynamic_cast(const_cast(preset)->config.option("wall_loops", true)); + if (wall_loops) + wall_loops->value = std::max(2, (int) std::ceil(2 * 0.4 / nozzle_dia)); + else + BOOST_LOG_TRIVIAL(info) << "process template has no wall_loops"; + + auto top_shell_layers = dynamic_cast(const_cast(preset)->config.option("top_shell_layers", true)); + if (top_shell_layers) + top_shell_layers->value = std::max(5, (int) std::ceil(5 * 0.4 / nozzle_dia)); + else + BOOST_LOG_TRIVIAL(info) << "process template has no top_shell_layers"; + + auto bottom_shell_layers = dynamic_cast(const_cast(preset)->config.option("bottom_shell_layers", true)); + if (bottom_shell_layers) + bottom_shell_layers->value = std::max(3, (int) std::ceil(3 * 0.4 / nozzle_dia)); + else + BOOST_LOG_TRIVIAL(info) << "process template has no bottom_shell_layers"; + } +} + wxBoxSizer *CreatePrinterPresetDialog::create_radio_item(wxString title, wxWindow *parent, wxString tooltip, std::vector> &radiobox_list) { wxBoxSizer *horizontal_sizer = new wxBoxSizer(wxHORIZONTAL); @@ -2396,7 +2484,9 @@ wxBoxSizer *CreatePrinterPresetDialog::create_page2_btns_item(wxWindow *parent) /****************************** clone process preset ********************************/ failures.clear(); if (!selected_process_presets.empty()) { - bool create_preset_result = preset_bundle->prints.create_presets_from_template_for_printer(selected_process_presets, failures, printer_preset_name, get_filament_id, rewritten); + generate_process_presets_data(selected_process_presets, nozzle_diameter); + bool create_preset_result = preset_bundle->prints.create_presets_from_template_for_printer(selected_process_presets, failures, printer_preset_name, + get_filament_id, rewritten); if (!create_preset_result) { std::string message; for (const std::string &failure : failures) { message += "\t" + failure + "\n"; } @@ -2941,7 +3031,7 @@ CreatePresetSuccessfulDialog::CreatePresetSuccessfulDialog(wxWindow *parent, con m_button_ok->Bind(wxEVT_LEFT_DOWN, [this](wxMouseEvent &e) { EndModal(wxID_OK); }); if (PRINTER == create_success_type) { - m_button_cancel = new Button(this, _L("Cancle")); + m_button_cancel = new Button(this, _L("Cancel")); m_button_cancel->SetBackgroundColor(btn_bg_white); m_button_cancel->SetBorderColor(wxColour(38, 46, 48)); m_button_cancel->SetTextColor(wxColour(38, 46, 48)); diff --git a/src/slic3r/GUI/CreatePresetsDialog.hpp b/src/slic3r/GUI/CreatePresetsDialog.hpp index 710e6143d..674e29025 100644 --- a/src/slic3r/GUI/CreatePresetsDialog.hpp +++ b/src/slic3r/GUI/CreatePresetsDialog.hpp @@ -142,6 +142,7 @@ protected: void load_texture(); void load_model_stl(); bool load_system_and_user_presets_with_curr_model(PresetBundle &temp_preset_bundle, bool just_template = false); + void generate_process_presets_data(std::vector presets, std::string nozzle); wxArrayString printer_preset_sort_with_nozzle_diameter(const VendorProfile &vendor_profile, float nozzle_diameter); wxBoxSizer *create_radio_item(wxString title, wxWindow *parent, wxString tooltip, std::vector> &radiobox_list); diff --git a/src/slic3r/GUI/Plater.cpp b/src/slic3r/GUI/Plater.cpp index fe742ad2b..7f63dca1c 100644 --- a/src/slic3r/GUI/Plater.cpp +++ b/src/slic3r/GUI/Plater.cpp @@ -994,11 +994,7 @@ void Sidebar::create_printer_preset() if (wxID_OK == res) { wxGetApp().mainframe->update_side_preset_ui(); update_all_preset_comboboxes(); - Tab *printer_tab = wxGetApp().get_tab(Preset::TYPE_PRINTER); - if (printer_tab) { - printer_tab->load_current_preset(); - printer_tab->update(); - } + wxGetApp().load_current_presets(); CreatePresetSuccessfulDialog success_dlg(p->m_panel_filament_title, SuccessType::PRINTER); int res = success_dlg.ShowModal(); if (res == wxID_OK) {