mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-10-01 21:01:12 +00:00
Keep downstream customization limited to printer profiles
Extract non-profile changes into a separate development line while preserving all profile content. Co-authored-by: Codex <codex@openai.com>
This commit is contained in:
@@ -1757,20 +1757,18 @@ def check_variant_names(profiles_dir, vendor):
|
|||||||
|
|
||||||
|
|
||||||
def check_variant_arrays(profiles_dir, vendor, strict=False):
|
def check_variant_arrays(profiles_dir, vendor, strict=False):
|
||||||
"""Variant arrays have the declared width or a shared single value,
|
"""Every variant array an instantiated preset writes is exactly its
|
||||||
and a printer's variant layout keys agree.
|
variant length x stride wide, and a printer's variant layout keys agree.
|
||||||
|
|
||||||
Only instantiated presets are judged, each at the variant length of its composed
|
Only instantiated presets are judged, each at the variant length of its composed
|
||||||
config (_variant_length's); a base is not, since what it writes counts only where
|
config (_variant_length's); a base is not, since what it writes counts only where
|
||||||
it reaches a preset that does not override it. A full-width array holds one
|
it reaches a preset that does not override it. A full-width array holds one
|
||||||
value per variant; a single value at stride 1 broadcasts to every variant.
|
value per variant; any other width is an error, one value included and whatever
|
||||||
Short, nonempty filament arrays use element zero for missing variants,
|
the values. A key the preset does not write takes what reaches it - the default,
|
||||||
matching the C++ loader. Other widths are errors. A key the preset does not write
|
|
||||||
takes what reaches it - the default,
|
|
||||||
or an array it inherits or includes - which the loader sizes to the preset, and
|
or an array it inherits or includes - which the loader sizes to the preset, and
|
||||||
is not checked. With strict, every instantiated preset also holds each key that
|
is not checked. With strict, every instantiated preset also holds each key that
|
||||||
reaches it at its own width or as a shared single value, so a preset with
|
reaches it at its own width, so a preset with other variants than the file its
|
||||||
other variants restates non-shared arrays when necessary. The machine_max_* limits hold
|
array comes from restates the array. The machine_max_* limits hold
|
||||||
a (normal, silent) pair per variant. A process that lists variants pairs each
|
a (normal, silent) pair per variant. A process that lists variants pairs each
|
||||||
with its extruder id (extruder 1 everywhere when absent); a machine's layout keys
|
with its extruder id (extruder 1 everywhere when absent); a machine's layout keys
|
||||||
are held to _check_printer_layout, which reports a printer_extruder_id that does
|
are held to _check_printer_layout, which reports a printer_extruder_id that does
|
||||||
@@ -1792,7 +1790,7 @@ def check_variant_arrays(profiles_dir, vendor, strict=False):
|
|||||||
continue
|
continue
|
||||||
value, path = config[key]
|
value, path = config[key]
|
||||||
width, need = len(_as_list(value)), variant_length * stride
|
width, need = len(_as_list(value)), variant_length * stride
|
||||||
if width == need or (stride == 1 and (width == 1 or (ptype == "filament" and 0 < width < need))):
|
if width == need:
|
||||||
continue
|
continue
|
||||||
print_error(f'{rel}: "{key}" has {width} values for variant length {variant_length}'
|
print_error(f'{rel}: "{key}" has {width} values for variant length {variant_length}'
|
||||||
f"{' (' + reason + ')' if reason else ''} at stride {stride}, "
|
f"{' (' + reason + ')' if reason else ''} at stride {stride}, "
|
||||||
|
|||||||
@@ -968,25 +968,21 @@ class TestFixVariant(TreeCase):
|
|||||||
retraction_length=["0.8", "1.2"], z_hop=["0.4"],
|
retraction_length=["0.8", "1.2"], z_hop=["0.4"],
|
||||||
machine_max_speed_x=["500", "200"])
|
machine_max_speed_x=["500", "200"])
|
||||||
errors, out = self.width_errors()
|
errors, out = self.width_errors()
|
||||||
self.assertEqual(errors, 1, out)
|
self.assertEqual(errors, 2, out)
|
||||||
self.assertNotIn('"z_hop"', out)
|
self.assertIn('M.json: "z_hop" has 1 values for variant length 2 (no '
|
||||||
|
'printer_extruder_variant, so one default variant per extruder) at stride 1, '
|
||||||
|
'which takes 2', out)
|
||||||
self.assertIn('M.json: "machine_max_speed_x" has 2 values for variant length 2', out)
|
self.assertIn('M.json: "machine_max_speed_x" has 2 values for variant length 2', out)
|
||||||
self.assertNotIn("retraction_length", out)
|
self.assertNotIn("retraction_length", out)
|
||||||
|
|
||||||
def test_one_value_applies_to_every_variant(self):
|
def test_one_value_is_an_error_where_the_list_has_more_variants(self):
|
||||||
self.preset("process/P.json", instantiation="true", outer_wall_speed=["30"],
|
self.preset("process/P.json", instantiation="true", outer_wall_speed=["30"],
|
||||||
print_extruder_id=["1", "1"],
|
print_extruder_id=["1", "1"],
|
||||||
print_extruder_variant=["Direct Drive Standard", "Direct Drive High Flow"])
|
print_extruder_variant=["Direct Drive Standard", "Direct Drive High Flow"])
|
||||||
errors, out = self.width_errors()
|
errors, out = self.width_errors()
|
||||||
self.assertEqual(errors, 0, out)
|
self.assertEqual(errors, 1, out)
|
||||||
self.assertEqual(self.width_errors("strict")[0], 0)
|
self.assertIn('P.json: "outer_wall_speed" has 1 values for variant length 2 at stride 1, '
|
||||||
|
'which takes 2', out)
|
||||||
def test_a_short_filament_array_uses_element_zero_for_missing_variants(self):
|
|
||||||
self.preset("filament/F.json", instantiation="true", pressure_advance=["0.02", "0.04"],
|
|
||||||
filament_extruder_variant=["Direct Drive Standard", "Direct Drive High Flow", "Bowden Standard"])
|
|
||||||
errors, out = self.width_errors()
|
|
||||||
self.assertEqual(errors, 0, out)
|
|
||||||
self.assertEqual(self.width_errors("strict")[0], 0)
|
|
||||||
|
|
||||||
def test_one_value_is_padded_to_every_variant(self):
|
def test_one_value_is_padded_to_every_variant(self):
|
||||||
self.preset("machine/M.json", instantiation="true", nozzle_diameter=["0.4"] * 3,
|
self.preset("machine/M.json", instantiation="true", nozzle_diameter=["0.4"] * 3,
|
||||||
@@ -1029,11 +1025,13 @@ class TestFixVariant(TreeCase):
|
|||||||
self.assertNotIn("outer_wall_speed", self.t.read("V", "process/S1.json"))
|
self.assertNotIn("outer_wall_speed", self.t.read("V", "process/S1.json"))
|
||||||
self.assertEqual(self.width_errors("strict")[0], 0)
|
self.assertEqual(self.width_errors("strict")[0], 0)
|
||||||
|
|
||||||
def test_an_inherited_single_value_is_valid_and_can_be_explicitly_expanded(self):
|
def test_an_inherited_array_is_checked_and_restated_only_when_strict(self):
|
||||||
self.processes(["30"])
|
self.processes(["30"])
|
||||||
self.assertEqual(self.width_errors()[0], 0)
|
self.assertEqual(self.width_errors()[0], 0)
|
||||||
errors, out = self.width_errors("strict")
|
errors, out = self.width_errors("strict")
|
||||||
self.assertEqual(errors, 0, out)
|
self.assertEqual(errors, 1, out)
|
||||||
|
self.assertIn('process/D1.json: "outer_wall_speed" has 1 values for variant length 2 at '
|
||||||
|
'stride 1, which takes 2 (it comes from V/process/common.json)', out)
|
||||||
before = self.t.bytes_map()
|
before = self.t.bytes_map()
|
||||||
self.run_command("fix-variant")
|
self.run_command("fix-variant")
|
||||||
self.assertEqual(self.t.bytes_map(), before)
|
self.assertEqual(self.t.bytes_map(), before)
|
||||||
|
|||||||
@@ -314,13 +314,6 @@ DynamicPrintConfig slice_config(PresetBundle &bundle)
|
|||||||
fmap[i] = int(i % nozzles) + 1;
|
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();
|
DynamicPrintConfig cfg = bundle.full_config();
|
||||||
cfg.set_key_value("enable_prime_tower", new ConfigOptionBool(true)); // force a purge tower so the change is detectable
|
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
|
// The map above drives full_config()'s per-filament variant collapse; fmmManual on the sliced config
|
||||||
|
|||||||
@@ -9463,19 +9463,6 @@ std::set<std::string> print_options_with_variant = {
|
|||||||
std::set<std::string> filament_options_with_variant = {
|
std::set<std::string> filament_options_with_variant = {
|
||||||
"filament_flow_ratio",
|
"filament_flow_ratio",
|
||||||
"filament_max_volumetric_speed",
|
"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
|
// Per-variant ramming / pre-cooling / nozzle-change filament overrides
|
||||||
"filament_ramming_volumetric_speed",
|
"filament_ramming_volumetric_speed",
|
||||||
"filament_pre_cooling_temperature",
|
"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);
|
cb_set_option_label(opt_key, label, opt_index);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConfigManipulation::check_nozzle_recommended_temperature_range(DynamicPrintConfig *config, unsigned int variant_index) {
|
void ConfigManipulation::check_nozzle_recommended_temperature_range(DynamicPrintConfig *config) {
|
||||||
if (is_msg_dlg_already_exist)
|
if (is_msg_dlg_already_exist)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
int temperature_range_low, temperature_range_high;
|
int temperature_range_low, temperature_range_high;
|
||||||
if (!get_temperature_range(config, temperature_range_low, temperature_range_high, variant_index)) return;
|
if (!get_temperature_range(config, temperature_range_low, temperature_range_high)) return;
|
||||||
|
|
||||||
// Get the selected filament type
|
// Get the selected filament type
|
||||||
std::string 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, unsigned int variant_index)
|
void ConfigManipulation::check_nozzle_temperature_range(DynamicPrintConfig *config)
|
||||||
{
|
{
|
||||||
if (is_msg_dlg_already_exist)
|
if (is_msg_dlg_already_exist)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
int temperature_range_low, temperature_range_high;
|
int temperature_range_low, temperature_range_high;
|
||||||
if (!get_temperature_range(config, temperature_range_low, temperature_range_high, variant_index)) return;
|
if (!get_temperature_range(config, temperature_range_low, temperature_range_high)) return;
|
||||||
|
|
||||||
if (config->has("nozzle_temperature")) {
|
if (config->has("nozzle_temperature")) {
|
||||||
if (config->opt_int("nozzle_temperature", variant_index) < temperature_range_low || config->opt_int("nozzle_temperature", variant_index) > temperature_range_high) {
|
if (config->opt_int("nozzle_temperature", 0) < temperature_range_low || config->opt_int("nozzle_temperature", 0) > 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"));
|
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);
|
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);
|
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, unsigned int variant_index)
|
void ConfigManipulation::check_nozzle_temperature_initial_layer_range(DynamicPrintConfig* config)
|
||||||
{
|
{
|
||||||
if (is_msg_dlg_already_exist)
|
if (is_msg_dlg_already_exist)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
int temperature_range_low, temperature_range_high;
|
int temperature_range_low, temperature_range_high;
|
||||||
if (!get_temperature_range(config, temperature_range_low, temperature_range_high, variant_index)) return;
|
if (!get_temperature_range(config, temperature_range_low, temperature_range_high)) return;
|
||||||
|
|
||||||
if (config->has("nozzle_temperature_initial_layer")) {
|
if (config->has("nozzle_temperature_initial_layer")) {
|
||||||
if (config->opt_int("nozzle_temperature_initial_layer", variant_index) < temperature_range_low ||
|
if (config->opt_int("nozzle_temperature_initial_layer", 0) < temperature_range_low ||
|
||||||
config->opt_int("nozzle_temperature_initial_layer", variant_index) > temperature_range_high)
|
config->opt_int("nozzle_temperature_initial_layer", 0) > 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"));
|
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);
|
msg_text += wxString::Format(_L("The recommended nozzle temperature for this filament type is [%d, %d] degrees Celsius."), temperature_range_low, temperature_range_high);
|
||||||
@@ -1295,15 +1295,15 @@ int ConfigManipulation::show_spiral_mode_settings_dialog(bool is_object_config)
|
|||||||
return answer;
|
return answer;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ConfigManipulation::get_temperature_range(DynamicPrintConfig *config, int &range_low, int &range_high, unsigned int variant_index)
|
bool ConfigManipulation::get_temperature_range(DynamicPrintConfig *config, int &range_low, int &range_high)
|
||||||
{
|
{
|
||||||
bool range_low_exist = false, range_high_exist = false;
|
bool range_low_exist = false, range_high_exist = false;
|
||||||
if (config->has("nozzle_temperature_range_low")) {
|
if (config->has("nozzle_temperature_range_low")) {
|
||||||
range_low = config->opt_int("nozzle_temperature_range_low", variant_index);
|
range_low = config->opt_int("nozzle_temperature_range_low", (unsigned int) 0);
|
||||||
range_low_exist = true;
|
range_low_exist = true;
|
||||||
}
|
}
|
||||||
if (config->has("nozzle_temperature_range_high")) {
|
if (config->has("nozzle_temperature_range_high")) {
|
||||||
range_high = config->opt_int("nozzle_temperature_range_high", variant_index);
|
range_high = config->opt_int("nozzle_temperature_range_high", (unsigned int) 0);
|
||||||
range_high_exist = true;
|
range_high_exist = true;
|
||||||
}
|
}
|
||||||
return range_low_exist && range_high_exist;
|
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);
|
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
|
//BBS: FFF filament nozzle temperature range
|
||||||
void check_nozzle_recommended_temperature_range(DynamicPrintConfig *config, unsigned int variant_index = 0);
|
void check_nozzle_recommended_temperature_range(DynamicPrintConfig *config);
|
||||||
void check_nozzle_temperature_range(DynamicPrintConfig* config, unsigned int variant_index = 0);
|
void check_nozzle_temperature_range(DynamicPrintConfig* config);
|
||||||
void check_nozzle_temperature_initial_layer_range(DynamicPrintConfig* config, unsigned int variant_index = 0);
|
void check_nozzle_temperature_initial_layer_range(DynamicPrintConfig* config);
|
||||||
void check_adaptive_pressure_advance_model(DynamicPrintConfig* config);
|
void check_adaptive_pressure_advance_model(DynamicPrintConfig* config);
|
||||||
void check_filament_max_volumetric_speed(DynamicPrintConfig *config);
|
void check_filament_max_volumetric_speed(DynamicPrintConfig *config);
|
||||||
void check_chamber_temperature(DynamicPrintConfig* config);
|
void check_chamber_temperature(DynamicPrintConfig* config);
|
||||||
@@ -104,7 +104,7 @@ public:
|
|||||||
int show_spiral_mode_settings_dialog(bool is_object_config = false);
|
int show_spiral_mode_settings_dialog(bool is_object_config = false);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool get_temperature_range(DynamicPrintConfig *config, int &range_low, int &range_high, unsigned int variant_index);
|
bool get_temperature_range(DynamicPrintConfig *config, int &range_low, int &range_high);
|
||||||
};
|
};
|
||||||
|
|
||||||
} // GUI
|
} // GUI
|
||||||
|
|||||||
@@ -8895,11 +8895,6 @@ void GUI_App::load_current_presets(bool active_preset_combox/*= false*/, bool ch
|
|||||||
if (active_preset_combox)
|
if (active_preset_combox)
|
||||||
tab->reactive_preset_combo_box();
|
tab->reactive_preset_combo_box();
|
||||||
}
|
}
|
||||||
// Preset loading can resize the filament list without an extruder-count change event.
|
|
||||||
// Refresh the controls even when the list already matches the printer's nozzle count.
|
|
||||||
if (printer_technology == ptFFF)
|
|
||||||
this->plater()->on_filament_count_change(preset_bundle->filament_presets.size());
|
|
||||||
|
|
||||||
// BBS: model config
|
// BBS: model config
|
||||||
for (Tab *tab : model_tabs_list)
|
for (Tab *tab : model_tabs_list)
|
||||||
if (tab->supports_printer_technology(printer_technology)) {
|
if (tab->supports_printer_technology(printer_technology)) {
|
||||||
|
|||||||
@@ -1803,10 +1803,8 @@ bool Sidebar::priv::switch_diameter_to(const wxString &diameter)
|
|||||||
auto* nozzle_diameter = dynamic_cast<const ConfigOptionFloats*>(printer_preset.config.option("nozzle_diameter"));
|
auto* nozzle_diameter = dynamic_cast<const ConfigOptionFloats*>(printer_preset.config.option("nozzle_diameter"));
|
||||||
if (nozzle_diameter && nozzle_diameter->size() > 0) {
|
if (nozzle_diameter && nozzle_diameter->size() > 0) {
|
||||||
auto current_nozzle_dia = get_diameter_string(nozzle_diameter->values[0]);
|
auto current_nozzle_dia = get_diameter_string(nozzle_diameter->values[0]);
|
||||||
// A named variant can share this diameter; selecting the plain diameter
|
// If the selected diameter is the same as current nozzle, don't switch profiles
|
||||||
// must still switch back to the standard profile.
|
if (current_nozzle_dia == diameter.ToStdString()) {
|
||||||
if (current_nozzle_dia == diameter.ToStdString() &&
|
|
||||||
printer_preset.config.opt_string("printer_variant") == diameter.ToStdString()) {
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -3928,18 +3926,13 @@ void Sidebar::update_presets(Preset::Type preset_type)
|
|||||||
combo_flow->Show(combo_flow->GetCount() > 0);
|
combo_flow->Show(combo_flow->GetCount() > 0);
|
||||||
};
|
};
|
||||||
|
|
||||||
auto update_extruder_diameter = [&diameters, &nozzle_diameter, &diameter](int extruder_index,ExtruderGroup & extruder) {
|
auto update_extruder_diameter = [&diameters, &nozzle_diameter](int extruder_index,ExtruderGroup & extruder) {
|
||||||
extruder.combo_diameter->Clear();
|
extruder.combo_diameter->Clear();
|
||||||
if (extruder_index >= int(nozzle_diameter->values.size()))
|
if (extruder_index >= int(nozzle_diameter->values.size()))
|
||||||
return;
|
return;
|
||||||
int select = -1;
|
int select = -1;
|
||||||
// ORCA get the actual nozzle diameter from printer config
|
// ORCA get the actual nozzle diameter from printer config
|
||||||
auto nozzle_dia = get_diameter_string(nozzle_diameter->values[extruder_index]);
|
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;
|
|
||||||
// ORCA try to add nozzle diameter from config if list is empty. fixes blank nozzle combo box when preset has no alias
|
// 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()){
|
if(!diameters.empty() && diameters[0].empty() && !nozzle_dia.empty()){
|
||||||
diameters[0] = nozzle_dia;
|
diameters[0] = nozzle_dia;
|
||||||
@@ -3949,7 +3942,7 @@ void Sidebar::update_presets(Preset::Type preset_type)
|
|||||||
diameters.push_back(nozzle_dia);
|
diameters.push_back(nozzle_dia);
|
||||||
}
|
}
|
||||||
for (size_t i = 0; i < diameters.size(); ++i) {
|
for (size_t i = 0; i < diameters.size(); ++i) {
|
||||||
if (diameters[i] == selected_variant)
|
if (diameters[i] == nozzle_dia)
|
||||||
select = extruder.combo_diameter->GetCount();
|
select = extruder.combo_diameter->GetCount();
|
||||||
extruder.combo_diameter->Append(diameters[i], {});
|
extruder.combo_diameter->Append(diameters[i], {});
|
||||||
}
|
}
|
||||||
|
|||||||
+25
-23
@@ -4396,16 +4396,16 @@ void TabFilament::build()
|
|||||||
optgroup->append_single_option_line("temperature_vitrification", "material_basic_information#softening-temperature");
|
optgroup->append_single_option_line("temperature_vitrification", "material_basic_information#softening-temperature");
|
||||||
optgroup->append_single_option_line("idle_temperature", "material_basic_information#idle-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 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", 0));
|
line.append_option(optgroup->get_option("nozzle_temperature_range_low"));
|
||||||
line.append_option(optgroup->get_option("nozzle_temperature_range_high", 0));
|
line.append_option(optgroup->get_option("nozzle_temperature_range_high"));
|
||||||
optgroup->append_line(line);
|
optgroup->append_line(line);
|
||||||
|
|
||||||
optgroup->m_on_change = [this, optgroup](t_config_option_key opt_key, boost::any value) {
|
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;
|
DynamicPrintConfig &filament_config = m_preset_bundle->filaments.get_edited_preset().config;
|
||||||
|
|
||||||
update_dirty();
|
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")) {
|
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, m_variant_combo ? std::max(0, m_variant_combo->GetSelection()) : 0);
|
m_config_manipulation.check_nozzle_recommended_temperature_range(&filament_config);
|
||||||
}
|
}
|
||||||
on_value_change(opt_key, value);
|
on_value_change(opt_key, value);
|
||||||
};
|
};
|
||||||
@@ -4532,11 +4532,11 @@ void TabFilament::build()
|
|||||||
else if (opt_key == "textured_plate_temp" || opt_key == "textured_plate_temp_initial_layer") {
|
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);
|
m_config_manipulation.check_bed_temperature_difference(BedType::btPTE, &filament_config);
|
||||||
}
|
}
|
||||||
else */if (opt_key.substr(0, opt_key.find('#')) == "nozzle_temperature") {
|
else */if (opt_key == "nozzle_temperature") {
|
||||||
m_config_manipulation.check_nozzle_temperature_range(&filament_config, m_variant_combo ? std::max(0, m_variant_combo->GetSelection()) : 0);
|
m_config_manipulation.check_nozzle_temperature_range(&filament_config);
|
||||||
}
|
}
|
||||||
else if (opt_key.substr(0, opt_key.find('#')) == "nozzle_temperature_initial_layer") {
|
else if (opt_key == "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);
|
m_config_manipulation.check_nozzle_temperature_initial_layer_range(&filament_config);
|
||||||
}
|
}
|
||||||
|
|
||||||
on_value_change(opt_key, value);
|
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");
|
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 = { 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.label_path = "material_cooling#material-part-cooling-fan";
|
||||||
line.append_option(optgroup->get_option("fan_min_speed", 0));
|
line.append_option(optgroup->get_option("fan_min_speed"));
|
||||||
line.append_option(optgroup->get_option("fan_cooling_layer_time"));
|
line.append_option(optgroup->get_option("fan_cooling_layer_time"));
|
||||||
optgroup->append_line(line);
|
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 = { 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.label_path = "material_cooling#material-part-cooling-fan";
|
||||||
line.append_option(optgroup->get_option("fan_max_speed", 0));
|
line.append_option(optgroup->get_option("fan_max_speed"));
|
||||||
line.append_option(optgroup->get_option("slow_down_layer_time"));
|
line.append_option(optgroup->get_option("slow_down_layer_time"));
|
||||||
optgroup->append_line(line);
|
optgroup->append_line(line);
|
||||||
optgroup->append_single_option_line("reduce_fan_stop_start_freq", "material_cooling#keep-fan-always-on");
|
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->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 = 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", 0);
|
optgroup->append_single_option_line("additional_cooling_fan_speed", "material_cooling#auxiliary-part-cooling-fan");
|
||||||
|
|
||||||
optgroup = page->new_optgroup(L("Exhaust fan"),L"param_cooling_exhaust");
|
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
|
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 = 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", 0);
|
optgroup->append_single_option_line("filament_minimal_purge_on_wipe_tower", "material_multimaterial#multimaterial-wipe-tower-parameters");
|
||||||
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_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_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");
|
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 = 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", 0);
|
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", 0);
|
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", 0);
|
optgroup->append_single_option_line("filament_multitool_ramming_flow", "material_multimaterial#multi-tool-ramming-flow");
|
||||||
|
|
||||||
page = add_options_page(L("Dependencies"), "advanced");
|
page = add_options_page(L("Dependencies"), "advanced");
|
||||||
optgroup = page->new_optgroup(L("Compatible printers"), "param_dependencies_printers");
|
optgroup = page->new_optgroup(L("Compatible printers"), "param_dependencies_printers");
|
||||||
@@ -4772,7 +4772,6 @@ void TabFilament::update_description_lines()
|
|||||||
|
|
||||||
void TabFilament::toggle_options()
|
void TabFilament::toggle_options()
|
||||||
{
|
{
|
||||||
const int variant_index = m_variant_combo ? std::max(0, m_variant_combo->GetSelection()) : 0;
|
|
||||||
if (!m_active_page)
|
if (!m_active_page)
|
||||||
return;
|
return;
|
||||||
bool is_BBL_printer = false;
|
bool is_BBL_printer = false;
|
||||||
@@ -4814,7 +4813,7 @@ void TabFilament::toggle_options()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
toggle_line("additional_cooling_fan_speed", printer_cfg.opt_bool("auxiliary_fan"), 256 + variant_index);
|
toggle_line("additional_cooling_fan_speed", printer_cfg.opt_bool("auxiliary_fan"));
|
||||||
|
|
||||||
bool support_air_filtration = printer_cfg.opt_bool("support_air_filtration");
|
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"})
|
for (auto el : {"activate_air_filtration", "during_print_exhaust_fan_speed", "complete_print_exhaust_fan_speed"})
|
||||||
@@ -4830,8 +4829,11 @@ void TabFilament::toggle_options()
|
|||||||
}
|
}
|
||||||
if (m_active_page->title() == L("Filament"))
|
if (m_active_page->title() == L("Filament"))
|
||||||
{
|
{
|
||||||
bool pa = m_config->opt_bool("enable_pressure_advance", variant_index);
|
const int selection = m_variant_combo ? m_variant_combo->GetSelection() : 0;
|
||||||
toggle_option("pressure_advance", pa, 256 + variant_index);
|
const unsigned int variant_idx = (unsigned int) std::max(selection, 0);
|
||||||
|
|
||||||
|
bool pa = m_config->opt_bool("enable_pressure_advance", variant_idx);
|
||||||
|
toggle_option("pressure_advance", pa, 0);
|
||||||
|
|
||||||
//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.
|
//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;
|
DynamicConfig& proj_cfg = m_preset_bundle->project_config;
|
||||||
@@ -4885,11 +4887,11 @@ void TabFilament::toggle_options()
|
|||||||
for (auto el : {"filament_minimal_purge_on_wipe_tower", "filament_loading_speed_start", "filament_loading_speed",
|
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_unloading_speed_start", "filament_unloading_speed", "filament_toolchange_delay", "filament_cooling_moves",
|
||||||
"filament_cooling_initial_speed", "filament_cooling_final_speed"})
|
"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);
|
bool multitool_ramming = m_config->opt_bool("filament_multitool_ramming", 0);
|
||||||
toggle_option("filament_multitool_ramming_volume", multitool_ramming, 256 + variant_index);
|
toggle_option("filament_multitool_ramming_volume", multitool_ramming);
|
||||||
toggle_option("filament_multitool_ramming_flow", multitool_ramming, 256 + variant_index);
|
toggle_option("filament_multitool_ramming_flow", multitool_ramming);
|
||||||
|
|
||||||
bool is_BBL_multi_extruder = is_BBL_printer && printer_cfg.option<ConfigOptionFloats>("nozzle_diameter")->size() > 1;
|
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 selection = m_variant_combo ? m_variant_combo->GetSelection() : 0;
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
#include <catch2/catch_all.hpp>
|
#include <catch2/catch_all.hpp>
|
||||||
|
|
||||||
#include "libslic3r/PrintConfig.hpp"
|
#include "libslic3r/PrintConfig.hpp"
|
||||||
#include "libslic3r/Preset.hpp"
|
|
||||||
|
|
||||||
using namespace Slic3r;
|
using namespace Slic3r;
|
||||||
|
|
||||||
@@ -31,95 +30,6 @@ void add_print_variant_columns(DynamicPrintConfig &config)
|
|||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
TEST_CASE("Filament cooling and pressure settings follow the selected nozzle variant", "[Config][FilamentVariants]")
|
|
||||||
{
|
|
||||||
struct Setting {
|
|
||||||
const char *key;
|
|
||||||
const char *standard;
|
|
||||||
const char *high_flow;
|
|
||||||
};
|
|
||||||
const Setting settings[] = {
|
|
||||||
{"enable_pressure_advance", "0", "1"},
|
|
||||||
{"pressure_advance", "0.04", "0.02"},
|
|
||||||
{"fan_min_speed", "15", "10"},
|
|
||||||
{"fan_max_speed", "15", "60"},
|
|
||||||
{"additional_cooling_fan_speed", "70", "0"},
|
|
||||||
{"filament_minimal_purge_on_wipe_tower", "0", "15"},
|
|
||||||
{"filament_multitool_ramming", "0", "1"},
|
|
||||||
{"filament_multitool_ramming_volume", "0", "5"},
|
|
||||||
{"filament_multitool_ramming_flow", "10", "30"},
|
|
||||||
{"nozzle_temperature_range_low", "190", "210"},
|
|
||||||
{"nozzle_temperature_range_high", "255", "280"},
|
|
||||||
};
|
|
||||||
const int variant_index = GENERATE(0, 1, 2, 3);
|
|
||||||
const int value_count = GENERATE(1, 2, 4);
|
|
||||||
const bool load_preset = GENERATE(false, true);
|
|
||||||
const bool high_flow = variant_index % 2 != 0;
|
|
||||||
for (const Setting &setting : settings) {
|
|
||||||
DYNAMIC_SECTION(setting.key << " variant=" << variant_index << " values=" << value_count << " loaded=" << load_preset) {
|
|
||||||
DynamicPrintConfig printer = make_hybrid_printer_config();
|
|
||||||
if (variant_index >= 2)
|
|
||||||
printer.option<ConfigOptionEnumsGeneric>("extruder_type")->values[1] = etBowden;
|
|
||||||
DynamicPrintConfig filament;
|
|
||||||
filament.option<ConfigOptionStrings>("filament_extruder_variant", true)->values =
|
|
||||||
{"Direct Drive Standard", "Direct Drive High Flow", "Bowden Standard", "Bowden High Flow"};
|
|
||||||
std::string values = setting.standard;
|
|
||||||
for (int i = 1; i < value_count; ++i)
|
|
||||||
values += std::string(",") + (i % 2 ? setting.high_flow : setting.standard);
|
|
||||||
REQUIRE(filament.option(setting.key, true)->deserialize(values));
|
|
||||||
|
|
||||||
if (load_preset) {
|
|
||||||
extend_default_config_length(filament, false, DynamicPrintConfig::full_print_config());
|
|
||||||
DynamicPrintConfig expanded;
|
|
||||||
std::string expanded_values = values;
|
|
||||||
for (int i = value_count; i < 4; ++i)
|
|
||||||
expanded_values += std::string(",") + setting.standard;
|
|
||||||
REQUIRE(expanded.option(setting.key, true)->deserialize(expanded_values));
|
|
||||||
REQUIRE(*filament.option(setting.key) == *expanded.option(setting.key));
|
|
||||||
}
|
|
||||||
|
|
||||||
std::vector<std::vector<NozzleVolumeType>> nozzle_types;
|
|
||||||
const int count = printer.get_extruder_nozzle_volume_count(2, nozzle_types);
|
|
||||||
filament.update_values_to_printer_extruders(printer, 2, count, nozzle_types,
|
|
||||||
filament_options_with_variant, "", "filament_extruder_variant", 1, 2,
|
|
||||||
high_flow ? nvtHighFlow : nvtStandard);
|
|
||||||
|
|
||||||
DynamicPrintConfig expected;
|
|
||||||
REQUIRE(expected.option(setting.key, true)->deserialize(high_flow && variant_index < value_count ? setting.high_flow : setting.standard));
|
|
||||||
REQUIRE(*filament.option(setting.key) == *expected.option(setting.key));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST_CASE("Filaments on the same hybrid tool keep their own cooling and pressure variants", "[Config][FilamentVariants]")
|
|
||||||
{
|
|
||||||
DynamicPrintConfig config = make_hybrid_printer_config();
|
|
||||||
config.option<ConfigOptionInts>("filament_self_index", true)->values = {1, 1, 2, 2};
|
|
||||||
config.option<ConfigOptionStrings>("filament_extruder_variant", true)->values =
|
|
||||||
{"Direct Drive Standard", "Direct Drive High Flow", "Direct Drive Standard", "Direct Drive High Flow"};
|
|
||||||
config.option<ConfigOptionInts>("filament_map", true)->values = {2, 2};
|
|
||||||
config.option<ConfigOptionInts>("filament_volume_map", true)->values = {nvtHighFlow, nvtStandard};
|
|
||||||
config.option<ConfigOptionFloats>("fan_max_speed", true)->values = {15., 60., 20., 80.};
|
|
||||||
config.option<ConfigOptionFloats>("pressure_advance", true)->values = {0.04, 0.02, 0.05, 0.03};
|
|
||||||
config.option<ConfigOptionBools>("filament_multitool_ramming", true)->values = {false, true, false, true};
|
|
||||||
std::vector<std::vector<NozzleVolumeType>> nozzle_types;
|
|
||||||
const int count = config.get_extruder_nozzle_volume_count(2, nozzle_types);
|
|
||||||
std::set<std::string> keys = filament_options_with_variant;
|
|
||||||
keys.insert("filament_self_index");
|
|
||||||
config.update_values_to_printer_extruders_for_multiple_filaments(config, 2, count, keys,
|
|
||||||
"filament_self_index", "filament_extruder_variant");
|
|
||||||
const auto &fan = config.option<ConfigOptionFloats>("fan_max_speed")->values;
|
|
||||||
REQUIRE(fan.size() == 2);
|
|
||||||
REQUIRE_THAT(fan[0], Catch::Matchers::WithinAbs(60., 1e-9));
|
|
||||||
REQUIRE_THAT(fan[1], Catch::Matchers::WithinAbs(20., 1e-9));
|
|
||||||
const auto &pa = config.option<ConfigOptionFloats>("pressure_advance")->values;
|
|
||||||
REQUIRE(pa.size() == 2);
|
|
||||||
REQUIRE_THAT(pa[0], Catch::Matchers::WithinAbs(0.02, 1e-9));
|
|
||||||
REQUIRE_THAT(pa[1], Catch::Matchers::WithinAbs(0.05, 1e-9));
|
|
||||||
REQUIRE(config.option<ConfigOptionBools>("filament_multitool_ramming")->get_at(0));
|
|
||||||
REQUIRE_FALSE(config.option<ConfigOptionBools>("filament_multitool_ramming")->get_at(1));
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST_CASE("apply_override fills nil entries from the 0-based default index", "[Config]")
|
TEST_CASE("apply_override fills nil entries from the 0-based default index", "[Config]")
|
||||||
{
|
{
|
||||||
ConfigOptionFloats machine({10., 20., 30.});
|
ConfigOptionFloats machine({10., 20., 30.});
|
||||||
|
|||||||
Reference in New Issue
Block a user