mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-10-02 05:11:00 +00:00
Keep the printer preset when reselecting its nozzle diameter
Printers without a named nozzle variant no longer switch profiles when their current diameter is picked in the sidebar. The filament tab reads the selected variant through one helper.
This commit is contained in:
@@ -79,9 +79,9 @@ public:
|
||||
void apply_null_fff_config(DynamicPrintConfig *config, std::vector<std::string> const &keys, std::map<ObjectBase*, ModelConfig*> const & configs);
|
||||
|
||||
//BBS: FFF filament nozzle temperature range
|
||||
void check_nozzle_recommended_temperature_range(DynamicPrintConfig *config, unsigned int variant_index = 0);
|
||||
void check_nozzle_temperature_range(DynamicPrintConfig* config, unsigned int variant_index = 0);
|
||||
void check_nozzle_temperature_initial_layer_range(DynamicPrintConfig* config, unsigned int variant_index = 0);
|
||||
void check_nozzle_recommended_temperature_range(DynamicPrintConfig *config, unsigned int variant_index);
|
||||
void check_nozzle_temperature_range(DynamicPrintConfig* config, unsigned int variant_index);
|
||||
void check_nozzle_temperature_initial_layer_range(DynamicPrintConfig* config, unsigned int variant_index);
|
||||
void check_adaptive_pressure_advance_model(DynamicPrintConfig* config);
|
||||
void check_filament_max_volumetric_speed(DynamicPrintConfig *config);
|
||||
void check_chamber_temperature(DynamicPrintConfig* config);
|
||||
|
||||
@@ -1797,16 +1797,17 @@ bool Sidebar::priv::switch_diameter_to(const wxString &diameter)
|
||||
Preset& printer_preset = wxGetApp().preset_bundle->printers.get_edited_preset();
|
||||
// The combo lists printer variants, and the variant of a mixed-nozzle machine ("0.4+0.6") is no
|
||||
// single extruder's diameter, so the preset's own variant answers first.
|
||||
if (printer_preset.config.opt_string("printer_variant") == diameter.ToStdString()) {
|
||||
const std::string &printer_variant = printer_preset.config.opt_string("printer_variant");
|
||||
if (printer_variant == diameter.ToStdString()) {
|
||||
return true;
|
||||
}
|
||||
// A named variant ("0.4 High Flow") shares its diameter with the standard profile, which selecting
|
||||
// the plain diameter switches back to, so only a preset naming no variant is kept by its diameter.
|
||||
auto* nozzle_diameter = dynamic_cast<const ConfigOptionFloats*>(printer_preset.config.option("nozzle_diameter"));
|
||||
if (nozzle_diameter && nozzle_diameter->size() > 0) {
|
||||
if (printer_variant.empty() && nozzle_diameter && nozzle_diameter->size() > 0) {
|
||||
auto current_nozzle_dia = get_diameter_string(nozzle_diameter->values[0]);
|
||||
// A named variant can share this diameter; selecting the plain diameter
|
||||
// must still switch back to the standard profile.
|
||||
if (current_nozzle_dia == diameter.ToStdString() &&
|
||||
printer_preset.config.opt_string("printer_variant") == diameter.ToStdString()) {
|
||||
// If the selected diameter is the same as current nozzle, don't switch profiles
|
||||
if (current_nozzle_dia == diameter.ToStdString()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -3944,9 +3945,9 @@ void Sidebar::update_presets(Preset::Type preset_type)
|
||||
auto nozzle_dia = get_diameter_string(nozzle_diameter->values[extruder_index]);
|
||||
// Named variants such as "0.4HS" and "0.4 High Flow" share a physical diameter.
|
||||
// Retain the variant selection unless the diameter was customized.
|
||||
const auto selected_variant =
|
||||
diameter.substr(0, diameter.find_first_not_of("0123456789.")) == nozzle_dia &&
|
||||
std::find(diameters.begin(), diameters.end(), diameter) != diameters.end() ? diameter : nozzle_dia;
|
||||
const bool keep_variant = diameter.substr(0, diameter.find_first_not_of("0123456789.")) == nozzle_dia &&
|
||||
std::find(diameters.begin(), diameters.end(), diameter) != diameters.end();
|
||||
const std::string &selected_variant = keep_variant ? diameter : nozzle_dia;
|
||||
// ORCA try to add nozzle diameter from config if list is empty. fixes blank nozzle combo box when preset has no alias
|
||||
if(!diameters.empty() && diameters[0].empty() && !nozzle_dia.empty()){
|
||||
diameters[0] = nozzle_dia;
|
||||
|
||||
+19
-13
@@ -4404,8 +4404,9 @@ void TabFilament::build()
|
||||
DynamicPrintConfig &filament_config = m_preset_bundle->filaments.get_edited_preset().config;
|
||||
|
||||
update_dirty();
|
||||
if (!m_postpone_update_ui && (opt_key.substr(0, opt_key.find('#')) == "nozzle_temperature_range_low" || opt_key.substr(0, opt_key.find('#')) == "nozzle_temperature_range_high")) {
|
||||
m_config_manipulation.check_nozzle_recommended_temperature_range(&filament_config, m_variant_combo ? std::max(0, m_variant_combo->GetSelection()) : 0);
|
||||
const std::string opt_key_without_idx = opt_key.substr(0, opt_key.find('#'));
|
||||
if (!m_postpone_update_ui && (opt_key_without_idx == "nozzle_temperature_range_low" || opt_key_without_idx == "nozzle_temperature_range_high")) {
|
||||
m_config_manipulation.check_nozzle_recommended_temperature_range(&filament_config, selected_variant_index());
|
||||
}
|
||||
on_value_change(opt_key, value);
|
||||
};
|
||||
@@ -4520,6 +4521,7 @@ void TabFilament::build()
|
||||
DynamicPrintConfig& filament_config = m_preset_bundle->filaments.get_edited_preset().config;
|
||||
|
||||
update_dirty();
|
||||
const std::string opt_key_without_idx = opt_key.substr(0, opt_key.find('#'));
|
||||
/*if (opt_key == "cool_plate_temp" || opt_key == "cool_plate_temp_initial_layer") {
|
||||
m_config_manipulation.check_bed_temperature_difference(BedType::btPC, &filament_config);
|
||||
}
|
||||
@@ -4532,11 +4534,11 @@ void TabFilament::build()
|
||||
else if (opt_key == "textured_plate_temp" || opt_key == "textured_plate_temp_initial_layer") {
|
||||
m_config_manipulation.check_bed_temperature_difference(BedType::btPTE, &filament_config);
|
||||
}
|
||||
else */if (opt_key.substr(0, opt_key.find('#')) == "nozzle_temperature") {
|
||||
m_config_manipulation.check_nozzle_temperature_range(&filament_config, m_variant_combo ? std::max(0, m_variant_combo->GetSelection()) : 0);
|
||||
else */if (opt_key_without_idx == "nozzle_temperature") {
|
||||
m_config_manipulation.check_nozzle_temperature_range(&filament_config, selected_variant_index());
|
||||
}
|
||||
else if (opt_key.substr(0, opt_key.find('#')) == "nozzle_temperature_initial_layer") {
|
||||
m_config_manipulation.check_nozzle_temperature_initial_layer_range(&filament_config, m_variant_combo ? std::max(0, m_variant_combo->GetSelection()) : 0);
|
||||
else if (opt_key_without_idx == "nozzle_temperature_initial_layer") {
|
||||
m_config_manipulation.check_nozzle_temperature_initial_layer_range(&filament_config, selected_variant_index());
|
||||
}
|
||||
|
||||
on_value_change(opt_key, value);
|
||||
@@ -4770,9 +4772,14 @@ void TabFilament::update_description_lines()
|
||||
// this->update_volumetric_flow_preset_hints();
|
||||
}
|
||||
|
||||
unsigned int TabFilament::selected_variant_index() const
|
||||
{
|
||||
return m_variant_combo ? std::max(0, m_variant_combo->GetSelection()) : 0;
|
||||
}
|
||||
|
||||
void TabFilament::toggle_options()
|
||||
{
|
||||
const unsigned int variant_index = m_variant_combo ? std::max(0, m_variant_combo->GetSelection()) : 0;
|
||||
const unsigned int variant_index = selected_variant_index();
|
||||
if (!m_active_page)
|
||||
return;
|
||||
bool is_BBL_printer = false;
|
||||
@@ -4882,20 +4889,19 @@ void TabFilament::toggle_options()
|
||||
|
||||
if (m_active_page->title() == L("Multimaterial")) {
|
||||
// Orca: hide specific settings for BBL printers
|
||||
for (auto el : {"filament_minimal_purge_on_wipe_tower", "filament_loading_speed_start", "filament_loading_speed",
|
||||
toggle_option("filament_minimal_purge_on_wipe_tower", !is_BBL_printer, 256 + variant_index);
|
||||
for (auto el : {"filament_loading_speed_start", "filament_loading_speed",
|
||||
"filament_unloading_speed_start", "filament_unloading_speed", "filament_toolchange_delay", "filament_cooling_moves",
|
||||
"filament_cooling_initial_speed", "filament_cooling_final_speed"})
|
||||
toggle_option(el, !is_BBL_printer, filament_options_with_variant.count(el) ? 256 + variant_index : -1);
|
||||
toggle_option(el, !is_BBL_printer);
|
||||
|
||||
bool multitool_ramming = m_config->opt_bool("filament_multitool_ramming", variant_index);
|
||||
toggle_option("filament_multitool_ramming_volume", multitool_ramming, 256 + variant_index);
|
||||
toggle_option("filament_multitool_ramming_flow", multitool_ramming, 256 + variant_index);
|
||||
|
||||
bool is_BBL_multi_extruder = is_BBL_printer && printer_cfg.option<ConfigOptionFloats>("nozzle_diameter")->size() > 1;
|
||||
const int selection = m_variant_combo ? m_variant_combo->GetSelection() : 0;
|
||||
const int extruder_idx = std::max(selection, 0);
|
||||
toggle_line("long_retractions_when_ec", is_BBL_multi_extruder, 256 + extruder_idx);
|
||||
toggle_line("retraction_distances_when_ec", is_BBL_multi_extruder && m_config->opt_bool("long_retractions_when_ec", extruder_idx), 256 + extruder_idx);
|
||||
toggle_line("long_retractions_when_ec", is_BBL_multi_extruder, 256 + variant_index);
|
||||
toggle_line("retraction_distances_when_ec", is_BBL_multi_extruder && m_config->opt_bool("long_retractions_when_ec", variant_index), 256 + variant_index);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -616,6 +616,8 @@ private:
|
||||
void add_filament_overrides_page();
|
||||
void update_filament_overrides_page(const DynamicPrintConfig* printers_config);
|
||||
void update_volumetric_flow_preset_hints();
|
||||
// The variant index the variant switch shows, 0 without one.
|
||||
unsigned int selected_variant_index() const;
|
||||
|
||||
std::map<std::string, ::CheckBox*> m_overrides_options;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user