FIX: Ext auto fill when mapping item is empty
jira: [Ext auto fill] Change-Id: I4a8844555e33fcf9f7054fc2e0e254621dec0a1d
This commit is contained in:
parent
16cadec565
commit
8b4182d0c1
|
@ -609,22 +609,24 @@ void AmsMapingPopup::update(MachineObject* obj)
|
|||
td.ams_id = std::stoi(tray_data->id);
|
||||
td.slot_id = 0;
|
||||
|
||||
if (!tray_data->is_exists) {
|
||||
td.type = EMPTY;
|
||||
/*if (tray_data->is_exists) {
|
||||
//td.type = EMPTY;
|
||||
td.type = THIRD;
|
||||
}
|
||||
else {
|
||||
if (!tray_data->is_tray_info_ready()) {
|
||||
td.type = THIRD;
|
||||
}
|
||||
else {
|
||||
td.type = NORMAL;
|
||||
td.colour = AmsTray::decode_color(tray_data->color);
|
||||
td.name = tray_data->get_display_filament_type();
|
||||
td.filament_type = tray_data->get_filament_type();
|
||||
td.ctype = tray_data->ctype;
|
||||
for (auto col : tray_data->cols) {
|
||||
td.material_cols.push_back(AmsTray::decode_color(col));
|
||||
}
|
||||
}*/
|
||||
|
||||
if (!tray_data->is_tray_info_ready()) {
|
||||
td.type = THIRD;
|
||||
}
|
||||
else {
|
||||
td.type = NORMAL;
|
||||
td.colour = AmsTray::decode_color(tray_data->color);
|
||||
td.name = tray_data->get_display_filament_type();
|
||||
td.filament_type = tray_data->get_filament_type();
|
||||
td.ctype = tray_data->ctype;
|
||||
for (auto col : tray_data->cols) {
|
||||
td.material_cols.push_back(AmsTray::decode_color(col));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -843,7 +845,8 @@ void AmsMapingPopup::add_ext_ams_mapping(TrayData tray_data, MappingItem* item)
|
|||
|
||||
// third party
|
||||
if (tray_data.type == THIRD) {
|
||||
item->set_data(wxColour(0xCE, 0xCE, 0xCE), "?", tray_data);
|
||||
item->set_data(tray_data.colour, "?", tray_data);
|
||||
//item->set_data(wxColour(0xCE, 0xCE, 0xCE), "?", tray_data);
|
||||
item->Bind(wxEVT_LEFT_DOWN, [this, tray_data, item](wxMouseEvent& e) {
|
||||
item->send_event(m_current_filament_id);
|
||||
Dismiss();
|
||||
|
|
|
@ -900,7 +900,9 @@ int MachineObject::ams_filament_mapping(std::vector<FilamentInfo> filaments, std
|
|||
info.ams_id = ams->first.c_str();
|
||||
info.slot_id = tray->first.c_str();
|
||||
}
|
||||
if ((!ext_first && !ext_second) || (ams->second->nozzle == 0 && ext_first) || (ams->second->nozzle == 1 && ext_second))
|
||||
|
||||
//first: left,nozzle=1,map=1 second: right,nozzle=0,map=2
|
||||
if ((!ext_first && !ext_second) || (ams->second->nozzle == 0 && ext_second) || (ams->second->nozzle == 1 && ext_first))
|
||||
{
|
||||
tray_filaments.emplace(std::make_pair(tray_index, info));
|
||||
}
|
||||
|
@ -911,7 +913,7 @@ int MachineObject::ams_filament_mapping(std::vector<FilamentInfo> filaments, std
|
|||
{
|
||||
for (auto tray : vt_slot)
|
||||
{
|
||||
if ((tray.id == std::to_string(VIRTUAL_TRAY_MAIN_ID) && ext_first) || (tray.id == std::to_string(VIRTUAL_TRAY_DEPUTY_ID) && ext_second))
|
||||
if ((tray.id == std::to_string(VIRTUAL_TRAY_MAIN_ID) && ext_second) || (tray.id == std::to_string(VIRTUAL_TRAY_DEPUTY_ID) && ext_first))
|
||||
{
|
||||
FilamentInfo info;
|
||||
info.color = tray.color;
|
||||
|
|
|
@ -1952,6 +1952,7 @@ bool SelectMachineDialog::do_ams_mapping(MachineObject *obj_)
|
|||
|
||||
const auto& full_config = wxGetApp().preset_bundle->full_config();
|
||||
size_t nozzle_nums = full_config.option<ConfigOptionFloats>("nozzle_diameter")->values.size();
|
||||
m_filaments_map = wxGetApp().plater()->get_partplate_list().get_curr_plate()->get_filament_maps();
|
||||
|
||||
int filament_result = 0;
|
||||
if (nozzle_nums > 1)
|
||||
|
@ -1959,7 +1960,6 @@ bool SelectMachineDialog::do_ams_mapping(MachineObject *obj_)
|
|||
//get nozzle property, the nozzles are same?, wait fill
|
||||
if (!is_two_nozzle_same())
|
||||
{
|
||||
m_filaments_map = wxGetApp().plater()->get_partplate_list().get_curr_plate()->get_filament_maps();
|
||||
std::vector<FilamentInfo> m_ams_mapping_result_first;
|
||||
std::vector<FilamentInfo> m_ams_mapping_result_second;
|
||||
std::vector<FilamentInfo> m_filament_first;
|
||||
|
@ -2024,16 +2024,80 @@ bool SelectMachineDialog::do_ams_mapping(MachineObject *obj_)
|
|||
else {
|
||||
filament_result = obj_->ams_filament_mapping(m_filaments, m_ams_mapping_result, true, true);
|
||||
}
|
||||
|
||||
for (auto it = m_ams_mapping_result.begin(); it != m_ams_mapping_result.end(); it++)
|
||||
{
|
||||
if (it->ams_id == "")
|
||||
{
|
||||
if (m_filaments_map[it->id] == 1)
|
||||
{
|
||||
if (obj_->vt_slot.size() == 2)
|
||||
{
|
||||
it->ams_id = std::to_string(VIRTUAL_TRAY_DEPUTY_ID);
|
||||
it->color = obj_->vt_slot[1].color;
|
||||
it->type = obj_->vt_slot[1].type;
|
||||
it->colors = obj_->vt_slot[1].cols;
|
||||
it->tray_id = VIRTUAL_TRAY_DEPUTY_ID;
|
||||
}
|
||||
else
|
||||
{
|
||||
it->ams_id = std::to_string(VIRTUAL_TRAY_MAIN_ID);
|
||||
it->color = obj_->vt_slot[0].color;
|
||||
it->type = obj_->vt_slot[0].type;
|
||||
it->colors = obj_->vt_slot[0].cols;
|
||||
it->tray_id = VIRTUAL_TRAY_MAIN_ID;
|
||||
}
|
||||
it->slot_id = "0";
|
||||
}
|
||||
else if (m_filaments_map[it->id] == 2)
|
||||
{
|
||||
it->ams_id = std::to_string(VIRTUAL_TRAY_MAIN_ID);
|
||||
it->color = obj_->vt_slot[0].color;
|
||||
it->type = obj_->vt_slot[0].type;
|
||||
it->colors = obj_->vt_slot[0].cols;
|
||||
it->slot_id = "0";
|
||||
it->tray_id = VIRTUAL_TRAY_MAIN_ID;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
else {
|
||||
if (obj_->is_support_amx_ext_mix_mapping())
|
||||
{
|
||||
filament_result = obj_->ams_filament_mapping(m_filaments, m_ams_mapping_result, true, false);
|
||||
filament_result = obj_->ams_filament_mapping(m_filaments, m_ams_mapping_result, false, true);
|
||||
for (auto it = m_ams_mapping_result.begin(); it != m_ams_mapping_result.end(); it++)
|
||||
{
|
||||
if (it->ams_id == "")
|
||||
{
|
||||
it->ams_id = VIRTUAL_TRAY_MAIN_ID;
|
||||
it->color = obj_->vt_slot[0].color;
|
||||
it->type = obj_->vt_slot[0].type;
|
||||
it->colors = obj_->vt_slot[0].cols;
|
||||
it->slot_id = "0";
|
||||
it->tray_id = VIRTUAL_TRAY_MAIN_ID;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
filament_result = obj_->ams_filament_mapping(m_filaments, m_ams_mapping_result, false, false);
|
||||
if (obj_->amsList.empty())
|
||||
{
|
||||
for (auto it = m_ams_mapping_result.begin(); it != m_ams_mapping_result.end(); it++)
|
||||
{
|
||||
if (it->ams_id == "")
|
||||
{
|
||||
it->ams_id = VIRTUAL_TRAY_MAIN_ID;
|
||||
it->color = obj_->vt_slot[0].color;
|
||||
it->type = obj_->vt_slot[0].type;
|
||||
it->colors = obj_->vt_slot[0].cols;
|
||||
it->slot_id = "0";
|
||||
it->tray_id = VIRTUAL_TRAY_MAIN_ID;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (filament_result == 0) {
|
||||
|
|
Loading…
Reference in New Issue