ENH: skip_object: add label_object_enabled flag in sliced_info

Change-Id: I7e62fd931d123b328c38da27de9625971938ac4a
This commit is contained in:
lane.wei 2023-06-12 11:23:47 +08:00 committed by Lane.Wei
parent 8973615a8d
commit 49f8d9e697
6 changed files with 23 additions and 3 deletions

View file

@ -283,7 +283,7 @@ static constexpr const char* SLICE_PREDICTION_ATTR = "prediction";
static constexpr const char* SLICE_WEIGHT_ATTR = "weight";
static constexpr const char* OUTSIDE_ATTR = "outside";
static constexpr const char* SUPPORT_USED_ATTR = "support_used";
static constexpr const char* LABEL_OBJECT_ENABLED_ATTR = "label_object_enabled";
static constexpr const char* OBJECT_TYPE = "object";
static constexpr const char* VOLUME_TYPE = "volume";
@ -1417,6 +1417,7 @@ void PlateData::parse_filament_info(GCodeProcessorResult *result)
plate->gcode_weight = it->second->gcode_weight;
plate->toolpath_outside = it->second->toolpath_outside;
plate->is_support_used = it->second->is_support_used;
plate->is_label_object_enabled = it->second->is_label_object_enabled;
plate->slice_filaments_info = it->second->slice_filaments_info;
plate->warnings = it->second->warnings;
plate->thumbnail_file = it->second->thumbnail_file;
@ -2048,6 +2049,7 @@ void PlateData::parse_filament_info(GCodeProcessorResult *result)
plate_data_list[it->first-1]->gcode_weight = it->second->gcode_weight;
plate_data_list[it->first-1]->toolpath_outside = it->second->toolpath_outside;
plate_data_list[it->first-1]->is_support_used = it->second->is_support_used;
plate_data_list[it->first-1]->is_label_object_enabled = it->second->is_label_object_enabled;
plate_data_list[it->first-1]->slice_filaments_info = it->second->slice_filaments_info;
plate_data_list[it->first-1]->warnings = it->second->warnings;
plate_data_list[it->first-1]->thumbnail_file = (m_load_restore || it->second->thumbnail_file.empty()) ? it->second->thumbnail_file : m_backup_path + "/" + it->second->thumbnail_file;
@ -3923,6 +3925,11 @@ void PlateData::parse_filament_info(GCodeProcessorResult *result)
if (m_curr_plater)
std::istringstream(value) >> std::boolalpha >> m_curr_plater->is_support_used;
}
else if (key == LABEL_OBJECT_ENABLED_ATTR)
{
if (m_curr_plater)
std::istringstream(value) >> std::boolalpha >> m_curr_plater->is_label_object_enabled;
}
}
return true;
@ -7208,6 +7215,7 @@ void PlateData::parse_filament_info(GCodeProcessorResult *result)
stream << " <" << METADATA_TAG << " " << KEY_ATTR << "=\"" << SLICE_WEIGHT_ATTR << "\" " << VALUE_ATTR << "=\"" << plate_data->get_gcode_weight_str() << "\"/>\n";
stream << " <" << METADATA_TAG << " " << KEY_ATTR << "=\"" << OUTSIDE_ATTR << "\" " << VALUE_ATTR << "=\"" << std::boolalpha<< plate_data->toolpath_outside << "\"/>\n";
stream << " <" << METADATA_TAG << " " << KEY_ATTR << "=\"" << SUPPORT_USED_ATTR << "\" " << VALUE_ATTR << "=\"" << std::boolalpha<< plate_data->is_support_used << "\"/>\n";
stream << " <" << METADATA_TAG << " " << KEY_ATTR << "=\"" << LABEL_OBJECT_ENABLED_ATTR << "\" " << VALUE_ATTR << "=\"" << std::boolalpha<< plate_data->is_label_object_enabled << "\"/>\n";
for (auto it = plate_data->slice_filaments_info.begin(); it != plate_data->slice_filaments_info.end(); it++)
{

View file

@ -82,6 +82,7 @@ struct PlateData
bool is_support_used {false};
bool is_sliced_valid = false;
bool toolpath_outside {false};
bool is_label_object_enabled {false};
std::vector<GCodeProcessorResult::SliceWarning> warnings;

View file

@ -1138,6 +1138,8 @@ void GCode::do_export(Print* print, const char* path, GCodeProcessorResult* resu
BOOST_LOG_TRIVIAL(info) << "Exporting G-code finished" << log_memory_info();
print->set_done(psGCodeExport);
//BBS: set enable_label_object
result->label_object_enabled = m_enable_label_object;
// Write the profiler measurements to file
PROFILE_UPDATE();

View file

@ -767,6 +767,8 @@ void GCodeProcessorResult::reset() {
bed_exclude_area = Pointfs();
//BBS: add toolpath_outside
toolpath_outside = false;
//BBS: add label_object_enabled
label_object_enabled = false;
printable_height = 0.0f;
settings_ids.reset();
extruders_count = 0;
@ -792,6 +794,8 @@ void GCodeProcessorResult::reset() {
bed_exclude_area = Pointfs();
//BBS: add toolpath_outside
toolpath_outside = false;
//BBS: add label_object_enabled
label_object_enabled = false;
printable_height = 0.0f;
settings_ids.reset();
extruders_count = 0;

View file

@ -177,6 +177,8 @@ namespace Slic3r {
Pointfs bed_exclude_area;
//BBS: add toolpath_outside
bool toolpath_outside;
//BBS: add object_label_enabled
bool label_object_enabled;
float printable_height;
SettingsIds settings_ids;
size_t extruders_count;
@ -208,6 +210,7 @@ namespace Slic3r {
printable_area = other.printable_area;
bed_exclude_area = other.bed_exclude_area;
toolpath_outside = other.toolpath_outside;
label_object_enabled = other.label_object_enabled;
printable_height = other.printable_height;
settings_ids = other.settings_ids;
extruders_count = other.extruders_count;