mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-10-04 14:20:58 +00:00
Consolidate U1 nozzle variants while preserving filament tuning
Support variant-specific cooling, pressure advance, purge, ramming and temperature ranges. Keep shared U1 values as singletons and verify element-zero fallback for missing variant entries. Preserve preset migration aliases and validate high-flow selections using their declared nozzle volumes. Co-authored-by: Codex <codex@openai.com>
This commit is contained in:
@@ -314,6 +314,13 @@ DynamicPrintConfig slice_config(PresetBundle &bundle)
|
||||
fmap[i] = int(i % nozzles) + 1;
|
||||
}
|
||||
|
||||
// A fresh printer selection uses its declared nozzle volumes, just like the
|
||||
// app. Otherwise a high-flow preset is silently sliced with Standard tuning.
|
||||
bundle.reset_default_nozzle_volume_type();
|
||||
auto &filament_map = bundle.project_config.option<ConfigOptionInts>("filament_map", true)->values;
|
||||
bundle.project_config.option<ConfigOptionInts>("filament_volume_map", true)->values =
|
||||
bundle.get_default_nozzle_volume_types_for_filaments(filament_map);
|
||||
|
||||
DynamicPrintConfig cfg = bundle.full_config();
|
||||
cfg.set_key_value("enable_prime_tower", new ConfigOptionBool(true)); // force a purge tower so the change is detectable
|
||||
// The map above drives full_config()'s per-filament variant collapse; fmmManual on the sliced config
|
||||
|
||||
@@ -9459,6 +9459,19 @@ std::set<std::string> print_options_with_variant = {
|
||||
std::set<std::string> filament_options_with_variant = {
|
||||
"filament_flow_ratio",
|
||||
"filament_max_volumetric_speed",
|
||||
// Variant arrays use element zero when the selected column is absent.
|
||||
// A singleton therefore retains the same tuning for every nozzle variant.
|
||||
"enable_pressure_advance",
|
||||
"pressure_advance",
|
||||
"fan_min_speed",
|
||||
"fan_max_speed",
|
||||
"additional_cooling_fan_speed",
|
||||
"filament_minimal_purge_on_wipe_tower",
|
||||
"filament_multitool_ramming",
|
||||
"filament_multitool_ramming_volume",
|
||||
"filament_multitool_ramming_flow",
|
||||
"nozzle_temperature_range_low",
|
||||
"nozzle_temperature_range_high",
|
||||
// Per-variant ramming / pre-cooling / nozzle-change filament overrides
|
||||
"filament_ramming_volumetric_speed",
|
||||
"filament_pre_cooling_temperature",
|
||||
|
||||
@@ -78,12 +78,12 @@ void ConfigManipulation::set_option_label(const std::string& opt_key, const wxSt
|
||||
cb_set_option_label(opt_key, label, opt_index);
|
||||
}
|
||||
|
||||
void ConfigManipulation::check_nozzle_recommended_temperature_range(DynamicPrintConfig *config) {
|
||||
void ConfigManipulation::check_nozzle_recommended_temperature_range(DynamicPrintConfig *config, unsigned int variant_index) {
|
||||
if (is_msg_dlg_already_exist)
|
||||
return;
|
||||
|
||||
int temperature_range_low, temperature_range_high;
|
||||
if (!get_temperature_range(config, temperature_range_low, temperature_range_high)) return;
|
||||
if (!get_temperature_range(config, temperature_range_low, temperature_range_high, variant_index)) return;
|
||||
|
||||
// Get the selected filament type
|
||||
std::string filament_type = "";
|
||||
@@ -123,16 +123,16 @@ void ConfigManipulation::check_nozzle_recommended_temperature_range(DynamicPrint
|
||||
}
|
||||
}
|
||||
|
||||
void ConfigManipulation::check_nozzle_temperature_range(DynamicPrintConfig *config)
|
||||
void ConfigManipulation::check_nozzle_temperature_range(DynamicPrintConfig *config, unsigned int variant_index)
|
||||
{
|
||||
if (is_msg_dlg_already_exist)
|
||||
return;
|
||||
|
||||
int temperature_range_low, temperature_range_high;
|
||||
if (!get_temperature_range(config, temperature_range_low, temperature_range_high)) return;
|
||||
if (!get_temperature_range(config, temperature_range_low, temperature_range_high, variant_index)) return;
|
||||
|
||||
if (config->has("nozzle_temperature")) {
|
||||
if (config->opt_int("nozzle_temperature", 0) < temperature_range_low || config->opt_int("nozzle_temperature", 0) > temperature_range_high) {
|
||||
if (config->opt_int("nozzle_temperature", variant_index) < temperature_range_low || config->opt_int("nozzle_temperature", variant_index) > temperature_range_high) {
|
||||
wxString msg_text = _(L("The nozzle may become clogged when the temperature is out of the recommended range.\nPlease make sure whether to use this temperature to print.\n\n"));
|
||||
msg_text += wxString::Format(_L("The recommended nozzle temperature for this filament type is [%d, %d] degrees Celsius."), temperature_range_low, temperature_range_high);
|
||||
MessageDialog dialog(m_msg_dlg_parent, msg_text, "", wxICON_WARNING | wxOK);
|
||||
@@ -143,17 +143,17 @@ void ConfigManipulation::check_nozzle_temperature_range(DynamicPrintConfig *conf
|
||||
}
|
||||
}
|
||||
|
||||
void ConfigManipulation::check_nozzle_temperature_initial_layer_range(DynamicPrintConfig* config)
|
||||
void ConfigManipulation::check_nozzle_temperature_initial_layer_range(DynamicPrintConfig* config, unsigned int variant_index)
|
||||
{
|
||||
if (is_msg_dlg_already_exist)
|
||||
return;
|
||||
|
||||
int temperature_range_low, temperature_range_high;
|
||||
if (!get_temperature_range(config, temperature_range_low, temperature_range_high)) return;
|
||||
if (!get_temperature_range(config, temperature_range_low, temperature_range_high, variant_index)) return;
|
||||
|
||||
if (config->has("nozzle_temperature_initial_layer")) {
|
||||
if (config->opt_int("nozzle_temperature_initial_layer", 0) < temperature_range_low ||
|
||||
config->opt_int("nozzle_temperature_initial_layer", 0) > temperature_range_high)
|
||||
if (config->opt_int("nozzle_temperature_initial_layer", variant_index) < temperature_range_low ||
|
||||
config->opt_int("nozzle_temperature_initial_layer", variant_index) > temperature_range_high)
|
||||
{
|
||||
wxString msg_text = _(L("The nozzle may become clogged when the temperature is out of the recommended range.\nPlease make sure whether to use this temperature to print.\n\n"));
|
||||
msg_text += wxString::Format(_L("The recommended nozzle temperature for this filament type is [%d, %d] degrees Celsius."), temperature_range_low, temperature_range_high);
|
||||
@@ -1293,15 +1293,15 @@ int ConfigManipulation::show_spiral_mode_settings_dialog(bool is_object_config)
|
||||
return answer;
|
||||
}
|
||||
|
||||
bool ConfigManipulation::get_temperature_range(DynamicPrintConfig *config, int &range_low, int &range_high)
|
||||
bool ConfigManipulation::get_temperature_range(DynamicPrintConfig *config, int &range_low, int &range_high, unsigned int variant_index)
|
||||
{
|
||||
bool range_low_exist = false, range_high_exist = false;
|
||||
if (config->has("nozzle_temperature_range_low")) {
|
||||
range_low = config->opt_int("nozzle_temperature_range_low", (unsigned int) 0);
|
||||
range_low = config->opt_int("nozzle_temperature_range_low", variant_index);
|
||||
range_low_exist = true;
|
||||
}
|
||||
if (config->has("nozzle_temperature_range_high")) {
|
||||
range_high = config->opt_int("nozzle_temperature_range_high", (unsigned int) 0);
|
||||
range_high = config->opt_int("nozzle_temperature_range_high", variant_index);
|
||||
range_high_exist = true;
|
||||
}
|
||||
return range_low_exist && range_high_exist;
|
||||
|
||||
@@ -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);
|
||||
void check_nozzle_temperature_range(DynamicPrintConfig* config);
|
||||
void check_nozzle_temperature_initial_layer_range(DynamicPrintConfig* config);
|
||||
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_adaptive_pressure_advance_model(DynamicPrintConfig* config);
|
||||
void check_filament_max_volumetric_speed(DynamicPrintConfig *config);
|
||||
void check_chamber_temperature(DynamicPrintConfig* config);
|
||||
@@ -104,7 +104,7 @@ public:
|
||||
int show_spiral_mode_settings_dialog(bool is_object_config = false);
|
||||
|
||||
private:
|
||||
bool get_temperature_range(DynamicPrintConfig *config, int &range_low, int &range_high);
|
||||
bool get_temperature_range(DynamicPrintConfig *config, int &range_low, int &range_high, unsigned int variant_index);
|
||||
};
|
||||
|
||||
} // GUI
|
||||
|
||||
+25
-24
@@ -4396,16 +4396,16 @@ void TabFilament::build()
|
||||
optgroup->append_single_option_line("temperature_vitrification", "material_basic_information#softening-temperature");
|
||||
optgroup->append_single_option_line("idle_temperature", "material_basic_information#idle-temperature");
|
||||
Line line = { L("Recommended nozzle temperature"), L("Recommended nozzle temperature range of this filament. 0 means not set") };
|
||||
line.append_option(optgroup->get_option("nozzle_temperature_range_low"));
|
||||
line.append_option(optgroup->get_option("nozzle_temperature_range_high"));
|
||||
line.append_option(optgroup->get_option("nozzle_temperature_range_low", 0));
|
||||
line.append_option(optgroup->get_option("nozzle_temperature_range_high", 0));
|
||||
optgroup->append_line(line);
|
||||
|
||||
optgroup->m_on_change = [this, optgroup](t_config_option_key opt_key, boost::any value) {
|
||||
DynamicPrintConfig &filament_config = m_preset_bundle->filaments.get_edited_preset().config;
|
||||
|
||||
update_dirty();
|
||||
if (!m_postpone_update_ui && (opt_key == "nozzle_temperature_range_low" || opt_key == "nozzle_temperature_range_high")) {
|
||||
m_config_manipulation.check_nozzle_recommended_temperature_range(&filament_config);
|
||||
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);
|
||||
}
|
||||
on_value_change(opt_key, value);
|
||||
};
|
||||
@@ -4415,8 +4415,8 @@ void TabFilament::build()
|
||||
optgroup->append_single_option_line("pellet_flow_coefficient", "printer_basic_information_advanced#pellet-modded-printer");
|
||||
optgroup->append_single_option_line("filament_flow_ratio", "material_flow_ratio_and_pressure_advance#flow-ratio", 0);
|
||||
|
||||
optgroup->append_single_option_line("enable_pressure_advance", "material_flow_ratio_and_pressure_advance#pressure-advance");
|
||||
optgroup->append_single_option_line("pressure_advance", "material_flow_ratio_and_pressure_advance#pressure-advance");
|
||||
optgroup->append_single_option_line("enable_pressure_advance", "material_flow_ratio_and_pressure_advance#pressure-advance", 0);
|
||||
optgroup->append_single_option_line("pressure_advance", "material_flow_ratio_and_pressure_advance#pressure-advance", 0);
|
||||
|
||||
// Orca: adaptive pressure advance and calibration model
|
||||
optgroup->append_single_option_line("adaptive_pressure_advance", "material_flow_ratio_and_pressure_advance#enable-adaptive-pressure-advance-beta");
|
||||
@@ -4532,11 +4532,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 == "nozzle_temperature") {
|
||||
m_config_manipulation.check_nozzle_temperature_range(&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 == "nozzle_temperature_initial_layer") {
|
||||
m_config_manipulation.check_nozzle_temperature_initial_layer_range(&filament_config);
|
||||
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);
|
||||
}
|
||||
|
||||
on_value_change(opt_key, value);
|
||||
@@ -4571,12 +4571,12 @@ void TabFilament::build()
|
||||
optgroup = page->new_optgroup(L("Part cooling fan"), L"param_cooling_part_fan");
|
||||
line = { L("Min fan speed threshold"), L("The part cooling fan will run at the minimum fan speed when the estimated layer time is longer than the threshold value. When the layer time is shorter than the threshold, the fan speed will be interpolated between the minimum and maximum fan speed according to layer printing time.") };
|
||||
line.label_path = "material_cooling#material-part-cooling-fan";
|
||||
line.append_option(optgroup->get_option("fan_min_speed"));
|
||||
line.append_option(optgroup->get_option("fan_min_speed", 0));
|
||||
line.append_option(optgroup->get_option("fan_cooling_layer_time"));
|
||||
optgroup->append_line(line);
|
||||
line = { L("Max fan speed threshold"), L("The part cooling fan will run at maximum speed when the estimated layer time is shorter than the threshold value.") };
|
||||
line.label_path = "material_cooling#material-part-cooling-fan";
|
||||
line.append_option(optgroup->get_option("fan_max_speed"));
|
||||
line.append_option(optgroup->get_option("fan_max_speed", 0));
|
||||
line.append_option(optgroup->get_option("slow_down_layer_time"));
|
||||
optgroup->append_line(line);
|
||||
optgroup->append_single_option_line("reduce_fan_stop_start_freq", "material_cooling#keep-fan-always-on");
|
||||
@@ -4592,7 +4592,7 @@ void TabFilament::build()
|
||||
optgroup->append_single_option_line("ironing_fan_speed", "material_cooling#ironing-fan-speed"); // ORCA: Add support for ironing fan speed control
|
||||
|
||||
optgroup = page->new_optgroup(L("Auxiliary part cooling fan"), L"param_cooling_aux_fan");
|
||||
optgroup->append_single_option_line("additional_cooling_fan_speed", "material_cooling#auxiliary-part-cooling-fan");
|
||||
optgroup->append_single_option_line("additional_cooling_fan_speed", "material_cooling#auxiliary-part-cooling-fan", 0);
|
||||
|
||||
optgroup = page->new_optgroup(L("Exhaust fan"),L"param_cooling_exhaust");
|
||||
|
||||
@@ -4656,7 +4656,7 @@ void TabFilament::build()
|
||||
|
||||
page = add_options_page(L("Multimaterial"), "custom-gcode_multi_material"); // ORCA: icon only visible on placeholders
|
||||
optgroup = page->new_optgroup(L("Wipe tower parameters"), "param_tower");
|
||||
optgroup->append_single_option_line("filament_minimal_purge_on_wipe_tower", "material_multimaterial#multimaterial-wipe-tower-parameters");
|
||||
optgroup->append_single_option_line("filament_minimal_purge_on_wipe_tower", "material_multimaterial#multimaterial-wipe-tower-parameters", 0);
|
||||
optgroup->append_single_option_line("filament_tower_interface_pre_extrusion_dist", "material_multimaterial#multimaterial-wipe-tower-parameters");
|
||||
optgroup->append_single_option_line("filament_tower_interface_pre_extrusion_length", "material_multimaterial#multimaterial-wipe-tower-parameters");
|
||||
optgroup->append_single_option_line("filament_tower_ironing_area", "material_multimaterial#multimaterial-wipe-tower-parameters");
|
||||
@@ -4700,9 +4700,9 @@ void TabFilament::build()
|
||||
});
|
||||
|
||||
optgroup = page->new_optgroup(L("Tool change parameters with multi extruder MM printers"), "param_toolchange_multi_extruder");
|
||||
optgroup->append_single_option_line("filament_multitool_ramming", "material_multimaterial#tool-change-parameters-with-multi-extruder");
|
||||
optgroup->append_single_option_line("filament_multitool_ramming_volume", "material_multimaterial#multi-tool-ramming-volume");
|
||||
optgroup->append_single_option_line("filament_multitool_ramming_flow", "material_multimaterial#multi-tool-ramming-flow");
|
||||
optgroup->append_single_option_line("filament_multitool_ramming", "material_multimaterial#tool-change-parameters-with-multi-extruder", 0);
|
||||
optgroup->append_single_option_line("filament_multitool_ramming_volume", "material_multimaterial#multi-tool-ramming-volume", 0);
|
||||
optgroup->append_single_option_line("filament_multitool_ramming_flow", "material_multimaterial#multi-tool-ramming-flow", 0);
|
||||
|
||||
page = add_options_page(L("Dependencies"), "advanced");
|
||||
optgroup = page->new_optgroup(L("Compatible printers"), "param_dependencies_printers");
|
||||
@@ -4772,6 +4772,7 @@ void TabFilament::update_description_lines()
|
||||
|
||||
void TabFilament::toggle_options()
|
||||
{
|
||||
const int variant_index = m_variant_combo ? std::max(0, m_variant_combo->GetSelection()) : 0;
|
||||
if (!m_active_page)
|
||||
return;
|
||||
bool is_BBL_printer = false;
|
||||
@@ -4813,7 +4814,7 @@ void TabFilament::toggle_options()
|
||||
}
|
||||
}
|
||||
|
||||
toggle_line("additional_cooling_fan_speed", printer_cfg.opt_bool("auxiliary_fan"));
|
||||
toggle_line("additional_cooling_fan_speed", printer_cfg.opt_bool("auxiliary_fan"), 256 + variant_index);
|
||||
|
||||
bool support_air_filtration = printer_cfg.opt_bool("support_air_filtration");
|
||||
for (auto el : {"activate_air_filtration", "during_print_exhaust_fan_speed", "complete_print_exhaust_fan_speed"})
|
||||
@@ -4829,8 +4830,8 @@ void TabFilament::toggle_options()
|
||||
}
|
||||
if (m_active_page->title() == L("Filament"))
|
||||
{
|
||||
bool pa = m_config->opt_bool("enable_pressure_advance", 0);
|
||||
toggle_option("pressure_advance", pa);
|
||||
bool pa = m_config->opt_bool("enable_pressure_advance", variant_index);
|
||||
toggle_option("pressure_advance", pa, 256 + variant_index);
|
||||
|
||||
//Orca: Enable the plates that should be visible when multi bed support is enabled or a BBL printer is selected; otherwise, enable only the plate visible for the selected bed type.
|
||||
DynamicConfig& proj_cfg = m_preset_bundle->project_config;
|
||||
@@ -4886,11 +4887,11 @@ void TabFilament::toggle_options()
|
||||
for (auto el : {"filament_minimal_purge_on_wipe_tower", "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);
|
||||
toggle_option(el, !is_BBL_printer, filament_options_with_variant.count(el) ? 256 + variant_index : -1);
|
||||
|
||||
bool multitool_ramming = m_config->opt_bool("filament_multitool_ramming", 0);
|
||||
toggle_option("filament_multitool_ramming_volume", multitool_ramming);
|
||||
toggle_option("filament_multitool_ramming_flow", multitool_ramming);
|
||||
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;
|
||||
|
||||
Reference in New Issue
Block a user