ENH:fixed incorrect prompt for glow material
jira:[STUDIO-10574] Change-Id: I4475eb527ffbc8cc6d72405445552971d062b45e
This commit is contained in:
parent
5728474378
commit
01918affdf
|
@ -77,7 +77,7 @@
|
||||||
{
|
{
|
||||||
"vendor": "Bambu Lab",
|
"vendor": "Bambu Lab",
|
||||||
"type": "PLA",
|
"type": "PLA",
|
||||||
"name": "Bambu PLA Glow",
|
"name": "PLA Glow",
|
||||||
"action": "warning",
|
"action": "warning",
|
||||||
"description": "PLA-Glow"
|
"description": "PLA-Glow"
|
||||||
},
|
},
|
||||||
|
|
|
@ -56,7 +56,7 @@ struct FilamentInfo
|
||||||
std::string slot_id;
|
std::string slot_id;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
int get_amd_id() const
|
int get_ams_id() const
|
||||||
{
|
{
|
||||||
if (ams_id.empty()) { return -1; };
|
if (ams_id.empty()) { return -1; };
|
||||||
|
|
||||||
|
@ -69,6 +69,17 @@ public:
|
||||||
return -1;
|
return -1;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
int get_slot_id() const
|
||||||
|
{
|
||||||
|
if (slot_id.empty()) { return -1; };
|
||||||
|
|
||||||
|
try {
|
||||||
|
return stoi(slot_id);
|
||||||
|
} catch (...) {};
|
||||||
|
|
||||||
|
return -1;
|
||||||
|
};
|
||||||
|
|
||||||
/*copied from AmsTray::get_display_filament_type()*/
|
/*copied from AmsTray::get_display_filament_type()*/
|
||||||
std::string get_display_filament_type()
|
std::string get_display_filament_type()
|
||||||
{
|
{
|
||||||
|
|
|
@ -568,13 +568,9 @@ void AMSMaterialsSetting::on_select_ok(wxCommandEvent &event)
|
||||||
|
|
||||||
auto vendor = dynamic_cast<ConfigOptionStrings *>(it->config.option("filament_vendor"));
|
auto vendor = dynamic_cast<ConfigOptionStrings *>(it->config.option("filament_vendor"));
|
||||||
|
|
||||||
PresetBundle *preset_bundle = GUI::wxGetApp().preset_bundle;
|
|
||||||
auto option = preset_bundle->get_filament_by_filament_id(filament_id);
|
|
||||||
auto tag_name = option ? option->filament_name : "";
|
|
||||||
|
|
||||||
if (vendor && (vendor->values.size() > 0)) {
|
if (vendor && (vendor->values.size() > 0)) {
|
||||||
std::string vendor_name = vendor->values[0];
|
std::string vendor_name = vendor->values[0];
|
||||||
DeviceManager::check_filaments_in_blacklist(vendor_name, filamnt_type, tag_name, ams_id, in_blacklist, action, info);
|
DeviceManager::check_filaments_in_blacklist(vendor_name, filamnt_type, ams_id, slot_id, in_blacklist, action, info);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (in_blacklist) {
|
if (in_blacklist) {
|
||||||
|
|
|
@ -1504,14 +1504,10 @@ bool CalibrationPresetPage::is_filament_in_blacklist(int tray_id, Preset* preset
|
||||||
std::string filamnt_type;
|
std::string filamnt_type;
|
||||||
preset->get_filament_type(filamnt_type);
|
preset->get_filament_type(filamnt_type);
|
||||||
|
|
||||||
PresetBundle *preset_bundle = GUI::wxGetApp().preset_bundle;
|
|
||||||
auto option = preset_bundle->get_filament_by_filament_id(preset->filament_id);
|
|
||||||
auto tag_name = option ? option->filament_name : "";
|
|
||||||
|
|
||||||
auto vendor = dynamic_cast<ConfigOptionStrings*> (preset->config.option("filament_vendor"));
|
auto vendor = dynamic_cast<ConfigOptionStrings*> (preset->config.option("filament_vendor"));
|
||||||
if (vendor && (vendor->values.size() > 0)) {
|
if (vendor && (vendor->values.size() > 0)) {
|
||||||
std::string vendor_name = vendor->values[0];
|
std::string vendor_name = vendor->values[0];
|
||||||
DeviceManager::check_filaments_in_blacklist(vendor_name, filamnt_type, tag_name, ams_id, in_blacklist, action, info);
|
DeviceManager::check_filaments_in_blacklist(vendor_name, filamnt_type, ams_id, slot_id, in_blacklist, action, info);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (in_blacklist) {
|
if (in_blacklist) {
|
||||||
|
|
|
@ -7426,6 +7426,32 @@ bool DeviceManager::is_virtual_slot(int ams_id)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string DeviceManager::get_filament_name_from_ams(int ams_id, int slot_id)
|
||||||
|
{
|
||||||
|
std::string name;
|
||||||
|
DeviceManager *dev = Slic3r::GUI::wxGetApp().getDeviceManager();
|
||||||
|
if (!dev) { return name; }
|
||||||
|
|
||||||
|
MachineObject *obj = dev->get_selected_machine();
|
||||||
|
if (obj == nullptr || !obj->is_multi_extruders()) { return name; }
|
||||||
|
|
||||||
|
if (ams_id < 0 || slot_id < 0 ) {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (obj->amsList.find(std::to_string(ams_id)) == obj->amsList.end()) {return name;}
|
||||||
|
|
||||||
|
if (obj->amsList[std::to_string(ams_id)]->trayList.find(std::to_string(slot_id)) == obj->amsList[std::to_string(ams_id)]->trayList.end()) { return name; }
|
||||||
|
|
||||||
|
std::string filament_id = obj->amsList[std::to_string(ams_id)]->trayList[std::to_string(slot_id)]->setting_id;
|
||||||
|
|
||||||
|
PresetBundle *preset_bundle = GUI::wxGetApp().preset_bundle;
|
||||||
|
auto option = preset_bundle->get_filament_by_filament_id(filament_id);
|
||||||
|
name = option ? option->filament_name : "";
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
bool DeviceManager::check_filaments_printable(const std::string &tag_vendor, const std::string &tag_type, int ams_id, bool &in_blacklist, std::string &ac, std::string &info)
|
bool DeviceManager::check_filaments_printable(const std::string &tag_vendor, const std::string &tag_type, int ams_id, bool &in_blacklist, std::string &ac, std::string &info)
|
||||||
{
|
{
|
||||||
DeviceManager *dev = Slic3r::GUI::wxGetApp().getDeviceManager();
|
DeviceManager *dev = Slic3r::GUI::wxGetApp().getDeviceManager();
|
||||||
|
@ -7468,8 +7494,12 @@ bool DeviceManager::check_filaments_printable(const std::string &tag_vendor, con
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DeviceManager::check_filaments_in_blacklist(std::string tag_vendor, std::string tag_type, std::string tag_name, int ams_id, bool& in_blacklist, std::string& ac, std::string& info)
|
void DeviceManager::check_filaments_in_blacklist(std::string tag_vendor, std::string tag_type, int ams_id, int slot_id, bool& in_blacklist, std::string& ac, std::string& info)
|
||||||
{
|
{
|
||||||
|
if (ams_id < 0 || slot_id < 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (!check_filaments_printable(tag_vendor, tag_type, ams_id, in_blacklist, ac, info)) {
|
if (!check_filaments_printable(tag_vendor, tag_type, ams_id, in_blacklist, ac, info)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -7479,6 +7509,8 @@ void DeviceManager::check_filaments_in_blacklist(std::string tag_vendor, std::st
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string tag_name = get_filament_name_from_ams(ams_id, slot_id);
|
||||||
|
|
||||||
std::unordered_map<std::string, wxString> blacklist_prompt =
|
std::unordered_map<std::string, wxString> blacklist_prompt =
|
||||||
{
|
{
|
||||||
{"TPU: not supported", _L("TPU is not supported by AMS.")},
|
{"TPU: not supported", _L("TPU is not supported by AMS.")},
|
||||||
|
@ -7508,8 +7540,6 @@ void DeviceManager::check_filaments_in_blacklist(std::string tag_vendor, std::st
|
||||||
type = prohibited_filament["type"].get<std::string>();
|
type = prohibited_filament["type"].get<std::string>();
|
||||||
action = prohibited_filament["action"].get<std::string>();
|
action = prohibited_filament["action"].get<std::string>();
|
||||||
description = prohibited_filament["description"].get<std::string>();
|
description = prohibited_filament["description"].get<std::string>();
|
||||||
|
|
||||||
description = blacklist_prompt[description].ToUTF8().data();
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return;
|
return;
|
||||||
|
@ -7526,23 +7556,27 @@ void DeviceManager::check_filaments_in_blacklist(std::string tag_vendor, std::st
|
||||||
|
|
||||||
//third party
|
//third party
|
||||||
if (vendor == "third party") {
|
if (vendor == "third party") {
|
||||||
if ("bambu lab" != tag_vendor && (tag_type == type || tag_name == name)) {
|
if ("bambu lab" != tag_vendor && tag_type == type) {
|
||||||
|
if (name == "undefine" || (tag_name.find(name) != std::string::npos)) {
|
||||||
in_blacklist = true;
|
in_blacklist = true;
|
||||||
ac = action;
|
ac = action;
|
||||||
info = description;
|
info = blacklist_prompt[description].ToUTF8().data();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
if (vendor == tag_vendor && (tag_type == type || tag_name == name)) {
|
if (vendor == tag_vendor && tag_type == type) {
|
||||||
|
if (name == "undefine" || (tag_name.find(name) != std::string::npos)) {
|
||||||
in_blacklist = true;
|
in_blacklist = true;
|
||||||
ac = action;
|
ac = action;
|
||||||
info = description;
|
info = blacklist_prompt[description].ToUTF8().data();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string DeviceManager::load_gcode(std::string type_str, std::string gcode_file)
|
std::string DeviceManager::load_gcode(std::string type_str, std::string gcode_file)
|
||||||
|
|
|
@ -1392,11 +1392,12 @@ public:
|
||||||
static bool load_filaments_blacklist_config();
|
static bool load_filaments_blacklist_config();
|
||||||
static std::vector<std::string> get_resolution_supported(std::string type_str);
|
static std::vector<std::string> get_resolution_supported(std::string type_str);
|
||||||
static std::vector<std::string> get_compatible_machine(std::string type_str);
|
static std::vector<std::string> get_compatible_machine(std::string type_str);
|
||||||
static void check_filaments_in_blacklist(std::string tag_vendor, std::string tag_type, std::string tag_name, int ams_id, bool &in_blacklist, std::string &ac, std::string &info);
|
static void check_filaments_in_blacklist(std::string tag_vendor, std::string tag_type, int ams_id, int slot_id, bool &in_blacklist, std::string &ac, std::string &info);
|
||||||
static bool check_filaments_printable(const std::string &tag_vendor, const std::string &tag_type, int ams_id, bool &in_blacklist, std::string &ac, std::string &info);
|
static bool check_filaments_printable(const std::string &tag_vendor, const std::string &tag_type, int ams_id, bool &in_blacklist, std::string &ac, std::string &info);
|
||||||
static boost::bimaps::bimap<std::string, std::string> get_all_model_id_with_name();
|
static boost::bimaps::bimap<std::string, std::string> get_all_model_id_with_name();
|
||||||
static std::string load_gcode(std::string type_str, std::string gcode_file);
|
static std::string load_gcode(std::string type_str, std::string gcode_file);
|
||||||
static bool is_virtual_slot(int ams_id);
|
static bool is_virtual_slot(int ams_id);
|
||||||
|
static std::string get_filament_name_from_ams(int ams_id, int slot_id);
|
||||||
};
|
};
|
||||||
|
|
||||||
// change the opacity
|
// change the opacity
|
||||||
|
|
|
@ -2146,29 +2146,25 @@ void SelectMachineDialog::on_ok_btn(wxCommandEvent &event)
|
||||||
//check blacklist
|
//check blacklist
|
||||||
for (auto i = 0; i < m_ams_mapping_result.size(); i++) {
|
for (auto i = 0; i < m_ams_mapping_result.size(); i++) {
|
||||||
|
|
||||||
const auto& ams_id = m_ams_mapping_result[i].get_amd_id();
|
const auto& ams_id = m_ams_mapping_result[i].get_ams_id();
|
||||||
|
const auto& slot_id = m_ams_mapping_result[i].get_slot_id();
|
||||||
|
|
||||||
auto tid = m_ams_mapping_result[i].tray_id;
|
auto tid = m_ams_mapping_result[i].tray_id;
|
||||||
|
|
||||||
std::string filament_type = boost::to_upper_copy(m_ams_mapping_result[i].type);
|
std::string filament_type = boost::to_upper_copy(m_ams_mapping_result[i].type);
|
||||||
std::string filament_brand;
|
std::string filament_brand;
|
||||||
std::string filament_id;
|
|
||||||
|
|
||||||
for (auto fs : m_filaments) {
|
for (auto fs : m_filaments) {
|
||||||
if (fs.id == m_ams_mapping_result[i].id) {
|
if (fs.id == m_ams_mapping_result[i].id) {
|
||||||
filament_brand = m_filaments[i].brand;
|
filament_brand = m_filaments[i].brand;
|
||||||
filament_id = m_filaments[i].filament_id;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
PresetBundle *preset_bundle = GUI::wxGetApp().preset_bundle;
|
|
||||||
auto option = preset_bundle->get_filament_by_filament_id(filament_id);
|
|
||||||
auto tag_name = option ? option->filament_name : "";
|
|
||||||
|
|
||||||
bool in_blacklist = false;
|
bool in_blacklist = false;
|
||||||
std::string action;
|
std::string action;
|
||||||
std::string info;
|
std::string info;
|
||||||
|
|
||||||
DeviceManager::check_filaments_in_blacklist(filament_brand, filament_type, tag_name, ams_id, in_blacklist, action, info);
|
DeviceManager::check_filaments_in_blacklist(filament_brand, filament_type, ams_id, slot_id, in_blacklist, action, info);
|
||||||
|
|
||||||
if (in_blacklist && action == "warning") {
|
if (in_blacklist && action == "warning") {
|
||||||
wxString prohibited_error = wxString::FromUTF8(info);
|
wxString prohibited_error = wxString::FromUTF8(info);
|
||||||
|
@ -2227,7 +2223,9 @@ void SelectMachineDialog::on_ok_btn(wxCommandEvent &event)
|
||||||
|
|
||||||
for (auto i = 0; i < m_ams_mapping_result.size(); i++) {
|
for (auto i = 0; i < m_ams_mapping_result.size(); i++) {
|
||||||
|
|
||||||
const auto& ams_id = m_ams_mapping_result[i].get_amd_id();
|
const auto& ams_id = m_ams_mapping_result[i].get_ams_id();
|
||||||
|
const auto& slot_id = m_ams_mapping_result[i].get_slot_id();
|
||||||
|
|
||||||
auto tid = m_ams_mapping_result[i].tray_id;
|
auto tid = m_ams_mapping_result[i].tray_id;
|
||||||
|
|
||||||
std::string filament_type = boost::to_upper_copy(m_ams_mapping_result[i].type);
|
std::string filament_type = boost::to_upper_copy(m_ams_mapping_result[i].type);
|
||||||
|
@ -2241,14 +2239,10 @@ void SelectMachineDialog::on_ok_btn(wxCommandEvent &event)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
PresetBundle *preset_bundle = GUI::wxGetApp().preset_bundle;
|
|
||||||
auto option = preset_bundle->get_filament_by_filament_id(filament_id);
|
|
||||||
auto tag_name = option ? option->filament_name : "";
|
|
||||||
|
|
||||||
bool in_blacklist = false;
|
bool in_blacklist = false;
|
||||||
std::string action;
|
std::string action;
|
||||||
std::string info;
|
std::string info;
|
||||||
DeviceManager::check_filaments_in_blacklist(filament_brand, filament_type, tag_name, ams_id, in_blacklist, action, info);
|
DeviceManager::check_filaments_in_blacklist(filament_brand, filament_type, ams_id, slot_id, in_blacklist, action, info);
|
||||||
|
|
||||||
if (in_blacklist && action == "prohibition") {
|
if (in_blacklist && action == "prohibition") {
|
||||||
has_prohibited_filament = true;
|
has_prohibited_filament = true;
|
||||||
|
|
Loading…
Reference in New Issue