ENH:add layer_filament_list.json record used filaments for each layer
jira: none Change-Id: Ib293ff9fdd284fef9e6de93260e2ba7cc3d66daa
This commit is contained in:
parent
f7a0e66e0d
commit
28046fbc23
|
@ -214,6 +214,8 @@ static constexpr const char *FILAMENT_COLOR_TAG = "color";
|
|||
static constexpr const char *FILAMENT_USED_M_TAG = "used_m";
|
||||
static constexpr const char *FILAMENT_USED_G_TAG = "used_g";
|
||||
static constexpr const char *FILAMENT_TRAY_INFO_ID_TAG = "tray_info_idx";
|
||||
static constexpr const char *LAYER_FILAMENT_LISTS_TAG = "layer_filament_lists";
|
||||
static constexpr const char *LAYER_FILAMENT_LIST_TAG = "layer_filament_list";
|
||||
|
||||
|
||||
static constexpr const char* CONFIG_TAG = "config";
|
||||
|
@ -7918,6 +7920,30 @@ void PlateData::parse_filament_info(GCodeProcessorResult *result)
|
|||
for (auto it = plate_data->warnings.begin(); it != plate_data->warnings.end(); it++) {
|
||||
stream << " <" << SLICE_WARNING_TAG << " msg=\"" << it->msg << "\" level=\"" << std::to_string(it->level) << "\" error_code =\"" << it->error_code << "\" />\n";
|
||||
}
|
||||
|
||||
if (!plate_data->layer_filaments.empty()) {
|
||||
stream << " <" << LAYER_FILAMENT_LISTS_TAG << ">\n";
|
||||
for (auto iter = plate_data->layer_filaments.begin(); iter != plate_data->layer_filaments.end(); ++iter) {
|
||||
// key
|
||||
std::vector<unsigned int> sequence = iter->first;
|
||||
std::stringstream key_stream;
|
||||
add_vector(key_stream, sequence);
|
||||
|
||||
// value
|
||||
std::vector<std::pair<int, int>> ranges = iter->second;
|
||||
std::stringstream value_stream;
|
||||
for (size_t i = 0; i < ranges.size(); ++i) {
|
||||
value_stream << ranges[i].first;
|
||||
value_stream << " ";
|
||||
value_stream << ranges[i].second;
|
||||
if (i != (ranges.size() - 1)) value_stream << ",";
|
||||
}
|
||||
|
||||
stream << " <" << LAYER_FILAMENT_LIST_TAG << " filament_list=\"" << key_stream.str() << "\" layer_ranges=\"" << value_stream.str() << "\" />\n";
|
||||
}
|
||||
stream << " </" << LAYER_FILAMENT_LISTS_TAG << ">\n";
|
||||
}
|
||||
|
||||
stream << " </" << PLATE_TAG << ">\n";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -95,6 +95,8 @@ struct PlateData
|
|||
bool is_label_object_enabled {false};
|
||||
int timelapse_warning_code = 0; // 1<<0 sprial vase, 1<<1 by object
|
||||
std::vector<int> filament_maps; // 1 base
|
||||
using LayerFilaments = std::unordered_map<std::vector<unsigned int>, std::vector<std::pair<int, int>>, GCodeProcessorResult::FilamentSequenceHash>;
|
||||
LayerFilaments layer_filaments;
|
||||
|
||||
// Hexadecimal number,
|
||||
// the 0th digit corresponds to extruder 1
|
||||
|
|
|
@ -5608,6 +5608,7 @@ int PartPlateList::store_to_3mf_structure(PlateDataPtrs& plate_data_list, bool w
|
|||
m_plate_list[i]->set_timelapse_warning_code(plate_data_item->timelapse_warning_code);
|
||||
plate_data_item->is_label_object_enabled = m_plate_list[i]->m_gcode_result->label_object_enabled;
|
||||
plate_data_item->limit_filament_maps = m_plate_list[i]->m_gcode_result->limit_filament_maps;
|
||||
plate_data_item->layer_filaments = m_plate_list[i]->m_gcode_result->layer_filaments;
|
||||
Print *print = nullptr;
|
||||
m_plate_list[i]->get_print((PrintBase **) &print, nullptr, nullptr);
|
||||
if (print) {
|
||||
|
|
Loading…
Reference in New Issue