mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-08-31 05:47:02 +00:00
NEW: [4073] create new nozzle for exist printer
Jira: STUDIO-4073 Change-Id: Idee8067faf96d75cdf20928559c05debcf9b3f3b
This commit is contained in:
@@ -2150,7 +2150,7 @@ bool PresetCollection::create_presets_from_template_for_printer(std::vector<Pres
|
||||
bool force_rewritten)
|
||||
{
|
||||
return clone_presets(templates, failures, [printer, create_filament_id](Preset &preset, Preset::Type &type) {
|
||||
preset.name = preset.name.substr(0, preset.name.find("@")) + " @" + printer;
|
||||
preset.name = preset.name.substr(0, preset.name.find(" @")) + " @" + printer;
|
||||
auto *compatible_printers = dynamic_cast<ConfigOptionStrings *>(preset.config.option("compatible_printers"));
|
||||
compatible_printers->values = std::vector<std::string>{ printer };
|
||||
preset.is_visible = true;
|
||||
@@ -2882,6 +2882,21 @@ const Preset* PrinterPresetCollection::find_system_preset_by_model_and_variant(c
|
||||
return it != cend() ? &*it : nullptr;
|
||||
}
|
||||
|
||||
const Preset *PrinterPresetCollection::find_custom_preset_by_model_and_variant(const std::string &model_id, const std::string &variant) const
|
||||
{
|
||||
if (model_id.empty()) { return nullptr; }
|
||||
|
||||
const auto it = std::find_if(cbegin(), cend(), [&](const Preset &preset) {
|
||||
if (preset.config.opt_string("printer_model") != model_id)
|
||||
return false;
|
||||
if (variant.empty())
|
||||
return true;
|
||||
return preset.config.opt_string("printer_variant") == variant;
|
||||
});
|
||||
|
||||
return it != cend() ? &*it : nullptr;
|
||||
}
|
||||
|
||||
bool PrinterPresetCollection::only_default_printers() const
|
||||
{
|
||||
for (const auto& printer : get_presets()) {
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
#define PRESET_PROFILES_DIR "profiles"
|
||||
#define PRESET_PROFILES_TEMOLATE_DIR "profiles_template"
|
||||
#define PRESET_TEMPLATE_DIR "Template"
|
||||
#define PRESET_CUSTOM_VENDOR "Custom"
|
||||
|
||||
//BBS: iot preset type strings
|
||||
#define PRESET_IOT_PRINTER_TYPE "printer"
|
||||
@@ -777,6 +778,7 @@ public:
|
||||
const Preset& default_preset_for(const DynamicPrintConfig &config) const override;
|
||||
|
||||
const Preset* find_system_preset_by_model_and_variant(const std::string &model_id, const std::string &variant) const;
|
||||
const Preset* find_custom_preset_by_model_and_variant(const std::string &model_id, const std::string &variant) const;
|
||||
|
||||
bool only_default_printers() const;
|
||||
private:
|
||||
|
||||
@@ -1324,8 +1324,8 @@ std::pair<PresetsConfigSubstitutions, std::string> PresetBundle::load_system_fil
|
||||
VendorProfile PresetBundle::get_custom_vendor_models() const
|
||||
{
|
||||
VendorProfile vendor;
|
||||
vendor.name = "Custom";
|
||||
vendor.id = "Custom";
|
||||
vendor.name = PRESET_CUSTOM_VENDOR;
|
||||
vendor.id = PRESET_CUSTOM_VENDOR;
|
||||
for (auto &preset : printers.get_presets()) {
|
||||
if (preset.is_system) continue;
|
||||
if (printers.get_preset_base(preset) != &preset) continue;
|
||||
@@ -1336,7 +1336,9 @@ VendorProfile PresetBundle::get_custom_vendor_models() const
|
||||
});
|
||||
if (iter_model == vendor.models.end()) {
|
||||
iter_model = vendor.models.emplace(vendor.models.end(), VendorProfile::PrinterModel{});
|
||||
iter_model->name = model;
|
||||
iter_model->id = model;
|
||||
iter_model->name = model;
|
||||
iter_model->variants = {VendorProfile::PrinterVariant(variant)};
|
||||
}
|
||||
}
|
||||
return vendor;
|
||||
|
||||
Reference in New Issue
Block a user