diff --git a/src/libslic3r/GCode.cpp b/src/libslic3r/GCode.cpp index cdeaa1f159..c46de72179 100644 --- a/src/libslic3r/GCode.cpp +++ b/src/libslic3r/GCode.cpp @@ -272,11 +272,22 @@ static std::vector get_path_of_change_filament(const Print& print) gcode += gcodegen.writer().travel_to_xy(unscale(standby_point), "move to standby position"); } + unsigned int extruder_id = gcodegen.writer().extruder()->id(); + const ConfigOptionInts& filament_idle_temp = gcodegen.config().idle_temperature; - if (gcodegen.config().standby_temperature_delta.value != 0) { - // we assume that heating is always slower than cooling, so no need to block - gcode += gcodegen.writer().set_temperature - (this->_get_temp(gcodegen) + gcodegen.config().standby_temperature_delta.value, false, gcodegen.writer().extruder()->id()); + if (filament_idle_temp.get_at(extruder_id) == 0) { + if (gcodegen.config().standby_temperature_delta.value != 0) { + // we assume that heating is always slower than cooling, so no need to block + gcode += gcodegen.writer().set_temperature(this->_get_temp(gcodegen) + gcodegen.config().standby_temperature_delta.value, + false, gcodegen.writer().extruder()->id()); + gcode.pop_back(); + gcode += " ;cooldown\n"; // this is a marker for GCodeProcessor, so it can supress the commands when needed + } + } else { + // Use the value from filament settings. That one is absolute, not delta. + gcode += gcodegen.writer().set_temperature(filament_idle_temp.get_at(extruder_id), false, extruder_id); + gcode.pop_back(); + gcode += " ;cooldown\n"; // this is a marker for GCodeProcessor, so it can supress the commands when needed } return gcode; @@ -2261,6 +2272,8 @@ void GCode::_do_export(Print& print, GCodeOutputStream &file, ThumbnailsGenerato this->placeholder_parser().set("has_wipe_tower", has_wipe_tower); //this->placeholder_parser().set("has_single_extruder_multi_material_priming", has_wipe_tower && print.config().single_extruder_multi_material_priming); this->placeholder_parser().set("total_toolchanges", std::max(0, print.wipe_tower_data().number_of_toolchanges)); // Check for negative toolchanges (single extruder mode) and set to 0 (no tool change). + this->placeholder_parser().set("num_extruders", int(print.config().nozzle_diameter.values.size())); + this->placeholder_parser().set("retract_length", new ConfigOptionFloats(print.config().retraction_length)); // PlaceholderParser currently substitues non-existent vector values with the zero'th value, which is harmful in the // case of "is_extruder_used[]" as Slicer may lie about availability of such non-existent extruder. We rather @@ -3255,8 +3268,12 @@ void GCode::_print_first_layer_extruder_temperatures(GCodeOutputStream &file, Pr // Set temperatures of all the printing extruders. for (unsigned int tool_id : print.extruders()) { int temp = print.config().nozzle_temperature_initial_layer.get_at(tool_id); - if (print.config().ooze_prevention.value) - temp += print.config().standby_temperature_delta.value; + if (print.config().ooze_prevention.value) { + if (print.config().idle_temperature.get_at(tool_id) == 0) + temp += print.config().standby_temperature_delta.value; + else + temp = print.config().idle_temperature.get_at(tool_id); + } if (temp > 0) file.write(m_writer.set_temperature(temp, wait, tool_id)); } @@ -6016,15 +6033,22 @@ std::string GCode::set_extruder(unsigned int extruder_id, double print_z, bool b // if we are running a single-extruder setup, just set the extruder and return nothing if (!m_writer.multiple_extruders) { this->placeholder_parser().set("current_extruder", extruder_id); - this->placeholder_parser().set("retraction_distance_when_cut", m_config.retraction_distances_when_cut.get_at(extruder_id)); - this->placeholder_parser().set("long_retraction_when_cut", m_config.long_retractions_when_cut.get_at(extruder_id)); std::string gcode; // Append the filament start G-code. const std::string &filament_start_gcode = m_config.filament_start_gcode.get_at(extruder_id); if (! filament_start_gcode.empty()) { // Process the filament_start_gcode for the filament. - gcode += this->placeholder_parser_process("filament_start_gcode", filament_start_gcode, extruder_id); + DynamicConfig config; + config.set_key_value("layer_num", new ConfigOptionInt(m_layer_index)); + config.set_key_value("layer_z", new ConfigOptionFloat(this->writer().get_position().z() - m_config.z_offset.value)); + config.set_key_value("max_layer_z", new ConfigOptionFloat(m_max_layer_z)); + config.set_key_value("filament_extruder_id", new ConfigOptionInt(int(extruder_id))); + config.set_key_value("retraction_distance_when_cut", + new ConfigOptionFloat(m_config.retraction_distances_when_cut.get_at(extruder_id))); + config.set_key_value("long_retraction_when_cut", new ConfigOptionBool(m_config.long_retractions_when_cut.get_at(extruder_id))); + + gcode += this->placeholder_parser_process("filament_start_gcode", filament_start_gcode, extruder_id, &config); check_add_eol(gcode); } if (m_config.enable_pressure_advance.get_at(extruder_id)) { @@ -6054,7 +6078,12 @@ std::string GCode::set_extruder(unsigned int extruder_id, double print_z, bool b unsigned int old_extruder_id = m_writer.extruder()->id(); const std::string &filament_end_gcode = m_config.filament_end_gcode.get_at(old_extruder_id); if (! filament_end_gcode.empty()) { - gcode += placeholder_parser_process("filament_end_gcode", filament_end_gcode, old_extruder_id); + DynamicConfig config; + config.set_key_value("layer_num", new ConfigOptionInt(m_layer_index)); + config.set_key_value("layer_z", new ConfigOptionFloat(m_writer.get_position().z() - m_config.z_offset.value)); + config.set_key_value("max_layer_z", new ConfigOptionFloat(m_max_layer_z)); + config.set_key_value("filament_extruder_id", new ConfigOptionInt(int(old_extruder_id))); + gcode += placeholder_parser_process("filament_end_gcode", filament_end_gcode, old_extruder_id, &config); check_add_eol(gcode); } } @@ -6166,6 +6195,14 @@ std::string GCode::set_extruder(unsigned int extruder_id, double print_z, bool b std::string toolchange_gcode_parsed; //Orca: Ignore change_filament_gcode if is the first call for a tool change and manual_filament_change is enabled if (!change_filament_gcode.empty() && !(m_config.manual_filament_change.value && m_toolchange_count == 1)) { + dyn_config.set_key_value("previous_extruder", + new ConfigOptionInt((int) (m_writer.extruder() != nullptr ? m_writer.extruder()->id() : -1))); + dyn_config.set_key_value("next_extruder", new ConfigOptionInt((int) extruder_id)); + dyn_config.set_key_value("layer_num", new ConfigOptionInt(m_layer_index)); + dyn_config.set_key_value("layer_z", new ConfigOptionFloat(print_z)); + dyn_config.set_key_value("toolchange_z", new ConfigOptionFloat(print_z)); + dyn_config.set_key_value("max_layer_z", new ConfigOptionFloat(m_max_layer_z)); + toolchange_gcode_parsed = placeholder_parser_process("change_filament_gcode", change_filament_gcode, extruder_id, &dyn_config); check_add_eol(toolchange_gcode_parsed); gcode += toolchange_gcode_parsed; @@ -6216,7 +6253,12 @@ std::string GCode::set_extruder(unsigned int extruder_id, double print_z, bool b const std::string &filament_start_gcode = m_config.filament_start_gcode.get_at(extruder_id); if (! filament_start_gcode.empty()) { // Process the filament_start_gcode for the new filament. - gcode += this->placeholder_parser_process("filament_start_gcode", filament_start_gcode, extruder_id); + DynamicConfig config; + config.set_key_value("layer_num", new ConfigOptionInt(m_layer_index)); + config.set_key_value("layer_z", new ConfigOptionFloat(this->writer().get_position().z() - m_config.z_offset.value)); + config.set_key_value("max_layer_z", new ConfigOptionFloat(m_max_layer_z)); + config.set_key_value("filament_extruder_id", new ConfigOptionInt(int(extruder_id))); + gcode += this->placeholder_parser_process("filament_start_gcode", filament_start_gcode, extruder_id, &config); check_add_eol(gcode); } // Set the new extruder to the operating temperature. diff --git a/src/libslic3r/Preset.cpp b/src/libslic3r/Preset.cpp index 05c34446b6..724bdc148e 100644 --- a/src/libslic3r/Preset.cpp +++ b/src/libslic3r/Preset.cpp @@ -809,7 +809,7 @@ static std::vector s_Preset_print_options { "tree_support_brim_width", "gcode_comments", "gcode_label_objects", "initial_layer_travel_speed", "exclude_object", "slow_down_layers", "infill_anchor", "infill_anchor_max","initial_layer_min_bead_width", "make_overhang_printable", "make_overhang_printable_angle", "make_overhang_printable_hole_size" ,"notes", - "wipe_tower_cone_angle", "wipe_tower_extra_spacing","wipe_tower_max_purge_speed", "wipe_tower_extruder", "wiping_volumes_extruders","wipe_tower_bridging", "single_extruder_multi_material_priming", + "wipe_tower_cone_angle", "wipe_tower_extra_spacing","wipe_tower_max_purge_speed", "wipe_tower_filament", "wiping_volumes_extruders","wipe_tower_bridging", "single_extruder_multi_material_priming", "wipe_tower_rotation_angle", "tree_support_branch_distance_organic", "tree_support_branch_diameter_organic", "tree_support_branch_angle_organic", "hole_to_polyhole", "hole_to_polyhole_threshold", "hole_to_polyhole_twisted", "mmu_segmented_region_max_width", "mmu_segmented_region_interlocking_depth", "small_area_infill_flow_compensation", "small_area_infill_flow_compensation_model", @@ -845,7 +845,7 @@ static std::vector s_Preset_filament_options { "filament_unloading_speed", "filament_unloading_speed_start", "filament_unload_time", "filament_toolchange_delay", "filament_cooling_moves", "filament_cooling_initial_speed", "filament_cooling_final_speed", "filament_ramming_parameters", "filament_multitool_ramming", "filament_multitool_ramming_volume", "filament_multitool_ramming_flow", "activate_chamber_temp_control", - "filament_long_retractions_when_cut","filament_retraction_distances_when_cut" + "filament_long_retractions_when_cut","filament_retraction_distances_when_cut", "idle_temperature" }; static std::vector s_Preset_machine_limits_options { diff --git a/src/libslic3r/Print.cpp b/src/libslic3r/Print.cpp index 43755c8ade..5e5f4bf284 100644 --- a/src/libslic3r/Print.cpp +++ b/src/libslic3r/Print.cpp @@ -284,10 +284,11 @@ bool Print::invalidate_state_by_config_options(const ConfigOptionResolver & /* n || opt_key == "initial_layer_speed" || opt_key == "initial_layer_travel_speed" || opt_key == "slow_down_layers" + || opt_key == "idle_temperature" || opt_key == "wipe_tower_cone_angle" || opt_key == "wipe_tower_extra_spacing" || opt_key == "wipe_tower_max_purge_speed" - || opt_key == "wipe_tower_extruder" + || opt_key == "wipe_tower_filament" || opt_key == "wiping_volumes_extruders" || opt_key == "enable_filament_ramming" || opt_key == "purge_in_prime_tower" @@ -1148,9 +1149,12 @@ StringObjectException Print::validate(StringObjectException *warning, Polygons* double nozzle_diam = m_config.nozzle_diameter.get_at(extruder_idx); double filament_diam = m_config.filament_diameter.get_at(extruder_idx); if (nozzle_diam - EPSILON > first_nozzle_diam || nozzle_diam + EPSILON < first_nozzle_diam - || std::abs((filament_diam - first_filament_diam) / first_filament_diam) > 0.1) - // BBS: remove L() - return { L("Different nozzle diameters and different filament diameters is not allowed when prime tower is enabled.") }; + || std::abs((filament_diam - first_filament_diam) / first_filament_diam) > 0.1) { + // return { L("Different nozzle diameters and different filament diameters may not work well when prime tower is enabled. It's very experimental, please proceed with caucious.") }; + warning->string = L("Different nozzle diameters and different filament diameters may not work well when the prime tower is enabled. It's very experimental, so please proceed with caution."); + warning->opt_key = "nozzle_diameter"; + break; + } } if (! m_config.use_relative_e_distances) @@ -2820,6 +2824,7 @@ std::string Print::output_filename(const std::string &filename_base) const // These values will be just propagated into the output file name. DynamicConfig config = this->finished() ? this->print_statistics().config() : this->print_statistics().placeholders(); config.set_key_value("num_filaments", new ConfigOptionInt((int)m_config.nozzle_diameter.size())); + config.set_key_value("num_extruders", new ConfigOptionInt((int) m_config.nozzle_diameter.size())); config.set_key_value("plate_name", new ConfigOptionString(get_plate_name())); config.set_key_value("plate_number", new ConfigOptionString(get_plate_number_formatted())); config.set_key_value("model_name", new ConfigOptionString(get_model_name())); diff --git a/src/libslic3r/PrintConfig.cpp b/src/libslic3r/PrintConfig.cpp index 1dc18c1711..2c3798dd08 100644 --- a/src/libslic3r/PrintConfig.cpp +++ b/src/libslic3r/PrintConfig.cpp @@ -2800,11 +2800,10 @@ void PrintConfigDef::init_fff_params() def = this->add("mmu_segmented_region_interlocking_depth", coFloat); def->label = L("Interlocking depth of a segmented region"); - //def->tooltip = L("Interlocking depth of a segmented region. It will be ignored if " - // "\"mmu_segmented_region_max_width\" is zero or if \"mmu_segmented_region_interlocking_depth\"" - // "is bigger then \"mmu_segmented_region_max_width\". Zero disables this feature."); - def->tooltip = L("Interlocking depth of a segmented region. Zero disables this feature."); - def->sidetext = L("mm"); //(zero to disable) + def->tooltip = L("Interlocking depth of a segmented region. It will be ignored if " + "\"mmu_segmented_region_max_width\" is zero or if \"mmu_segmented_region_interlocking_depth\"" + "is bigger then \"mmu_segmented_region_max_width\". Zero disables this feature."); + def->sidetext = L("mm"); def->min = 0; def->category = L("Advanced"); def->mode = comAdvanced; @@ -3398,7 +3397,7 @@ void PrintConfigDef::init_fff_params() def->category = "Extruders"; def->tooltip = "Filament to print walls"; def->min = 1; - def->mode = comDevelop; + def->mode = comAdvanced; def->set_default_value(new ConfigOptionInt(1)); def = this->add("inner_wall_line_width", coFloatOrPercent); @@ -4061,12 +4060,13 @@ void PrintConfigDef::init_fff_params() def = this->add("standby_temperature_delta", coInt); def->label = L("Temperature variation"); - //def->tooltip = L("Temperature difference to be applied when an extruder is not active. " - // "Enables a full-height \"sacrificial\" skirt on which the nozzles are periodically wiped."); + // TRN PrintSettings : "Ooze prevention" > "Temperature variation" + def->tooltip = L("Temperature difference to be applied when an extruder is not active. " + "The value is not used when 'idle_temperature' in filament settings " + "is defined."); def->sidetext = "∆°C"; def->min = -max_temp; def->max = max_temp; - //BBS def->mode = comDevelop; def->set_default_value(new ConfigOptionInt(-5)); @@ -4092,7 +4092,6 @@ void PrintConfigDef::init_fff_params() def->label = L("Single Extruder Multi Material"); def->tooltip = L("Use single nozzle to print multi filament"); def->mode = comAdvanced; - def->readonly = true; def->set_default_value(new ConfigOptionBool(true)); def = this->add("manual_filament_change", coBool); @@ -4913,8 +4912,8 @@ void PrintConfigDef::init_fff_params() def->min = 10; def->set_default_value(new ConfigOptionFloat(90.)); - def = this->add("wipe_tower_extruder", coInt); - def->label = L("Wipe tower extruder"); + def = this->add("wipe_tower_filament", coInt); + def->label = L("Wipe tower"); def->category = L("Extruders"); def->tooltip = L("The extruder to use when printing perimeter of the wipe tower. " "Set to 0 to use the one that is available (non-soluble would be preferred)."); @@ -4961,6 +4960,15 @@ void PrintConfigDef::init_fff_params() def->mode = comAdvanced; def->set_default_value(new ConfigOptionFloat(10.)); + def = this->add("idle_temperature", coInts); + def->label = L("Idle temperature"); + def->tooltip = L("Nozzle temperature when the tool is currently not used in multi-tool setups." + "This is only used when 'Ooze prevention' is active in Print Settings. Set to 0 to disable."); + def->sidetext = L("°C"); + def->min = 0; + def->max = max_temp; + def->set_default_value(new ConfigOptionInts{0}); + def = this->add("xy_hole_compensation", coFloat); def->label = L("X-Y hole compensation"); def->category = L("Quality"); @@ -5921,7 +5929,9 @@ void PrintConfigDef::handle_legacy(t_config_option_key &opt_key, std::string &va opt_key = "solid_infill_filament"; }else if (opt_key == "perimeter_extruder") { opt_key = "wall_filament"; - } else if (opt_key == "support_material_extruder") { + }else if(opt_key == "wipe_tower_extruder") { + opt_key = "wipe_tower_filament"; + }else if (opt_key == "support_material_extruder") { opt_key = "support_filament"; } else if (opt_key == "support_material_interface_extruder") { opt_key = "support_interface_filament"; @@ -5988,8 +5998,6 @@ void PrintConfigDef::handle_legacy(t_config_option_key &opt_key, std::string &va } else { opt_key = "wall_sequence"; } - } else if(opt_key == "single_extruder_multi_material") { - value = "1"; } else if(opt_key == "ensure_vertical_shell_thickness") { if(value == "1") { @@ -7243,10 +7251,9 @@ ReadWriteSlicingStatesConfigDef::ReadWriteSlicingStatesConfigDef() def->label = L("Extra deretraction"); def->tooltip = L("Currently planned extra extruder priming after deretraction."); - // Options from PS not used in Orca -// def = this->add("e_position", coFloats); -// def->label = L("Absolute E position"); -// def->tooltip = L("Current position of the extruder axis. Only used with absolute extruder addressing."); + def = this->add("e_position", coFloats); + def->label = L("Absolute E position"); + def->tooltip = L("Current position of the extruder axis. Only used with absolute extruder addressing."); } OtherSlicingStatesConfigDef::OtherSlicingStatesConfigDef() @@ -7488,10 +7495,9 @@ OtherPresetsConfigDef::OtherPresetsConfigDef() def->label = L("Physical printer name"); def->tooltip = L("Name of the physical printer used for slicing."); - // Options from PS not used in Orca - // def = this->add("num_extruders", coInt); - // def->label = L("Number of extruders"); - // def->tooltip = L("Total number of extruders, regardless of whether they are used in the current print."); + def = this->add("num_extruders", coInt); + def->label = L("Number of extruders"); + def->tooltip = L("Total number of extruders, regardless of whether they are used in the current print."); } diff --git a/src/libslic3r/PrintConfig.hpp b/src/libslic3r/PrintConfig.hpp index 67cdfef999..3401423eb4 100644 --- a/src/libslic3r/PrintConfig.hpp +++ b/src/libslic3r/PrintConfig.hpp @@ -1244,9 +1244,11 @@ PRINT_CONFIG_CLASS_DERIVED_DEFINE( // Orca: mmu support ((ConfigOptionFloat, wipe_tower_cone_angle)) ((ConfigOptionPercent, wipe_tower_extra_spacing)) - ((ConfigOptionFloat, wipe_tower_max_purge_speed)) - ((ConfigOptionInt, wipe_tower_extruder)) + ((ConfigOptionFloat, wipe_tower_max_purge_speed)) + ((ConfigOptionInt, wipe_tower_filament)) ((ConfigOptionFloats, wiping_volumes_extruders)) + ((ConfigOptionInts, idle_temperature)) + // BBS: wipe tower is only used for priming ((ConfigOptionFloat, prime_volume)) diff --git a/src/libslic3r/PrintObject.cpp b/src/libslic3r/PrintObject.cpp index 907cc9c248..6112159585 100644 --- a/src/libslic3r/PrintObject.cpp +++ b/src/libslic3r/PrintObject.cpp @@ -2888,7 +2888,7 @@ static void apply_to_print_region_config(PrintRegionConfig &out, const DynamicPr // 1) Copy the "extruder key to sparse_infill_filament and wall_filament. auto *opt_extruder = in.opt(key_extruder); if (opt_extruder) - if (int extruder = opt_extruder->value; extruder != 0) { + if (int extruder = opt_extruder->value; extruder != 1) { // Not a default extruder. out.sparse_infill_filament .value = extruder; out.solid_infill_filament.value = extruder; diff --git a/src/slic3r/GUI/ConfigManipulation.cpp b/src/slic3r/GUI/ConfigManipulation.cpp index 52d1ea99a6..be5bb65a51 100644 --- a/src/slic3r/GUI/ConfigManipulation.cpp +++ b/src/slic3r/GUI/ConfigManipulation.cpp @@ -675,7 +675,7 @@ void ConfigManipulation::toggle_print_fff_options(DynamicPrintConfig *config, co bool purge_in_primetower = preset_bundle->printers.get_edited_preset().config.opt_bool("purge_in_prime_tower"); - for (auto el : {"wipe_tower_rotation_angle", "wipe_tower_cone_angle", "wipe_tower_extra_spacing", "wipe_tower_max_purge_speed", "wipe_tower_bridging", "wipe_tower_no_sparse_layers"}) + for (auto el : {"wipe_tower_rotation_angle", "wipe_tower_cone_angle", "wipe_tower_extra_spacing", "wipe_tower_max_purge_speed", "wipe_tower_bridging", "wipe_tower_no_sparse_layers", "single_extruder_multi_material_priming"}) toggle_line(el, have_prime_tower && purge_in_primetower); toggle_line("prime_volume",have_prime_tower && !purge_in_primetower); diff --git a/src/slic3r/GUI/GUI_App.cpp b/src/slic3r/GUI/GUI_App.cpp index 842909985b..19a4d42c4a 100644 --- a/src/slic3r/GUI/GUI_App.cpp +++ b/src/slic3r/GUI/GUI_App.cpp @@ -3982,16 +3982,18 @@ void GUI_App::on_http_error(wxCommandEvent &evt) wxString result; if (status >= 400 && status < 500) { try { - json j = json::parse(evt.GetString()); - if (j.contains("code")) { - if (!j["code"].is_null()) - code = j["code"].get(); + auto evt_str = evt.GetString(); + if (!evt_str.empty()) { + json j = json::parse(evt_str); + if (j.contains("code")) { + if (!j["code"].is_null()) + code = j["code"].get(); + } + if (j.contains("error")) + if (!j["error"].is_null()) + error = j["error"].get(); } - if (j.contains("error")) - if (!j["error"].is_null()) - error = j["error"].get(); - } - catch (...) {} + } catch (...) {} } // Version limit diff --git a/src/slic3r/GUI/Plater.cpp b/src/slic3r/GUI/Plater.cpp index b3bcfb2f7f..0b63afd342 100644 --- a/src/slic3r/GUI/Plater.cpp +++ b/src/slic3r/GUI/Plater.cpp @@ -1224,6 +1224,8 @@ void Sidebar::update_all_preset_comboboxes() p->m_filament_icon->SetBitmap_("filament"); } + show_add_del_filament_button(cfg.opt_bool("single_extruder_multi_material")); + //p->m_staticText_filament_settings->Update(); @@ -1327,6 +1329,7 @@ void Sidebar::update_presets(Preset::Type preset_type) /* update bed shape */ Tab* printer_tab = wxGetApp().get_tab(Preset::TYPE_PRINTER); if (printer_tab) { + printer_tab->on_preset_loaded(); printer_tab->update(); } @@ -1786,6 +1789,15 @@ void Sidebar::sync_ams_list() Layout(); } +void Sidebar::show_add_del_filament_button(bool bshow) +{ + if(p->m_bpButton_add_filament) + p->m_bpButton_add_filament->Show(bshow); + if(p->m_bpButton_del_filament) + p->m_bpButton_del_filament->Show(bshow); + Layout(); +} + ObjectList* Sidebar::obj_list() { // BBS @@ -2703,7 +2715,7 @@ Plater::priv::priv(Plater *q, MainFrame *main_frame) "brim_width", "wall_loops", "wall_filament", "sparse_infill_density", "sparse_infill_filament", "top_shell_layers", "enable_support", "support_filament", "support_interface_filament", "support_top_z_distance", "support_bottom_z_distance", "raft_layers", - "wipe_tower_rotation_angle", "wipe_tower_cone_angle", "wipe_tower_extra_spacing","wipe_tower_max_purge_speed", "wipe_tower_extruder", + "wipe_tower_rotation_angle", "wipe_tower_cone_angle", "wipe_tower_extra_spacing","wipe_tower_max_purge_speed", "wipe_tower_filament", "best_object_pos" })) , sidebar(new Sidebar(q)) diff --git a/src/slic3r/GUI/Plater.hpp b/src/slic3r/GUI/Plater.hpp index bda2ab6110..95a08c1827 100644 --- a/src/slic3r/GUI/Plater.hpp +++ b/src/slic3r/GUI/Plater.hpp @@ -148,6 +148,8 @@ public: void load_ams_list(std::string const & device, MachineObject* obj); std::map build_filament_ams_list(MachineObject* obj); void sync_ams_list(); + // Orca + void show_add_del_filament_button(bool bshow); ObjectList* obj_list(); ObjectSettings* obj_settings(); diff --git a/src/slic3r/GUI/Tab.cpp b/src/slic3r/GUI/Tab.cpp index 6db2ff4c37..163b9b7d51 100644 --- a/src/slic3r/GUI/Tab.cpp +++ b/src/slic3r/GUI/Tab.cpp @@ -27,6 +27,7 @@ #include #include #include "libslic3r/libslic3r.h" +#include "slic3r/GUI/OptionsGroup.hpp" #include "wxExtensions.hpp" #include "PresetComboBoxes.hpp" #include @@ -1431,8 +1432,8 @@ void Tab::on_value_change(const std::string& opt_key, const boost::any& value) } - if (opt_key == "single_extruder_multi_material" || opt_key == "extruders_count" ) - update_wiping_button_visibility(); + if (opt_key == "single_extruder_multi_material" ) + wxGetApp().sidebar().show_add_del_filament_button(m_config->opt_bool("single_extruder_multi_material")); if (opt_key == "enable_prime_tower") { auto timelapse_type = m_config->option>("timelapse_type"); @@ -1645,11 +1646,16 @@ void Tab::on_value_change(const std::string& opt_key, const boost::any& value) } - // BBS -#if 0 - if (opt_key == "extruders_count") - wxGetApp().plater()->on_extruders_change(boost::any_cast(value)); -#endif + //Orca: sync filament num if it's a multi tool printer + if (opt_key == "extruders_count" && !m_config->opt_bool("single_extruder_multi_material")){ + auto num_extruder = boost::any_cast(value); + wxColour new_col = Plater::get_next_color_for_filament(); + std::string new_color = new_col.GetAsString(wxC2S_HTML_SYNTAX).ToStdString(); + wxGetApp().preset_bundle->set_num_filaments(num_extruder, new_color); + wxGetApp().plater()->on_filaments_change(num_extruder); + wxGetApp().get_tab(Preset::TYPE_PRINT)->update(); + wxGetApp().preset_bundle->export_selections(*wxGetApp().app_config); + } if (m_postpone_update_ui) { // It means that not all values are rolled to the system/last saved values jet. @@ -1658,7 +1664,8 @@ void Tab::on_value_change(const std::string& opt_key, const boost::any& value) } update(); - m_active_page->update_visibility(m_mode, true); + if(m_active_page) + m_active_page->update_visibility(m_mode, true); m_page_view->GetParent()->Layout(); } @@ -1677,14 +1684,16 @@ void Tab::show_timelapse_warning_dialog() { void Tab::update_wiping_button_visibility() { if (m_preset_bundle->printers.get_selected_preset().printer_technology() == ptSLA) return; // ys_FIXME - bool wipe_tower_enabled = dynamic_cast( (m_preset_bundle->prints.get_edited_preset().config ).option("enable_prime_tower"))->value; - bool multiple_extruders = dynamic_cast((m_preset_bundle->printers.get_edited_preset().config).option("nozzle_diameter"))->values.size() > 1; + // Orca: it's not used + // + // bool wipe_tower_enabled = dynamic_cast( (m_preset_bundle->prints.get_edited_preset().config ).option("enable_prime_tower"))->value; + // bool multiple_extruders = dynamic_cast((m_preset_bundle->printers.get_edited_preset().config).option("nozzle_diameter"))->values.size() > 1; + // auto wiping_dialog_button = wxGetApp().sidebar().get_wiping_dialog_button(); + // if (wiping_dialog_button) { + // wiping_dialog_button->Show(wipe_tower_enabled && multiple_extruders); + // wiping_dialog_button->GetParent()->Layout(); + // } - auto wiping_dialog_button = wxGetApp().sidebar().get_wiping_dialog_button(); - if (wiping_dialog_button) { - wiping_dialog_button->Show(wipe_tower_enabled && multiple_extruders); - wiping_dialog_button->GetParent()->Layout(); - } } void Tab::activate_option(const std::string& opt_key, const wxString& category) @@ -2288,8 +2297,17 @@ void TabPrint::build() optgroup->append_single_option_line("wipe_tower_extra_spacing"); optgroup->append_single_option_line("wipe_tower_max_purge_speed"); optgroup->append_single_option_line("wipe_tower_no_sparse_layers"); - // optgroup->append_single_option_line("single_extruder_multi_material_priming"); + optgroup->append_single_option_line("single_extruder_multi_material_priming"); + optgroup = page->new_optgroup(L("Filament for Features")); + optgroup->append_single_option_line("wall_filament"); + optgroup->append_single_option_line("sparse_infill_filament"); + optgroup->append_single_option_line("solid_infill_filament"); + optgroup->append_single_option_line("wipe_tower_filament"); + + optgroup = page->new_optgroup(L("Ooze prevention")); + optgroup->append_single_option_line("ooze_prevention"); + optgroup->append_single_option_line("standby_temperature_delta"); optgroup = page->new_optgroup(L("Flush options"), L"param_flush"); optgroup->append_single_option_line("flush_into_infill", "reduce-wasting-during-filament-change#wipe-into-infill"); @@ -2312,7 +2330,7 @@ void TabPrint::build() optgroup = page->new_optgroup(L("Advanced"), L"advanced"); optgroup->append_single_option_line("interlocking_beam"); - // optgroup->append_single_option_line("mmu_segmented_region_max_width"); + optgroup->append_single_option_line("mmu_segmented_region_max_width"); optgroup->append_single_option_line("mmu_segmented_region_interlocking_depth"); optgroup->append_single_option_line("interlocking_beam_width"); optgroup->append_single_option_line("interlocking_orientation"); @@ -3234,6 +3252,7 @@ void TabFilament::build() optgroup->append_single_option_line("filament_cost"); //BBS optgroup->append_single_option_line("temperature_vitrification"); + optgroup->append_single_option_line("idle_temperature"); Line line = { L("Recommended nozzle temperature"), L("Recommended nozzle temperature range of this filament. 0 means no set") }; line.append_option(optgroup->get_option("nozzle_temperature_range_low")); line.append_option(optgroup->get_option("nozzle_temperature_range_high")); @@ -3438,6 +3457,7 @@ void TabFilament::build() }); // Orca: multi tool is not supported yet. +#define ORCA_MULTI_TOOL #ifdef ORCA_MULTI_TOOL optgroup = page->new_optgroup(L("Toolchange parameters with multi extruder MM printers")); optgroup->append_single_option_line("filament_multitool_ramming"); @@ -3660,18 +3680,6 @@ void TabPrinter::build_fff() optgroup->append_single_option_line("z_offset"); optgroup->append_single_option_line("preferred_orientation"); - // ConfigOptionDef def; - // def.type = coInt, - // def.set_default_value(new ConfigOptionInt(1)); - // def.label = L("Extruders"); - // def.tooltip = L("Number of extruders of the printer."); - // def.min = 1; - // def.max = 256; - // //BBS - // def.mode = comDevelop; - // Option option(def, "extruders_count"); - // optgroup->append_single_option_line(option); - optgroup = page->new_optgroup(L("Advanced"), L"param_advanced"); optgroup->append_single_option_line("printer_structure"); optgroup->append_single_option_line("gcode_flavor"); @@ -3947,12 +3955,10 @@ void TabPrinter::extruders_count_changed(size_t extruders_count) m_preset_bundle->update_multi_material_filament_presets(); is_count_changed = true; } - // BBS -#if 0 + // Orca: support multi tool else if (m_extruders_count == 1 && m_preset_bundle->project_config.option("flush_volumes_matrix")->values.size()>1) m_preset_bundle->update_multi_material_filament_presets(); -#endif /* This function should be call in any case because of correct updating/rebuilding * of unregular pages of a Printer Settings @@ -4086,14 +4092,86 @@ if (is_marlin_flavor) auto page = add_options_page(L("Multimaterial"), "custom-gcode_multi_material", true); // ORCA: icon only visible on placeholders auto optgroup = page->new_optgroup(L("Single extruder multimaterial setup"), "param_multi_material"); optgroup->append_single_option_line("single_extruder_multi_material", "semm"); - // Orca: we only support Single Extruder Multi Material, so it's always enabled - // optgroup->m_on_change = [this](const t_config_option_key &opt_key, const boost::any &value) { - // wxTheApp->CallAfter([this, opt_key, value]() { - // if (opt_key == "single_extruder_multi_material") { - // build_unregular_pages(); - // } - // }); - // }; + ConfigOptionDef def; + def.type = coInt, def.set_default_value(new ConfigOptionInt((int) m_extruders_count)); + def.label = L("Extruders"); + def.tooltip = L("Number of extruders of the printer."); + def.min = 1; + def.max = 256; + def.mode = comAdvanced; + Option option(def, "extruders_count"); + optgroup->append_single_option_line(option); + + // Orca: rebuild missed extruder pages + optgroup->m_on_change = [this, optgroup_wk = ConfigOptionsGroupWkp(optgroup)](t_config_option_key opt_key, boost::any value) { + auto optgroup_sh = optgroup_wk.lock(); + if (!optgroup_sh) + return; + + // optgroup->get_value() return int for def.type == coInt, + // Thus, there should be boost::any_cast ! + // Otherwise, boost::any_cast causes an "unhandled unknown exception" + size_t extruders_count = size_t(boost::any_cast(optgroup_sh->get_value("extruders_count"))); + wxTheApp->CallAfter([this, opt_key, value, extruders_count]() { + if (opt_key == "extruders_count" || opt_key == "single_extruder_multi_material") { + extruders_count_changed(extruders_count); + init_options_list(); // m_options_list should be updated before UI updating + update_dirty(); + if (opt_key == "single_extruder_multi_material") { // the single_extruder_multimaterial was added to force pages + on_value_change(opt_key, value); // rebuild - let's make sure the on_value_change is not skipped + + if (boost::any_cast(value) && m_extruders_count > 1) { + SuppressBackgroundProcessingUpdate sbpu; + +// Orca: we use a different logic here. If SEMM is enabled, we set extruder count to 1. +#if 1 + extruders_count_changed(1); +#else + + std::vector nozzle_diameters = + static_cast(m_config->option("nozzle_diameter"))->values; + const double frst_diam = nozzle_diameters[0]; + + for (auto cur_diam : nozzle_diameters) { + // if value is differs from first nozzle diameter value + if (fabs(cur_diam - frst_diam) > EPSILON) { + const wxString msg_text = _( + L("Single Extruder Multi Material is selected, \n" + "and all extruders must have the same diameter.\n" + "Do you want to change the diameter for all extruders to first extruder nozzle diameter value?")); + MessageDialog dialog(parent(), msg_text, _(L("Nozzle diameter")), wxICON_WARNING | wxYES_NO); + + DynamicPrintConfig new_conf = *m_config; + if (dialog.ShowModal() == wxID_YES) { + for (size_t i = 1; i < nozzle_diameters.size(); i++) + nozzle_diameters[i] = frst_diam; + + new_conf.set_key_value("nozzle_diameter", new ConfigOptionFloats(nozzle_diameters)); + } else + new_conf.set_key_value("single_extruder_multi_material", new ConfigOptionBool(false)); + + load_config(new_conf); + break; + } + } +#endif + } + + m_preset_bundle->update_compatible(PresetSelectCompatibleType::Never); + // Upadte related comboboxes on Sidebar and Tabs + Sidebar& sidebar = wxGetApp().plater()->sidebar(); + for (const Preset::Type& type : {Preset::TYPE_PRINT, Preset::TYPE_FILAMENT}) { + sidebar.update_presets(type); + wxGetApp().get_tab(type)->update_tab_ui(); + } + } + } + else { + update_dirty(); + on_value_change(opt_key, value); + } + }); + }; optgroup->append_single_option_line("manual_filament_change", "semm#manual-filament-change"); optgroup = page->new_optgroup(L("Wipe tower"), "param_tower"); @@ -4110,140 +4188,138 @@ if (is_marlin_flavor) m_pages.insert(m_pages.end() - n_after_single_extruder_MM, page); } - // BBS. Just create one extruder page because BBL machine has only on physical extruder. - // Build missed extruder pages - //for (auto extruder_idx = m_extruders_count_old; extruder_idx < m_extruders_count; ++extruder_idx) - auto extruder_idx = 0; - const wxString& page_name = (m_extruders_count > 1) ? wxString::Format("Extruder %d", int(extruder_idx + 1)) : wxString::Format("Extruder"); - bool page_exist = false; - for (auto page_temp : m_pages) { - if (page_temp->title() == page_name) { - page_exist = true; - break; + // Orca: build missed extruder pages + for (auto extruder_idx = m_extruders_count_old; extruder_idx < m_extruders_count; ++extruder_idx) { + // auto extruder_idx = 0; + const wxString& page_name = wxString::Format("Extruder %d", int(extruder_idx + 1)); + bool page_exist = false; + for (auto page_temp : m_pages) { + if (page_temp->title() == page_name) { + page_exist = true; + break; + } } - } - if (!page_exist) - { - //# build page - //const wxString& page_name = wxString::Format("Extruder %d", int(extruder_idx + 1)); - auto page = add_options_page(page_name, "custom-gcode_extruder", true); // ORCA: icon only visible on placeholders - m_pages.insert(m_pages.begin() + n_before_extruders + extruder_idx, page); + if (!page_exist) + { + //# build page + //const wxString& page_name = wxString::Format("Extruder %d", int(extruder_idx + 1)); + auto page = add_options_page(page_name, "custom-gcode_extruder", true); // ORCA: icon only visible on placeholders + m_pages.insert(m_pages.begin() + n_before_extruders + extruder_idx, page); - auto optgroup = page->new_optgroup(L("Size"), L"param_extruder_size", -1, true); - optgroup->append_single_option_line("nozzle_diameter", "", extruder_idx); + auto optgroup = page->new_optgroup(L("Size"), L"param_extruder_size"); + optgroup->append_single_option_line("nozzle_diameter", "", extruder_idx); - optgroup->m_on_change = [this, extruder_idx](const t_config_option_key& opt_key, boost::any value) - { - //if (m_config->opt_bool("single_extruder_multi_material") && m_extruders_count > 1 && opt_key.find_first_of("nozzle_diameter") != std::string::npos) - //{ - // SuppressBackgroundProcessingUpdate sbpu; - // const double new_nd = boost::any_cast(value); - // std::vector nozzle_diameters = static_cast(m_config->option("nozzle_diameter"))->values; + optgroup->m_on_change = [this, extruder_idx](const t_config_option_key& opt_key, boost::any value) + { + bool is_SEMM = m_config->opt_bool("single_extruder_multi_material"); + if (is_SEMM && m_extruders_count > 1 && opt_key.find_first_of("nozzle_diameter") != std::string::npos) + { + SuppressBackgroundProcessingUpdate sbpu; + const double new_nd = boost::any_cast(value); + std::vector nozzle_diameters = static_cast(m_config->option("nozzle_diameter"))->values; - // // if value was changed - // if (fabs(nozzle_diameters[extruder_idx == 0 ? 1 : 0] - new_nd) > EPSILON) + // if value was changed + if (fabs(nozzle_diameters[extruder_idx == 0 ? 1 : 0] - new_nd) > EPSILON) + { + const wxString msg_text = _(L("This is a single extruder multimaterial printer, diameters of all extruders " + "will be set to the new value. Do you want to proceed?")); + //wxMessageDialog dialog(parent(), msg_text, _(L("Nozzle diameter")), wxICON_WARNING | wxYES_NO); + MessageDialog dialog(parent(), msg_text, _(L("Nozzle diameter")), wxICON_WARNING | wxYES_NO); + + DynamicPrintConfig new_conf = *m_config; + if (dialog.ShowModal() == wxID_YES) { + for (size_t i = 0; i < nozzle_diameters.size(); i++) { + if (i == extruder_idx) + continue; + nozzle_diameters[i] = new_nd; + } + } + else + nozzle_diameters[extruder_idx] = nozzle_diameters[extruder_idx == 0 ? 1 : 0]; + + new_conf.set_key_value("nozzle_diameter", new ConfigOptionFloats(nozzle_diameters)); + load_config(new_conf); + } + } + + update_dirty(); + update(); + }; + + optgroup = page->new_optgroup(L("Layer height limits"), L"param_layer_height"); + optgroup->append_single_option_line("min_layer_height", "", extruder_idx); + optgroup->append_single_option_line("max_layer_height", "", extruder_idx); + + optgroup = page->new_optgroup(L("Position"), L"param_position"); + optgroup->append_single_option_line("extruder_offset", "", extruder_idx); + + //BBS: don't show retract related config menu in machine page + optgroup = page->new_optgroup(L("Retraction"), L"param_retraction"); + optgroup->append_single_option_line("retraction_length", "", extruder_idx); + optgroup->append_single_option_line("retract_restart_extra", "", extruder_idx); + optgroup->append_single_option_line("z_hop", "", extruder_idx); + optgroup->append_single_option_line("z_hop_types", "", extruder_idx); + optgroup->append_single_option_line("travel_slope", "", extruder_idx); + optgroup->append_single_option_line("retraction_speed", "", extruder_idx); + optgroup->append_single_option_line("deretraction_speed", "", extruder_idx); + optgroup->append_single_option_line("retraction_minimum_travel", "", extruder_idx); + optgroup->append_single_option_line("retract_when_changing_layer", "", extruder_idx); + optgroup->append_single_option_line("wipe", "", extruder_idx); + optgroup->append_single_option_line("wipe_distance", "", extruder_idx); + optgroup->append_single_option_line("retract_before_wipe", "", extruder_idx); + + optgroup = page->new_optgroup(L("Lift Z Enforcement"), L"param_extruder_lift_enforcement"); + optgroup->append_single_option_line("retract_lift_above", "", extruder_idx); + optgroup->append_single_option_line("retract_lift_below", "", extruder_idx); + optgroup->append_single_option_line("retract_lift_enforce", "", extruder_idx); + + optgroup = page->new_optgroup(L("Retraction when switching material"), L"param_retraction_material_change"); + optgroup->append_single_option_line("retract_length_toolchange", "", extruder_idx); + optgroup->append_single_option_line("retract_restart_extra_toolchange", "", extruder_idx); + // do not display this params now + optgroup->append_single_option_line("long_retractions_when_cut", "", extruder_idx); + optgroup->append_single_option_line("retraction_distances_when_cut", "", extruder_idx); + + #if 0 + //optgroup = page->new_optgroup(L("Preview"), -1, true); + + //auto reset_to_filament_color = [this, extruder_idx](wxWindow* parent) { + // m_reset_to_filament_color = new ScalableButton(parent, wxID_ANY, "undo", _L("Reset to Filament Color"), + // wxDefaultSize, wxDefaultPosition, wxBU_LEFT | wxBU_EXACTFIT, true); + // ScalableButton* btn = m_reset_to_filament_color; + // btn->SetFont(Slic3r::GUI::wxGetApp().normal_font()); + // btn->SetSize(btn->GetBestSize()); + // auto sizer = new wxBoxSizer(wxHORIZONTAL); + // sizer->Add(btn); + + // btn->Bind(wxEVT_BUTTON, [this, extruder_idx](wxCommandEvent& e) // { - // const wxString msg_text = _(L("This is a single extruder multimaterial printer, diameters of all extruders " - // "will be set to the new value. Do you want to proceed?")); - // //wxMessageDialog dialog(parent(), msg_text, _(L("Nozzle diameter")), wxICON_WARNING | wxYES_NO); - // MessageDialog dialog(parent(), msg_text, _(L("Nozzle diameter")), wxICON_WARNING | wxYES_NO); + // std::vector colors = static_cast(m_config->option("extruder_colour"))->values; + // colors[extruder_idx] = ""; // DynamicPrintConfig new_conf = *m_config; - // if (dialog.ShowModal() == wxID_YES) { - // for (size_t i = 0; i < nozzle_diameters.size(); i++) { - // if (i==extruder_idx) - // continue; - // nozzle_diameters[i] = new_nd; - // } - // } - // else - // nozzle_diameters[extruder_idx] = nozzle_diameters[extruder_idx == 0 ? 1 : 0]; - - // new_conf.set_key_value("nozzle_diameter", new ConfigOptionFloats(nozzle_diameters)); + // new_conf.set_key_value("extruder_colour", new ConfigOptionStrings(colors)); // load_config(new_conf); - // } - //} - update_dirty(); - update(); - }; - - optgroup = page->new_optgroup(L("Layer height limits"), L"param_layer_height", -1, true); - optgroup->append_single_option_line("min_layer_height", "", extruder_idx); - optgroup->append_single_option_line("max_layer_height", "", extruder_idx); - - optgroup = page->new_optgroup(L("Position"), L"param_position", -1, true); - optgroup->append_single_option_line("extruder_offset", "", extruder_idx); - - //BBS: don't show retract related config menu in machine page - optgroup = page->new_optgroup(L("Retraction"), L"param_retraction"); - optgroup->append_single_option_line("retraction_length", "", extruder_idx); - optgroup->append_single_option_line("retract_restart_extra", "", extruder_idx); - optgroup->append_single_option_line("z_hop", "", extruder_idx); - optgroup->append_single_option_line("z_hop_types", "", extruder_idx); - optgroup->append_single_option_line("travel_slope", "", extruder_idx); - optgroup->append_single_option_line("retraction_speed", "", extruder_idx); - optgroup->append_single_option_line("deretraction_speed", "", extruder_idx); - optgroup->append_single_option_line("retraction_minimum_travel", "", extruder_idx); - optgroup->append_single_option_line("retract_when_changing_layer", "", extruder_idx); - optgroup->append_single_option_line("wipe", "", extruder_idx); - optgroup->append_single_option_line("wipe_distance", "", extruder_idx); - optgroup->append_single_option_line("retract_before_wipe", "", extruder_idx); - - optgroup = page->new_optgroup(L("Lift Z Enforcement"), L"param_extruder_lift_enforcement", -1, true); - optgroup->append_single_option_line("retract_lift_above", "", extruder_idx); - optgroup->append_single_option_line("retract_lift_below", "", extruder_idx); - optgroup->append_single_option_line("retract_lift_enforce", "", extruder_idx); - - optgroup = page->new_optgroup(L("Retraction when switching material"), L"param_retraction_material_change", -1, true); - optgroup->append_single_option_line("retract_length_toolchange", "", extruder_idx); - optgroup->append_single_option_line("retract_restart_extra_toolchange", "", extruder_idx); - // do not display this params now - optgroup->append_single_option_line("long_retractions_when_cut", "", extruder_idx); - optgroup->append_single_option_line("retraction_distances_when_cut", "", extruder_idx); - -#if 0 - //optgroup = page->new_optgroup(L("Preview"), -1, true); - - //auto reset_to_filament_color = [this, extruder_idx](wxWindow* parent) { - // m_reset_to_filament_color = new ScalableButton(parent, wxID_ANY, "undo", _L("Reset to Filament Color"), - // wxDefaultSize, wxDefaultPosition, wxBU_LEFT | wxBU_EXACTFIT, true); - // ScalableButton* btn = m_reset_to_filament_color; - // btn->SetFont(Slic3r::GUI::wxGetApp().normal_font()); - // btn->SetSize(btn->GetBestSize()); - // auto sizer = new wxBoxSizer(wxHORIZONTAL); - // sizer->Add(btn); - - // btn->Bind(wxEVT_BUTTON, [this, extruder_idx](wxCommandEvent& e) - // { - // std::vector colors = static_cast(m_config->option("extruder_colour"))->values; - // colors[extruder_idx] = ""; - - // DynamicPrintConfig new_conf = *m_config; - // new_conf.set_key_value("extruder_colour", new ConfigOptionStrings(colors)); - // load_config(new_conf); - - // update_dirty(); - // update(); - // }); - - // return sizer; - //}; - ////BBS - //Line line = optgroup->create_single_option_line("extruder_colour", "", extruder_idx); - //line.append_widget(reset_to_filament_color); - //optgroup->append_line(line); -#endif - } + // update_dirty(); + // update(); + // }); + // return sizer; + //}; + ////BBS + //Line line = optgroup->create_single_option_line("extruder_colour", "", extruder_idx); + //line.append_widget(reset_to_filament_color); + //optgroup->append_line(line); + #endif + } +} // BBS. No extra extruder page for single physical extruder machine // # remove extra pages -#if 0 if (m_extruders_count < m_extruders_count_old) m_pages.erase( m_pages.begin() + n_before_extruders + m_extruders_count, m_pages.begin() + n_before_extruders + m_extruders_count_old); -#endif Thaw(); @@ -4264,15 +4340,12 @@ if (is_marlin_flavor) // this gets executed after preset is loaded and before GUI fields are updated void TabPrinter::on_preset_loaded() { - // BBS -#if 0 + // Orca // update the extruders count field auto *nozzle_diameter = dynamic_cast(m_config->option("nozzle_diameter")); size_t extruders_count = nozzle_diameter->values.size(); // update the GUI field according to the number of nozzle diameters supplied extruders_count_changed(extruders_count); -#endif - build_unregular_pages(); } void TabPrinter::update_pages() @@ -4319,7 +4392,7 @@ void TabPrinter::reload_config() // "extruders_count" doesn't update from the update_config(), // so update it implicitly - if (m_active_page && m_active_page->title() == "General") + if (m_active_page && m_active_page->title() == "Multimaterial") m_active_page->set_value("extruders_count", int(m_extruders_count)); } @@ -4329,7 +4402,7 @@ void TabPrinter::activate_selected_page(std::function throw_if_canceled) // "extruders_count" doesn't update from the update_config(), // so update it implicitly - if (m_active_page && m_active_page->title() == "General") + if (m_active_page && m_active_page->title() == "Multimaterial") m_active_page->set_value("extruders_count", int(m_extruders_count)); } @@ -4368,13 +4441,19 @@ void TabPrinter::toggle_options() } if (m_active_page->title() == L("Multimaterial")) { - // toggle_option("single_extruder_multi_material", have_multiple_extruders); - // SoftFever: hide specific settings for BBL printer for (auto el : {"purge_in_prime_tower", "enable_filament_ramming", "cooling_tube_retraction", "cooling_tube_length", "parking_pos_retraction", "extra_loading_move", "high_current_on_filament_swap", }) toggle_option(el, !is_BBL_printer); + auto bSEMM = m_config->opt_bool("single_extruder_multi_material"); + if (!bSEMM && m_config->opt_bool("manual_filament_change")) { + DynamicPrintConfig new_conf = *m_config; + new_conf.set_key_value("manual_filament_change", new ConfigOptionBool(false)); + load_config(new_conf); + } + toggle_option("extruders_count", !bSEMM); + toggle_option("manual_filament_change", bSEMM); } wxString extruder_number; long val = 1;