mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-05-20 20:03:47 +00:00
ENH:the "distance" var should init to 0 in the release environment of Mac
jira: STUDIO-10967 Change-Id: I85b1e87dc80846f50c3bd29c7aa05f89c39d17de (cherry picked from commit 4b368cb2ecafd53ad1bbe61946bb9b1bafce64cb)
This commit is contained in:
@@ -37,15 +37,15 @@ enum MappingResult {
|
|||||||
|
|
||||||
struct FilamentInfo
|
struct FilamentInfo
|
||||||
{
|
{
|
||||||
int id; // filament id = extruder id, start with 0.
|
int id{0}; // filament id = extruder id, start with 0.
|
||||||
std::string type;
|
std::string type;
|
||||||
std::string color;
|
std::string color;
|
||||||
std::string filament_id;
|
std::string filament_id;
|
||||||
std::string brand;
|
std::string brand;
|
||||||
float used_m;
|
float used_m{0.f};
|
||||||
float used_g;
|
float used_g{0.f};
|
||||||
int tray_id; // start with 0
|
int tray_id{0}; // start with 0
|
||||||
float distance;
|
float distance{0.f};
|
||||||
int ctype = 0;
|
int ctype = 0;
|
||||||
std::vector<std::string> colors = std::vector<std::string>();
|
std::vector<std::string> colors = std::vector<std::string>();
|
||||||
int mapping_result = 0;
|
int mapping_result = 0;
|
||||||
|
|||||||
@@ -1092,6 +1092,7 @@ int MachineObject::ams_filament_mapping(
|
|||||||
min_val = distance_map[i][j].distance;
|
min_val = distance_map[i][j].distance;
|
||||||
picked_src_idx = i;
|
picked_src_idx = i;
|
||||||
picked_tar_idx = j;
|
picked_tar_idx = j;
|
||||||
|
tray_filaments[picked_tar_idx].distance = min_val;
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -1103,6 +1104,7 @@ int MachineObject::ams_filament_mapping(
|
|||||||
min_val = distance_map[i][j].distance;
|
min_val = distance_map[i][j].distance;
|
||||||
picked_src_idx = i;
|
picked_src_idx = i;
|
||||||
picked_tar_idx = j;
|
picked_tar_idx = j;
|
||||||
|
tray_filaments[picked_tar_idx].distance = min_val;
|
||||||
}
|
}
|
||||||
else if (min_val == distance_map[i][j].distance&& filaments[picked_src_idx].filament_id!= tray_filaments[picked_tar_idx].filament_id && filaments[i].filament_id == tray_filaments[j].filament_id) {
|
else if (min_val == distance_map[i][j].distance&& filaments[picked_src_idx].filament_id!= tray_filaments[picked_tar_idx].filament_id && filaments[i].filament_id == tray_filaments[j].filament_id) {
|
||||||
|
|
||||||
|
|||||||
@@ -1232,7 +1232,7 @@ void SyncAmsInfoDialog::sync_ams_mapping_result(std::vector<FilamentInfo> &resul
|
|||||||
{
|
{
|
||||||
m_back_ams_mapping_result = result;
|
m_back_ams_mapping_result = result;
|
||||||
if (result.empty()) {
|
if (result.empty()) {
|
||||||
BOOST_LOG_TRIVIAL(trace) << "ams_mapping result is empty";
|
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << "ams_mapping result is empty";
|
||||||
for (auto it = m_materialList.begin(); it != m_materialList.end(); it++) {
|
for (auto it = m_materialList.begin(); it != m_materialList.end(); it++) {
|
||||||
wxString ams_id = "Ext";
|
wxString ams_id = "Ext";
|
||||||
wxColour ams_col = wxColour(0xCE, 0xCE, 0xCE);
|
wxColour ams_col = wxColour(0xCE, 0xCE, 0xCE);
|
||||||
@@ -1241,7 +1241,7 @@ void SyncAmsInfoDialog::sync_ams_mapping_result(std::vector<FilamentInfo> &resul
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
for (auto f = result.begin(); f != result.end(); f++) {
|
for (auto f = result.begin(); f != result.end(); f++) {
|
||||||
BOOST_LOG_TRIVIAL(trace) << "ams_mapping f id = " << f->id << ", tray_id = " << f->tray_id << ", color = " << f->color << ", type = " << f->type;
|
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << "ams_mapping f id = " << f->id << ", tray_id = " << f->tray_id << ", color = " << f->color << ", type = " << f->type;
|
||||||
|
|
||||||
MaterialHash::iterator iter = m_materialList.begin();
|
MaterialHash::iterator iter = m_materialList.begin();
|
||||||
while (iter != m_materialList.end()) {
|
while (iter != m_materialList.end()) {
|
||||||
@@ -1287,7 +1287,7 @@ void SyncAmsInfoDialog::sync_ams_mapping_result(std::vector<FilamentInfo> &resul
|
|||||||
bool SyncAmsInfoDialog::do_ams_mapping(MachineObject *obj_)
|
bool SyncAmsInfoDialog::do_ams_mapping(MachineObject *obj_)
|
||||||
{
|
{
|
||||||
if (!obj_) return false;
|
if (!obj_) return false;
|
||||||
BOOST_LOG_TRIVIAL(trace) << "SyncAmsInfoDialog:begin do_ams_mapping result";
|
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << " begin do_ams_mapping result";
|
||||||
obj_->get_ams_colors(m_cur_colors_in_thumbnail);
|
obj_->get_ams_colors(m_cur_colors_in_thumbnail);
|
||||||
// try color and type mapping
|
// try color and type mapping
|
||||||
|
|
||||||
@@ -1385,6 +1385,7 @@ void SyncAmsInfoDialog::show_thumbnail_page()
|
|||||||
|
|
||||||
bool SyncAmsInfoDialog::get_ams_mapping_result(std::string &mapping_array_str, std::string &mapping_array_str2, std::string &ams_mapping_info)
|
bool SyncAmsInfoDialog::get_ams_mapping_result(std::string &mapping_array_str, std::string &mapping_array_str2, std::string &ams_mapping_info)
|
||||||
{
|
{
|
||||||
|
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << "m_ams_mapping_result.size:" << m_ams_mapping_result.empty();
|
||||||
if (m_ams_mapping_result.empty())
|
if (m_ams_mapping_result.empty())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@@ -1398,8 +1399,10 @@ bool SyncAmsInfoDialog::get_ams_mapping_result(std::string &mapping_array_str, s
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (invalid_count == m_ams_mapping_result.size()) {
|
if (invalid_count == m_ams_mapping_result.size()) {
|
||||||
|
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << "invalid_count == m_ams_mapping_result.size()";
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
|
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << "check mapping_v0_json";
|
||||||
json mapping_v0_json = json::array();
|
json mapping_v0_json = json::array();
|
||||||
json mapping_v1_json = json::array();
|
json mapping_v1_json = json::array();
|
||||||
json mapping_info_json = json::array();
|
json mapping_info_json = json::array();
|
||||||
@@ -1465,6 +1468,7 @@ bool SyncAmsInfoDialog::get_ams_mapping_result(std::string &mapping_array_str, s
|
|||||||
mapping_array_str2 = mapping_v1_json.dump();
|
mapping_array_str2 = mapping_v1_json.dump();
|
||||||
|
|
||||||
ams_mapping_info = mapping_info_json.dump();
|
ams_mapping_info = mapping_info_json.dump();
|
||||||
|
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << "mapping_array_str:" << mapping_array_str;
|
||||||
return valid_mapping_result;
|
return valid_mapping_result;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
@@ -2240,7 +2244,7 @@ void SyncAmsInfoDialog::on_set_finish_mapping(wxCommandEvent &evt)
|
|||||||
m_ams_mapping_result[i].ams_id = selection_data_arr[6].ToStdString();
|
m_ams_mapping_result[i].ams_id = selection_data_arr[6].ToStdString();
|
||||||
m_ams_mapping_result[i].slot_id = selection_data_arr[7].ToStdString();
|
m_ams_mapping_result[i].slot_id = selection_data_arr[7].ToStdString();
|
||||||
}
|
}
|
||||||
BOOST_LOG_TRIVIAL(trace) << "The ams mapping result: id is " << m_ams_mapping_result[i].id << "tray_id is " << m_ams_mapping_result[i].tray_id;
|
BOOST_LOG_TRIVIAL(info) << "The ams mapping result: id is " << m_ams_mapping_result[i].id << "tray_id is " << m_ams_mapping_result[i].tray_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
MaterialHash::iterator iter = m_materialList.begin();
|
MaterialHash::iterator iter = m_materialList.begin();
|
||||||
@@ -3473,7 +3477,7 @@ void SyncAmsInfoDialog::update_lan_machine_list()
|
|||||||
if (!dev) return;
|
if (!dev) return;
|
||||||
auto m_free_machine_list = dev->get_local_machine_list();
|
auto m_free_machine_list = dev->get_local_machine_list();
|
||||||
|
|
||||||
BOOST_LOG_TRIVIAL(trace) << "SelectMachinePopup update_other_devices start";
|
BOOST_LOG_TRIVIAL(info) << "SelectMachinePopup update_other_devices start";
|
||||||
|
|
||||||
for (auto &elem : m_free_machine_list) {
|
for (auto &elem : m_free_machine_list) {
|
||||||
MachineObject *mobj = elem.second;
|
MachineObject *mobj = elem.second;
|
||||||
@@ -3494,7 +3498,7 @@ void SyncAmsInfoDialog::update_lan_machine_list()
|
|||||||
std::map<std::string, MachineObject *> option_list;
|
std::map<std::string, MachineObject *> option_list;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
BOOST_LOG_TRIVIAL(trace) << "SyncAmsInfoDialog update_lan_devices end";
|
BOOST_LOG_TRIVIAL(info) << "SyncAmsInfoDialog update_lan_devices end";
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string SyncAmsInfoDialog::get_print_status_info(PrintDialogStatus status)
|
std::string SyncAmsInfoDialog::get_print_status_info(PrintDialogStatus status)
|
||||||
|
|||||||
Reference in New Issue
Block a user