mirror of
https://git.mirrors.martin98.com/https://github.com/bambulab/BambuStudio.git
synced 2025-09-21 03:03:13 +08:00
ENH:Do not display printing time and grams
JIRA:4255 Change-Id: Ia37cb6e14b0b444f5d7ee9b5afc5695e790c3162
This commit is contained in:
parent
2f4191e958
commit
7e0c831358
@ -4637,14 +4637,15 @@ void MachineObject::update_slice_info(std::string project_id, std::string profil
|
|||||||
|
|
||||||
if (plate_idx >= 0) {
|
if (plate_idx >= 0) {
|
||||||
plate_index = plate_idx;
|
plate_index = plate_idx;
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
|
|
||||||
std::string subtask_json;
|
std::string subtask_json;
|
||||||
unsigned http_code = 0;
|
unsigned http_code = 0;
|
||||||
std::string http_body;
|
std::string http_body;
|
||||||
if (m_agent->get_subtask_info(subtask_id, &subtask_json, &http_code, &http_body) == 0) {
|
if (m_agent->get_subtask_info(subtask_id, &subtask_json, &http_code, &http_body) == 0) {
|
||||||
try {
|
try {
|
||||||
if (!subtask_json.empty()){
|
if (!subtask_json.empty()) {
|
||||||
|
|
||||||
json task_j = json::parse(subtask_json);
|
json task_j = json::parse(subtask_json);
|
||||||
if (task_j.contains("content")) {
|
if (task_j.contains("content")) {
|
||||||
@ -4656,7 +4657,33 @@ void MachineObject::update_slice_info(std::string project_id, std::string profil
|
|||||||
if (task_j.contains("context") && task_j["context"].contains("plates")) {
|
if (task_j.contains("context") && task_j["context"].contains("plates")) {
|
||||||
for (int i = 0; i < task_j["context"]["plates"].size(); i++) {
|
for (int i = 0; i < task_j["context"]["plates"].size(); i++) {
|
||||||
if (task_j["context"]["plates"][i].contains("index") && task_j["context"]["plates"][i]["index"].get<int>() == plate_index) {
|
if (task_j["context"]["plates"][i].contains("index") && task_j["context"]["plates"][i]["index"].get<int>() == plate_index) {
|
||||||
|
if (task_j["context"]["plates"][i].contains("thumbnail") && task_j["context"]["plates"][i]["thumbnail"].contains("url")) {
|
||||||
slice_info->thumbnail_url = task_j["context"]["plates"][i]["thumbnail"]["url"].get<std::string>();
|
slice_info->thumbnail_url = task_j["context"]["plates"][i]["thumbnail"]["url"].get<std::string>();
|
||||||
|
}
|
||||||
|
if (task_j["context"]["plates"][i].contains("prediction")) {
|
||||||
|
slice_info->prediction = task_j["context"]["plates"][i]["prediction"].get<int>();
|
||||||
|
}
|
||||||
|
if (task_j["context"]["plates"][i].contains("weight")) {
|
||||||
|
slice_info->weight = task_j["context"]["plates"][i]["weight"].get<float>();
|
||||||
|
}
|
||||||
|
if (!task_j["context"]["plates"][i]["filaments"].is_null()) {
|
||||||
|
for (auto filament : task_j["context"]["plates"][i]["filaments"]) {
|
||||||
|
FilamentInfo f;
|
||||||
|
if(filament.contains("color")){
|
||||||
|
f.color = filament["color"].get<std::string>();
|
||||||
|
}
|
||||||
|
if (filament.contains("type")) {
|
||||||
|
f.type = filament["type"].get<std::string>();
|
||||||
|
}
|
||||||
|
if (filament.contains("used_g")) {
|
||||||
|
f.used_g = stof(filament["used_g"].get<std::string>());
|
||||||
|
}
|
||||||
|
if (filament.contains("used_m")) {
|
||||||
|
f.used_m = stof(filament["used_m"].get<std::string>());
|
||||||
|
}
|
||||||
|
slice_info->filaments_info.push_back(f);
|
||||||
|
}
|
||||||
|
}
|
||||||
BOOST_LOG_TRIVIAL(trace) << "task_info: thumbnail url=" << slice_info->thumbnail_url;
|
BOOST_LOG_TRIVIAL(trace) << "task_info: thumbnail url=" << slice_info->thumbnail_url;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -4666,42 +4693,43 @@ void MachineObject::update_slice_info(std::string project_id, std::string profil
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch(...) {
|
catch (...) {
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
BOOST_LOG_TRIVIAL(error) << "task_info: get subtask id failed!";
|
BOOST_LOG_TRIVIAL(error) << "task_info: get subtask id failed!";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
//if (plate_index >= 0) {
|
||||||
|
// std::string slice_json;
|
||||||
|
// m_agent->get_slice_info(project_id, profile_id, plate_index, &slice_json);
|
||||||
|
// if (slice_json.empty()) return;
|
||||||
|
// //parse json
|
||||||
|
// try {
|
||||||
|
// json j = json::parse(slice_json);
|
||||||
|
// if (!j["prediction"].is_null())
|
||||||
|
// slice_info->prediction = j["prediction"].get<int>();
|
||||||
|
// if (!j["weight"].is_null())
|
||||||
|
// slice_info->weight = j["weight"].get<float>();
|
||||||
|
// if (!j["thumbnail"].is_null()) {
|
||||||
|
// //slice_info->thumbnail_url = j["thumbnail"]["url"].get<std::string>();
|
||||||
|
// BOOST_LOG_TRIVIAL(trace) << "slice_info: thumbnail url=" << slice_info->thumbnail_url;
|
||||||
|
// }
|
||||||
|
// if (!j["filaments"].is_null()) {
|
||||||
|
// for (auto filament : j["filaments"]) {
|
||||||
|
// FilamentInfo f;
|
||||||
|
// f.color = filament["color"].get<std::string>();
|
||||||
|
// f.type = filament["type"].get<std::string>();
|
||||||
|
// f.used_g = stof(filament["used_g"].get<std::string>());
|
||||||
|
// f.used_m = stof(filament["used_m"].get<std::string>());
|
||||||
|
// slice_info->filaments_info.push_back(f);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// } catch(...) {
|
||||||
|
// ;
|
||||||
|
// }
|
||||||
|
//}
|
||||||
|
|
||||||
if (plate_index >= 0) {
|
|
||||||
std::string slice_json;
|
|
||||||
m_agent->get_slice_info(project_id, profile_id, plate_index, &slice_json);
|
|
||||||
if (slice_json.empty()) return;
|
|
||||||
//parse json
|
|
||||||
try {
|
|
||||||
json j = json::parse(slice_json);
|
|
||||||
if (!j["prediction"].is_null())
|
|
||||||
slice_info->prediction = j["prediction"].get<int>();
|
|
||||||
if (!j["weight"].is_null())
|
|
||||||
slice_info->weight = j["weight"].get<float>();
|
|
||||||
if (!j["thumbnail"].is_null()) {
|
|
||||||
//slice_info->thumbnail_url = j["thumbnail"]["url"].get<std::string>();
|
|
||||||
BOOST_LOG_TRIVIAL(trace) << "slice_info: thumbnail url=" << slice_info->thumbnail_url;
|
|
||||||
}
|
|
||||||
if (!j["filaments"].is_null()) {
|
|
||||||
for (auto filament : j["filaments"]) {
|
|
||||||
FilamentInfo f;
|
|
||||||
f.color = filament["color"].get<std::string>();
|
|
||||||
f.type = filament["type"].get<std::string>();
|
|
||||||
f.used_g = string_to_float(filament["used_g"].get<std::string>());
|
|
||||||
f.used_m = string_to_float(filament["used_m"].get<std::string>());
|
|
||||||
slice_info->filaments_info.push_back(f);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch(...) {
|
|
||||||
;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user