FIX: seprate filament_type and display_filament_type
special case for "Support G" and "Support W" Change-Id: I26f873083d6afb58fb10ebc9beef54fbf5e18320 Signed-off-by: Stone Li <stone.li@bambulab.com>
This commit is contained in:
parent
b4c7d5b65b
commit
ea7aaf7a8d
|
@ -637,9 +637,9 @@ void Preset::set_visible_from_appconfig(const AppConfig &app_config)
|
||||||
BOOST_LOG_TRIVIAL(debug) << __FUNCTION__ << boost::format(": name %1%, is_visible set to %2%")%name % is_visible;
|
BOOST_LOG_TRIVIAL(debug) << __FUNCTION__ << boost::format(": name %1%, is_visible set to %2%")%name % is_visible;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string Preset::get_filament_type()
|
std::string Preset::get_filament_type(std::string &display_filament_type)
|
||||||
{
|
{
|
||||||
return config.get_filament_type();
|
return config.get_filament_type(display_filament_type);
|
||||||
}
|
}
|
||||||
|
|
||||||
static std::vector<std::string> s_Preset_print_options {
|
static std::vector<std::string> s_Preset_print_options {
|
||||||
|
|
|
@ -295,7 +295,7 @@ public:
|
||||||
bool operator<(const Preset &other) const { return this->name < other.name; }
|
bool operator<(const Preset &other) const { return this->name < other.name; }
|
||||||
|
|
||||||
// special for upport G and Support W
|
// special for upport G and Support W
|
||||||
std::string get_filament_type();
|
std::string get_filament_type(std::string &display_filament_type);
|
||||||
|
|
||||||
static const std::vector<std::string>& print_options();
|
static const std::vector<std::string>& print_options();
|
||||||
static const std::vector<std::string>& filament_options();
|
static const std::vector<std::string>& filament_options();
|
||||||
|
|
|
@ -3587,7 +3587,7 @@ std::string DynamicPrintConfig::validate()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string DynamicPrintConfig::get_filament_type(int id)
|
std::string DynamicPrintConfig::get_filament_type(std::string &displayed_filament_type, int id)
|
||||||
{
|
{
|
||||||
auto* filament_id = dynamic_cast<const ConfigOptionStrings*>(this->option("filament_id"));
|
auto* filament_id = dynamic_cast<const ConfigOptionStrings*>(this->option("filament_id"));
|
||||||
auto* filament_type = dynamic_cast<const ConfigOptionStrings*>(this->option("filament_type"));
|
auto* filament_type = dynamic_cast<const ConfigOptionStrings*>(this->option("filament_type"));
|
||||||
|
@ -3598,9 +3598,11 @@ std::string DynamicPrintConfig::get_filament_type(int id)
|
||||||
|
|
||||||
if (!filament_is_support) {
|
if (!filament_is_support) {
|
||||||
if (filament_type) {
|
if (filament_type) {
|
||||||
|
displayed_filament_type = filament_type->get_at(id);
|
||||||
return filament_type->get_at(id);
|
return filament_type->get_at(id);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
displayed_filament_type = "";
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3609,25 +3611,33 @@ std::string DynamicPrintConfig::get_filament_type(int id)
|
||||||
if (is_support) {
|
if (is_support) {
|
||||||
if (filament_id) {
|
if (filament_id) {
|
||||||
if (filament_id->get_at(id) == "GFS00") {
|
if (filament_id->get_at(id) == "GFS00") {
|
||||||
return "Support W";
|
displayed_filament_type = "Support W";
|
||||||
|
return "PLA-S";
|
||||||
}
|
}
|
||||||
else if (filament_id->get_at(id) == "GFS01") {
|
else if (filament_id->get_at(id) == "GFS01") {
|
||||||
return "Support G";
|
displayed_filament_type = "Support G";
|
||||||
|
return "PA-S";
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
displayed_filament_type = filament_type->get_at(id);
|
||||||
return filament_type->get_at(id);
|
return filament_type->get_at(id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (filament_type->get_at(id) == "PLA")
|
if (filament_type->get_at(id) == "PLA") {
|
||||||
return "Support W";
|
displayed_filament_type = "Support W";
|
||||||
else if (filament_type->get_at(id) == "PA")
|
return "PLA-S";
|
||||||
return "Support G";
|
} else if (filament_type->get_at(id) == "PA") {
|
||||||
else
|
displayed_filament_type = "Support G";
|
||||||
|
return "PA-S";
|
||||||
|
} else {
|
||||||
|
displayed_filament_type = filament_type->get_at(id);
|
||||||
return filament_type->get_at(id);
|
return filament_type->get_at(id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
|
displayed_filament_type = filament_type->get_at(id);
|
||||||
return filament_type->get_at(id);
|
return filament_type->get_at(id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -325,7 +325,7 @@ public:
|
||||||
{ PrintConfigDef::handle_legacy(opt_key, value); }
|
{ PrintConfigDef::handle_legacy(opt_key, value); }
|
||||||
|
|
||||||
//BBS special case Support G/ Support W
|
//BBS special case Support G/ Support W
|
||||||
std::string get_filament_type(int id = 0);
|
std::string get_filament_type(std::string &displayed_filament_type, int id = 0);
|
||||||
};
|
};
|
||||||
|
|
||||||
void handle_legacy_sla(DynamicPrintConfig &config);
|
void handle_legacy_sla(DynamicPrintConfig &config);
|
||||||
|
|
|
@ -508,7 +508,8 @@ void AMSMaterialsSetting::on_select_filament(wxCommandEvent &evt)
|
||||||
if (opt_type_strs) {
|
if (opt_type_strs) {
|
||||||
found_filament_type = true;
|
found_filament_type = true;
|
||||||
//m_filament_type = opt_type_strs->get_at(0);
|
//m_filament_type = opt_type_strs->get_at(0);
|
||||||
m_filament_type = it->config.get_filament_type();
|
std::string display_filament_type;
|
||||||
|
m_filament_type = it->config.get_filament_type(display_filament_type);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!found_filament_type)
|
if (!found_filament_type)
|
||||||
|
|
|
@ -275,7 +275,7 @@ void AmsMapingPopup::on_left_down(wxMouseEvent &evt)
|
||||||
auto left = item->GetSize();
|
auto left = item->GetSize();
|
||||||
|
|
||||||
if (pos.x > p_rect.x && pos.y > p_rect.y && pos.x < (p_rect.x + item->GetSize().x) && pos.y < (p_rect.y + item->GetSize().y)) {
|
if (pos.x > p_rect.x && pos.y > p_rect.y && pos.x < (p_rect.x + item->GetSize().x) && pos.y < (p_rect.y + item->GetSize().y)) {
|
||||||
if (item->m_tray_data.type == TrayType::NORMAL && !is_match_material(item->m_tray_data.name)) return;
|
if (item->m_tray_data.type == TrayType::NORMAL && !is_match_material(item->m_tray_data.filament_type)) return;
|
||||||
item->send_event(m_current_filament_id);
|
item->send_event(m_current_filament_id);
|
||||||
Dismiss();
|
Dismiss();
|
||||||
}
|
}
|
||||||
|
@ -318,7 +318,8 @@ void AmsMapingPopup::update_ams_data(std::map<std::string, Ams*> amsList)
|
||||||
} else {
|
} else {
|
||||||
td.type = NORMAL;
|
td.type = NORMAL;
|
||||||
td.colour = AmsTray::decode_color(tray_data->color);
|
td.colour = AmsTray::decode_color(tray_data->color);
|
||||||
td.name = tray_data->type;
|
td.name = tray_data->get_display_filament_type();
|
||||||
|
td.filament_type = tray_data->get_filament_type();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -356,7 +357,7 @@ void AmsMapingPopup::add_ams_mapping(std::vector<TrayData> tray_data)
|
||||||
m_mapping_item_list.push_back(m_filament_name);
|
m_mapping_item_list.push_back(m_filament_name);
|
||||||
|
|
||||||
if (tray_data[i].type == NORMAL) {
|
if (tray_data[i].type == NORMAL) {
|
||||||
if (is_match_material(tray_data[i].name)) {
|
if (is_match_material(tray_data[i].filament_type)) {
|
||||||
m_filament_name->set_data(tray_data[i].colour, tray_data[i].name, tray_data[i]);
|
m_filament_name->set_data(tray_data[i].colour, tray_data[i].name, tray_data[i]);
|
||||||
} else {
|
} else {
|
||||||
m_filament_name->set_data(wxColour(0xEE,0xEE,0xEE), tray_data[i].name, tray_data[i], true);
|
m_filament_name->set_data(wxColour(0xEE,0xEE,0xEE), tray_data[i].name, tray_data[i], true);
|
||||||
|
@ -364,7 +365,7 @@ void AmsMapingPopup::add_ams_mapping(std::vector<TrayData> tray_data)
|
||||||
}
|
}
|
||||||
|
|
||||||
m_filament_name->Bind(wxEVT_LEFT_DOWN, [this, tray_data, i, m_filament_name](wxMouseEvent &e) {
|
m_filament_name->Bind(wxEVT_LEFT_DOWN, [this, tray_data, i, m_filament_name](wxMouseEvent &e) {
|
||||||
if (!is_match_material(tray_data[i].name)) return;
|
if (!is_match_material(tray_data[i].filament_type)) return;
|
||||||
m_filament_name->send_event(m_current_filament_id);
|
m_filament_name->send_event(m_current_filament_id);
|
||||||
Dismiss();
|
Dismiss();
|
||||||
});
|
});
|
||||||
|
|
|
@ -54,6 +54,7 @@ struct TrayData
|
||||||
TrayType type;
|
TrayType type;
|
||||||
int id;
|
int id;
|
||||||
std::string name;
|
std::string name;
|
||||||
|
std::string filament_type;
|
||||||
wxColour colour;
|
wxColour colour;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -158,6 +158,29 @@ bool AmsTray::is_unset_third_filament()
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string AmsTray::get_display_filament_type()
|
||||||
|
{
|
||||||
|
if (type == "PLA-S")
|
||||||
|
return "Support W";
|
||||||
|
else if (type == "PA-S")
|
||||||
|
return "Support G";
|
||||||
|
else
|
||||||
|
return type;
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string AmsTray::get_filament_type()
|
||||||
|
{
|
||||||
|
if (type == "Support W") {
|
||||||
|
return "PLA-S";
|
||||||
|
} else if (type == "Support G") {
|
||||||
|
return "PA-S";
|
||||||
|
} else {
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
|
||||||
bool HMSItem::parse_hms_info(unsigned attr, unsigned code)
|
bool HMSItem::parse_hms_info(unsigned attr, unsigned code)
|
||||||
{
|
{
|
||||||
bool result = true;
|
bool result = true;
|
||||||
|
@ -632,7 +655,7 @@ int MachineObject::ams_filament_mapping(std::vector<FilamentInfo> filaments, std
|
||||||
if (tray->second->is_tray_info_ready()) {
|
if (tray->second->is_tray_info_ready()) {
|
||||||
FilamentInfo info;
|
FilamentInfo info;
|
||||||
info.color = tray->second->color;
|
info.color = tray->second->color;
|
||||||
info.type = tray->second->type;
|
info.type = tray->second->get_filament_type();
|
||||||
info.id = tray_index;
|
info.id = tray_index;
|
||||||
tray_filaments.emplace(std::make_pair(tray_index, info));
|
tray_filaments.emplace(std::make_pair(tray_index, info));
|
||||||
}
|
}
|
||||||
|
@ -649,7 +672,7 @@ int MachineObject::ams_filament_mapping(std::vector<FilamentInfo> filaments, std
|
||||||
info.id = atoi(tray_it->first.c_str()) + atoi(it->first.c_str()) * 4;
|
info.id = atoi(tray_it->first.c_str()) + atoi(it->first.c_str()) * 4;
|
||||||
info.tray_id = atoi(tray_it->first.c_str()) + atoi(it->first.c_str()) * 4;
|
info.tray_id = atoi(tray_it->first.c_str()) + atoi(it->first.c_str()) * 4;
|
||||||
info.color = tray_it->second->color;
|
info.color = tray_it->second->color;
|
||||||
info.type = tray_it->second->type;
|
info.type = tray_it->second->get_filament_type();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
info.id = -1;
|
info.id = -1;
|
||||||
|
@ -678,9 +701,9 @@ int MachineObject::ams_filament_mapping(std::vector<FilamentInfo> filaments, std
|
||||||
if (!tray_it->second->is_exists || tray_it->second->is_unset_third_filament()) {
|
if (!tray_it->second->is_exists || tray_it->second->is_unset_third_filament()) {
|
||||||
;
|
;
|
||||||
} else {
|
} else {
|
||||||
if (filaments[i].type == tray_it->second->type) {
|
if (filaments[i].type == tray_it->second->get_filament_type()) {
|
||||||
info.color = tray_it->second->color;
|
info.color = tray_it->second->color;
|
||||||
info.type = tray_it->second->type;
|
info.type = tray_it->second->get_filament_type();
|
||||||
} else {
|
} else {
|
||||||
info.tray_id = -1;
|
info.tray_id = -1;
|
||||||
info.mapping_result = (int)MappingResult::MAPPING_RESULT_TYPE_MISMATCH;
|
info.mapping_result = (int)MappingResult::MAPPING_RESULT_TYPE_MISMATCH;
|
||||||
|
@ -2228,13 +2251,7 @@ int MachineObject::parse_json(std::string payload)
|
||||||
if (tray_it->contains("tray_info_idx") && tray_it->contains("tray_type")) {
|
if (tray_it->contains("tray_info_idx") && tray_it->contains("tray_type")) {
|
||||||
curr_tray->setting_id = (*tray_it)["tray_info_idx"].get<std::string>();
|
curr_tray->setting_id = (*tray_it)["tray_info_idx"].get<std::string>();
|
||||||
std::string type = (*tray_it)["tray_type"].get<std::string>();
|
std::string type = (*tray_it)["tray_type"].get<std::string>();
|
||||||
if (curr_tray->setting_id == "GFS00") {
|
|
||||||
curr_tray->type = "Support W";
|
|
||||||
} else if (curr_tray->setting_id == "GFS01") {
|
|
||||||
curr_tray->type = "Support G";
|
|
||||||
} else {
|
|
||||||
curr_tray->type = type;
|
curr_tray->type = type;
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
curr_tray->setting_id = "";
|
curr_tray->setting_id = "";
|
||||||
curr_tray->type = "";
|
curr_tray->type = "";
|
||||||
|
|
|
@ -167,6 +167,8 @@ public:
|
||||||
|
|
||||||
bool is_tray_info_ready();
|
bool is_tray_info_ready();
|
||||||
bool is_unset_third_filament();
|
bool is_unset_third_filament();
|
||||||
|
std::string get_display_filament_type();
|
||||||
|
std::string get_filament_type();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -6454,7 +6454,9 @@ void GLCanvas3D::_render_paint_toolbar() const
|
||||||
for (auto filament_name : preset_bundle->filament_presets) {
|
for (auto filament_name : preset_bundle->filament_presets) {
|
||||||
for (auto iter = preset_bundle->filaments.lbegin(); iter != preset_bundle->filaments.end(); iter++) {
|
for (auto iter = preset_bundle->filaments.lbegin(); iter != preset_bundle->filaments.end(); iter++) {
|
||||||
if (filament_name.compare(iter->name) == 0) {
|
if (filament_name.compare(iter->name) == 0) {
|
||||||
filament_types.push_back(iter->config.get_filament_type());
|
std::string display_filament_type;
|
||||||
|
iter->config.get_filament_type(display_filament_type);
|
||||||
|
filament_types.push_back(display_filament_type);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -8205,7 +8205,8 @@ int Plater::export_3mf(const boost::filesystem::path& output_path, SaveStrategy
|
||||||
for (int i = 0; i < plate_data_list.size(); i++) {
|
for (int i = 0; i < plate_data_list.size(); i++) {
|
||||||
PlateData *plate_data = plate_data_list[i];
|
PlateData *plate_data = plate_data_list[i];
|
||||||
for (auto it = plate_data->slice_filaments_info.begin(); it != plate_data->slice_filaments_info.end(); it++) {
|
for (auto it = plate_data->slice_filaments_info.begin(); it != plate_data->slice_filaments_info.end(); it++) {
|
||||||
it->type = cfg.get_filament_type(it->id);
|
std::string display_filament_type;
|
||||||
|
it->type = cfg.get_filament_type(display_filament_type, it->id);
|
||||||
it->color = filament_color ? filament_color->get_at(it->id) : "#FFFFFF";
|
it->color = filament_color ? filament_color->get_at(it->id) : "#FFFFFF";
|
||||||
// save filament info used in curr plate
|
// save filament info used in curr plate
|
||||||
int index = p->partplate_list.get_curr_plate_index();
|
int index = p->partplate_list.get_curr_plate_index();
|
||||||
|
|
|
@ -1994,12 +1994,16 @@ void SelectMachineDialog::set_default()
|
||||||
//sizer_thumbnail->Layout();
|
//sizer_thumbnail->Layout();
|
||||||
|
|
||||||
std::vector<std::string> materials;
|
std::vector<std::string> materials;
|
||||||
|
std::vector<std::string> display_materials;
|
||||||
{
|
{
|
||||||
auto preset_bundle = wxGetApp().preset_bundle;
|
auto preset_bundle = wxGetApp().preset_bundle;
|
||||||
for (auto filament_name : preset_bundle->filament_presets) {
|
for (auto filament_name : preset_bundle->filament_presets) {
|
||||||
for (auto iter = preset_bundle->filaments.lbegin(); iter != preset_bundle->filaments.end(); iter++) {
|
for (auto iter = preset_bundle->filaments.lbegin(); iter != preset_bundle->filaments.end(); iter++) {
|
||||||
if (filament_name.compare(iter->name) == 0) {
|
if (filament_name.compare(iter->name) == 0) {
|
||||||
materials.push_back(iter->config.get_filament_type());
|
std::string display_filament_type;
|
||||||
|
std::string filament_type = iter->config.get_filament_type(display_filament_type);
|
||||||
|
display_materials.push_back(display_filament_type);
|
||||||
|
materials.push_back(filament_type);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2030,9 +2034,9 @@ void SelectMachineDialog::set_default()
|
||||||
bmcache.parse_color(colour, rgb);
|
bmcache.parse_color(colour, rgb);
|
||||||
|
|
||||||
auto colour_rgb = wxColour((int) rgb[0], (int) rgb[1], (int) rgb[2]);
|
auto colour_rgb = wxColour((int) rgb[0], (int) rgb[1], (int) rgb[2]);
|
||||||
if (extruder >= materials.size() || extruder < 0)
|
if (extruder >= materials.size() || extruder < 0 || extruder >= display_materials.size())
|
||||||
continue;
|
continue;
|
||||||
MaterialItem *item = new MaterialItem(this, colour_rgb, _L(materials[extruder]));
|
MaterialItem *item = new MaterialItem(this, colour_rgb, _L(display_materials[extruder]));
|
||||||
m_sizer_material->Add(item, 0, wxALL, FromDIP(4));
|
m_sizer_material->Add(item, 0, wxALL, FromDIP(4));
|
||||||
|
|
||||||
item->Bind(wxEVT_LEFT_UP, [this, item, materials, extruder](wxMouseEvent &e) {
|
item->Bind(wxEVT_LEFT_UP, [this, item, materials, extruder](wxMouseEvent &e) {
|
||||||
|
|
|
@ -64,7 +64,7 @@ bool AMSinfo::parse_ams_info(Ams *ams)
|
||||||
if (it != ams->trayList.end() && it->second->is_exists) {
|
if (it != ams->trayList.end() && it->second->is_exists) {
|
||||||
if (it->second->is_tray_info_ready()) {
|
if (it->second->is_tray_info_ready()) {
|
||||||
info.can_id = it->second->id;
|
info.can_id = it->second->id;
|
||||||
info.material_name = it->second->type;
|
info.material_name = it->second->get_display_filament_type();
|
||||||
if (!it->second->color.empty()) {
|
if (!it->second->color.empty()) {
|
||||||
info.material_colour = AmsTray::decode_color(it->second->color);
|
info.material_colour = AmsTray::decode_color(it->second->color);
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue