mirror of
https://git.mirrors.martin98.com/https://github.com/bambulab/BambuStudio.git
synced 2025-08-02 03:40:40 +08:00
ENH: update the filaments_blacklist functions
jira: [STUDIO-11883] Change-Id: Ib75383f4e75a0bcd566dcf555695f2a9f45f0cba
This commit is contained in:
parent
529687a2d2
commit
6a12adb7f0
@ -3,74 +3,22 @@
|
|||||||
],
|
],
|
||||||
"blacklist": [
|
"blacklist": [
|
||||||
{
|
{
|
||||||
"vendor": "Third Party",
|
|
||||||
"type": "TPU",
|
"type": "TPU",
|
||||||
"action": "prohibition",
|
"action": "prohibition",
|
||||||
"description": "TPU: not supported"
|
"description": "TPU: not supported"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"vendor": "Bambu Lab",
|
|
||||||
"type": "TPU",
|
|
||||||
"action": "prohibition",
|
|
||||||
"description": "TPU: not supported"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"vendor": "Third Party",
|
|
||||||
"type": "PVA",
|
"type": "PVA",
|
||||||
"action": "warning",
|
"action": "warning",
|
||||||
"description": "PVA: flexible"
|
"description": "PVA: flexible"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"vendor": "Bambu Lab",
|
"type_suffix": "CF",
|
||||||
"type": "PVA",
|
|
||||||
"action": "warning",
|
|
||||||
"description": "PVA: flexible"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"vendor": "Third Party",
|
|
||||||
"type": "PLA-CF",
|
|
||||||
"action": "warning",
|
"action": "warning",
|
||||||
"description": "CF/GF: hard and brittle"
|
"description": "CF/GF: hard and brittle"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"vendor": "Third Party",
|
"type_suffix": "GF",
|
||||||
"type": "PETG-CF",
|
|
||||||
"action": "warning",
|
|
||||||
"description": "CF/GF: hard and brittle"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"vendor": "Third Party",
|
|
||||||
"type": "PA-CF",
|
|
||||||
"action": "warning",
|
|
||||||
"description": "CF/GF: hard and brittle"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"vendor": "Third Party",
|
|
||||||
"type": "PAHT-CF",
|
|
||||||
"action": "warning",
|
|
||||||
"description": "CF/GF: hard and brittle"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"vendor": "Third Party",
|
|
||||||
"type": "PET-CF",
|
|
||||||
"action": "warning",
|
|
||||||
"description": "CF/GF: hard and brittle"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"vendor": "Third Party",
|
|
||||||
"type": "PA6-CF",
|
|
||||||
"action": "warning",
|
|
||||||
"description": "CF/GF: hard and brittle"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"vendor": "Third Party",
|
|
||||||
"type": "PPS-CF",
|
|
||||||
"action": "warning",
|
|
||||||
"description": "CF/GF: hard and brittle"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"vendor": "Third Party",
|
|
||||||
"type": "PPA-CF",
|
|
||||||
"action": "warning",
|
"action": "warning",
|
||||||
"description": "CF/GF: hard and brittle"
|
"description": "CF/GF: hard and brittle"
|
||||||
},
|
},
|
||||||
@ -81,30 +29,6 @@
|
|||||||
"model_id":["N1","N2S"],
|
"model_id":["N1","N2S"],
|
||||||
"action": "warning",
|
"action": "warning",
|
||||||
"description": "PLA-Glow"
|
"description": "PLA-Glow"
|
||||||
},
|
|
||||||
{
|
|
||||||
"vendor": "Bambu Lab",
|
|
||||||
"type": "PET-CF",
|
|
||||||
"action": "warning",
|
|
||||||
"description": "CF/GF: hard and brittle"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"vendor": "Bambu Lab",
|
|
||||||
"type": "PA6-CF",
|
|
||||||
"action": "warning",
|
|
||||||
"description": "CF/GF: hard and brittle"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"vendor": "Bambu Lab",
|
|
||||||
"type": "PPS-CF",
|
|
||||||
"action": "warning",
|
|
||||||
"description": "CF/GF: hard and brittle"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"vendor": "Bambu Lab",
|
|
||||||
"type": "PPA-CF",
|
|
||||||
"action": "warning",
|
|
||||||
"description": "CF/GF: hard and brittle"
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
@ -1 +1 @@
|
|||||||
02.00.00.22
|
02.00.00.24
|
@ -7948,91 +7948,55 @@ void check_filaments_for_ams_slot(std::string model_id,
|
|||||||
|
|
||||||
in_blacklist = false;
|
in_blacklist = false;
|
||||||
|
|
||||||
if (DeviceManager::filaments_blacklist.contains("blacklist"))
|
|
||||||
{
|
|
||||||
for (auto prohibited_filament : DeviceManager::filaments_blacklist["blacklist"])
|
|
||||||
{
|
|
||||||
|
|
||||||
std::string vendor;
|
|
||||||
std::string type;
|
|
||||||
std::string action;
|
|
||||||
std::string description;
|
|
||||||
std::string name = "undefine";
|
|
||||||
std::vector<std::string> model_ids;
|
|
||||||
|
|
||||||
if (prohibited_filament.contains("vendor") &&
|
|
||||||
prohibited_filament.contains("type") &&
|
|
||||||
prohibited_filament.contains("action") &&
|
|
||||||
prohibited_filament.contains("description"))
|
|
||||||
{
|
|
||||||
vendor = prohibited_filament["vendor"].get<std::string>();
|
|
||||||
type = prohibited_filament["type"].get<std::string>();
|
|
||||||
action = prohibited_filament["action"].get<std::string>();
|
|
||||||
description = prohibited_filament["description"].get<std::string>();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (prohibited_filament.contains("name"))
|
|
||||||
{
|
|
||||||
name = prohibited_filament["name"].get<std::string>();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (prohibited_filament.contains("model_id"))
|
|
||||||
{
|
|
||||||
for (auto res : prohibited_filament["model_id"])
|
|
||||||
model_ids.emplace_back(res.get<std::string>());
|
|
||||||
}
|
|
||||||
|
|
||||||
std::transform(vendor.begin(), vendor.end(), vendor.begin(), ::tolower);
|
|
||||||
std::transform(tag_vendor.begin(), tag_vendor.end(), tag_vendor.begin(), ::tolower);
|
std::transform(tag_vendor.begin(), tag_vendor.end(), tag_vendor.begin(), ::tolower);
|
||||||
std::transform(tag_type.begin(), tag_type.end(), tag_type.begin(), ::tolower);
|
std::transform(tag_type.begin(), tag_type.end(), tag_type.begin(), ::tolower);
|
||||||
|
std::transform(tag_name.begin(), tag_name.end(), tag_name.begin(), ::tolower);
|
||||||
|
if (DeviceManager::filaments_blacklist.contains("blacklist")) {
|
||||||
|
for (auto filament_item : DeviceManager::filaments_blacklist["blacklist"]) {
|
||||||
|
|
||||||
|
std::string vendor = filament_item.contains("vendor") ? filament_item["vendor"].get<std::string>() : "";
|
||||||
|
std::string type = filament_item.contains("type") ? filament_item["type"].get<std::string>() : "";
|
||||||
|
std::string type_suffix = filament_item.contains("type_suffix") ? filament_item["type_suffix"].get<std::string>() : "";
|
||||||
|
std::string name = filament_item.contains("name") ? filament_item["name"].get<std::string>() : "";
|
||||||
|
std::vector<std::string> model_ids = filament_item.contains("model_id") ? filament_item["model_id"].get<std::vector<std::string>>() : std::vector<std::string>();
|
||||||
|
std::string action = filament_item.contains("action") ? filament_item["action"].get<std::string>() : "";
|
||||||
|
std::string description = filament_item.contains("description") ? filament_item["description"].get<std::string>() : "";
|
||||||
|
|
||||||
|
// check model id
|
||||||
|
if (!model_ids.empty() && std::find(model_ids.begin(), model_ids.end(), model_id) == model_ids.end()) { continue;}
|
||||||
|
|
||||||
|
// check vendor
|
||||||
|
std::transform(vendor.begin(), vendor.end(), vendor.begin(), ::tolower);
|
||||||
|
if (!vendor.empty()) {
|
||||||
|
if ((vendor == "bambu lab" && (tag_vendor == vendor)) ||
|
||||||
|
(vendor == "third party" && (tag_vendor != "bambu lab"))){
|
||||||
|
// Do nothing
|
||||||
|
} else {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// check type
|
||||||
std::transform(type.begin(), type.end(), type.begin(), ::tolower);
|
std::transform(type.begin(), type.end(), type.begin(), ::tolower);
|
||||||
|
if (!type.empty() && (type != tag_type)) { continue; }
|
||||||
|
|
||||||
|
// check type suffix
|
||||||
|
std::transform(type_suffix.begin(), type_suffix.end(), type_suffix.begin(), ::tolower);
|
||||||
|
if (!type_suffix.empty()) {
|
||||||
|
if (tag_type.length() < type_suffix.length()) { continue; }
|
||||||
|
if ((tag_type.substr(tag_type.length() - type_suffix.length()) != type_suffix)) { continue; }
|
||||||
|
}
|
||||||
|
|
||||||
bool mactch_printer = false;
|
// check name
|
||||||
auto it = std::find(model_ids.begin(), model_ids.end(), model_id);
|
std::transform(name.begin(), name.end(), name.begin(), ::tolower);
|
||||||
if (it != model_ids.end()) { mactch_printer = true; }
|
if (!name.empty() && (name != tag_name)) { continue;}
|
||||||
|
|
||||||
// third party
|
|
||||||
if (vendor == "third party")
|
|
||||||
{
|
|
||||||
if ("bambu lab" != tag_vendor && tag_type == type)
|
|
||||||
{
|
|
||||||
if (name == "undefine" || (tag_name.find(name) != std::string::npos))
|
|
||||||
{
|
|
||||||
|
|
||||||
if (model_ids.empty() || mactch_printer)
|
|
||||||
{
|
|
||||||
in_blacklist = true;
|
in_blacklist = true;
|
||||||
ac = action;
|
ac = action;
|
||||||
info = blacklist_prompt[description].ToStdString();
|
info = blacklist_prompt[description].ToStdString();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (vendor == tag_vendor && tag_type == type)
|
|
||||||
{
|
|
||||||
if (name == "undefine" || (tag_name.find(name) != std::string::npos))
|
|
||||||
{
|
|
||||||
|
|
||||||
if (model_ids.empty() || mactch_printer)
|
|
||||||
{
|
|
||||||
in_blacklist = true;
|
|
||||||
ac = action;
|
|
||||||
info = blacklist_prompt[description].ToStdString();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user