New feature: plate name

This commit is contained in:
SoftFever 2023-03-29 21:36:14 +08:00
parent b243bac282
commit f5c4cc9a54
15 changed files with 254 additions and 113 deletions

View file

@ -249,6 +249,7 @@ static constexpr const char* OBJECT_ID_ATTR = "object_id";
static constexpr const char* INSTANCEID_ATTR = "instance_id";
static constexpr const char* ARRANGE_ORDER_ATTR = "arrange_order";
static constexpr const char* PLATERID_ATTR = "plater_id";
static constexpr const char* PLATER_NAME_ATTR = "plater_name";
static constexpr const char* PLATE_IDX_ATTR = "index";
static constexpr const char* SLICE_PREDICTION_ATTR = "prediction";
static constexpr const char* SLICE_WEIGHT_ATTR = "weight";
@ -1765,6 +1766,7 @@ void PlateData::parse_filament_info(GCodeProcessorResult *result)
}
plate_data_list[it->first-1]->locked = it->second->locked;
plate_data_list[it->first-1]->plate_index = it->second->plate_index-1;
plate_data_list[it->first-1]->plate_name = it->second->plate_name;
plate_data_list[it->first-1]->obj_inst_map = it->second->obj_inst_map;
plate_data_list[it->first-1]->gcode_file = (m_load_restore || it->second->gcode_file.empty()) ? it->second->gcode_file : m_backup_path + "/" + it->second->gcode_file;
plate_data_list[it->first-1]->gcode_prediction = it->second->gcode_prediction;
@ -3467,6 +3469,10 @@ void PlateData::parse_filament_info(GCodeProcessorResult *result)
{
m_curr_plater->plate_index = atoi(value.c_str());
}
else if(key == PLATER_NAME_ATTR)
{
m_curr_plater->plate_name = value;
}
else if (key == LOCK_ATTR)
{
std::istringstream(value) >> std::boolalpha >> m_curr_plater->locked;
@ -6431,6 +6437,7 @@ void PlateData::parse_filament_info(GCodeProcessorResult *result)
stream << " <" << PLATE_TAG << ">\n";
//plate index
stream << " <" << METADATA_TAG << " " << KEY_ATTR << "=\"" << PLATERID_ATTR << "\" " << VALUE_ATTR << "=\"" << plate_data->plate_index + 1 << "\"/>\n";
stream << " <" << METADATA_TAG << " " << KEY_ATTR << "=\"" << PLATER_NAME_ATTR << "\" " << VALUE_ATTR << "=\"" << plate_data->plate_name << "\"/>\n";
stream << " <" << METADATA_TAG << " " << KEY_ATTR << "=\"" << LOCK_ATTR << "\" " << VALUE_ATTR << "=\"" << std::boolalpha<< plate_data->locked<< "\"/>\n";
ConfigOption* bed_type_opt = plate_data->config.option("curr_bed_type");
t_config_enum_names bed_type_names = ConfigOptionEnum<BedType>::get_enum_names();

View file

@ -70,6 +70,7 @@ struct PlateData
std::string pattern_bbox_file;
std::string gcode_prediction;
std::string gcode_weight;
std::string plate_name;
std::vector<FilamentInfo> slice_filaments_info;
DynamicPrintConfig config;
bool is_support_used {false};