mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-08-04 07:30:41 +08:00
Read filament from MMU tools
This commit is contained in:
parent
63573a923c
commit
c862ecf8e4
@ -4119,7 +4119,7 @@ void GUI_App::select_filament_from_connect(const std::string& msg)
|
||||
}
|
||||
// test if currently selected is same type
|
||||
size_t extruder_count = preset_bundle->extruders_filaments.size();
|
||||
if (extruder_count != materials.size()) {
|
||||
if (extruder_count < materials.size()) {
|
||||
BOOST_LOG_TRIVIAL(error) << format("Failed to select filament from Connect. Selected printer has %1% extruders while data from Connect contains %2% materials.", extruder_count, materials.size());
|
||||
plater()->get_notification_manager()->close_notification_of_type(NotificationType::SelectFilamentFromConnect);
|
||||
// TRN: Notification text.
|
||||
@ -4127,7 +4127,7 @@ void GUI_App::select_filament_from_connect(const std::string& msg)
|
||||
return;
|
||||
}
|
||||
std::string notification_text;
|
||||
for (size_t i = 0; i < extruder_count; i++) {
|
||||
for (size_t i = 0; i < materials.size(); i++) {
|
||||
search_and_select_filaments(materials[i], avoid_abrasive.size() > i ? avoid_abrasive[i] : false, i, notification_text);
|
||||
}
|
||||
|
||||
|
@ -104,6 +104,7 @@ private:
|
||||
{"READY" , ConnectPrinterState::CONNECT_PRINTER_READY},
|
||||
{"ATTENTION", ConnectPrinterState::CONNECT_PRINTER_ATTENTION},
|
||||
{"BUSY" , ConnectPrinterState::CONNECT_PRINTER_BUSY},
|
||||
{"ERROR" , ConnectPrinterState::CONNECT_PRINTER_ERROR},
|
||||
};
|
||||
};
|
||||
}} // namespace slic3r::GUI
|
||||
|
@ -113,7 +113,14 @@ void fill_config_options_from_json_inner(const boost::property_tree::ptree& ptre
|
||||
for (const auto &subtree : slots) {
|
||||
size_t slot_id;
|
||||
try {
|
||||
slot_id = boost::lexical_cast<std::size_t>(subtree.first);
|
||||
// id could "1" for extruder
|
||||
// or "1.1" for MMU (than we need number after dot as id)
|
||||
size_t dot_pos = subtree.first.find('.');
|
||||
if (dot_pos != std::string::npos) {
|
||||
slot_id = boost::lexical_cast<size_t>(subtree.first.substr(dot_pos + 1));
|
||||
} else {
|
||||
slot_id = boost::lexical_cast<std::size_t>(subtree.first);
|
||||
}
|
||||
} catch (const boost::bad_lexical_cast&) {
|
||||
continue;
|
||||
}
|
||||
@ -286,6 +293,12 @@ void fill_material_from_json(const std::string& json, std::vector<std::string>&
|
||||
for (const std::string& val : result_map["hardened"]) {
|
||||
avoid_abrasive_result.emplace_back(val == "0" ? 1 : 0);
|
||||
}
|
||||
// MMU has "hardened" only under tool 1
|
||||
if (avoid_abrasive_result.size() == 1 && material_result.size() > avoid_abrasive_result.size()) {
|
||||
for (size_t i = 1; i < material_result.size(); i++) {
|
||||
avoid_abrasive_result.emplace_back(avoid_abrasive_result[0]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user