mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-07 15:07:31 -06:00
ENH: skip_object: add label_object_enabled flag in sliced_info
Change-Id: I7e62fd931d123b328c38da27de9625971938ac4a
This commit is contained in:
parent
8973615a8d
commit
49f8d9e697
6 changed files with 23 additions and 3 deletions
|
@ -283,7 +283,7 @@ static constexpr const char* SLICE_PREDICTION_ATTR = "prediction";
|
||||||
static constexpr const char* SLICE_WEIGHT_ATTR = "weight";
|
static constexpr const char* SLICE_WEIGHT_ATTR = "weight";
|
||||||
static constexpr const char* OUTSIDE_ATTR = "outside";
|
static constexpr const char* OUTSIDE_ATTR = "outside";
|
||||||
static constexpr const char* SUPPORT_USED_ATTR = "support_used";
|
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* OBJECT_TYPE = "object";
|
||||||
static constexpr const char* VOLUME_TYPE = "volume";
|
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->gcode_weight = it->second->gcode_weight;
|
||||||
plate->toolpath_outside = it->second->toolpath_outside;
|
plate->toolpath_outside = it->second->toolpath_outside;
|
||||||
plate->is_support_used = it->second->is_support_used;
|
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->slice_filaments_info = it->second->slice_filaments_info;
|
||||||
plate->warnings = it->second->warnings;
|
plate->warnings = it->second->warnings;
|
||||||
plate->thumbnail_file = it->second->thumbnail_file;
|
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]->gcode_weight = it->second->gcode_weight;
|
||||||
plate_data_list[it->first-1]->toolpath_outside = it->second->toolpath_outside;
|
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_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]->slice_filaments_info = it->second->slice_filaments_info;
|
||||||
plate_data_list[it->first-1]->warnings = it->second->warnings;
|
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;
|
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)
|
if (m_curr_plater)
|
||||||
std::istringstream(value) >> std::boolalpha >> m_curr_plater->is_support_used;
|
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;
|
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 << "=\"" << 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 << "=\"" << 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 << "=\"" << 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++)
|
for (auto it = plate_data->slice_filaments_info.begin(); it != plate_data->slice_filaments_info.end(); it++)
|
||||||
{
|
{
|
||||||
|
|
|
@ -82,6 +82,7 @@ struct PlateData
|
||||||
bool is_support_used {false};
|
bool is_support_used {false};
|
||||||
bool is_sliced_valid = false;
|
bool is_sliced_valid = false;
|
||||||
bool toolpath_outside {false};
|
bool toolpath_outside {false};
|
||||||
|
bool is_label_object_enabled {false};
|
||||||
|
|
||||||
std::vector<GCodeProcessorResult::SliceWarning> warnings;
|
std::vector<GCodeProcessorResult::SliceWarning> warnings;
|
||||||
|
|
||||||
|
|
|
@ -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();
|
BOOST_LOG_TRIVIAL(info) << "Exporting G-code finished" << log_memory_info();
|
||||||
print->set_done(psGCodeExport);
|
print->set_done(psGCodeExport);
|
||||||
|
//BBS: set enable_label_object
|
||||||
|
result->label_object_enabled = m_enable_label_object;
|
||||||
|
|
||||||
// Write the profiler measurements to file
|
// Write the profiler measurements to file
|
||||||
PROFILE_UPDATE();
|
PROFILE_UPDATE();
|
||||||
|
|
|
@ -767,6 +767,8 @@ void GCodeProcessorResult::reset() {
|
||||||
bed_exclude_area = Pointfs();
|
bed_exclude_area = Pointfs();
|
||||||
//BBS: add toolpath_outside
|
//BBS: add toolpath_outside
|
||||||
toolpath_outside = false;
|
toolpath_outside = false;
|
||||||
|
//BBS: add label_object_enabled
|
||||||
|
label_object_enabled = false;
|
||||||
printable_height = 0.0f;
|
printable_height = 0.0f;
|
||||||
settings_ids.reset();
|
settings_ids.reset();
|
||||||
extruders_count = 0;
|
extruders_count = 0;
|
||||||
|
@ -792,6 +794,8 @@ void GCodeProcessorResult::reset() {
|
||||||
bed_exclude_area = Pointfs();
|
bed_exclude_area = Pointfs();
|
||||||
//BBS: add toolpath_outside
|
//BBS: add toolpath_outside
|
||||||
toolpath_outside = false;
|
toolpath_outside = false;
|
||||||
|
//BBS: add label_object_enabled
|
||||||
|
label_object_enabled = false;
|
||||||
printable_height = 0.0f;
|
printable_height = 0.0f;
|
||||||
settings_ids.reset();
|
settings_ids.reset();
|
||||||
extruders_count = 0;
|
extruders_count = 0;
|
||||||
|
|
|
@ -177,6 +177,8 @@ namespace Slic3r {
|
||||||
Pointfs bed_exclude_area;
|
Pointfs bed_exclude_area;
|
||||||
//BBS: add toolpath_outside
|
//BBS: add toolpath_outside
|
||||||
bool toolpath_outside;
|
bool toolpath_outside;
|
||||||
|
//BBS: add object_label_enabled
|
||||||
|
bool label_object_enabled;
|
||||||
float printable_height;
|
float printable_height;
|
||||||
SettingsIds settings_ids;
|
SettingsIds settings_ids;
|
||||||
size_t extruders_count;
|
size_t extruders_count;
|
||||||
|
@ -208,6 +210,7 @@ namespace Slic3r {
|
||||||
printable_area = other.printable_area;
|
printable_area = other.printable_area;
|
||||||
bed_exclude_area = other.bed_exclude_area;
|
bed_exclude_area = other.bed_exclude_area;
|
||||||
toolpath_outside = other.toolpath_outside;
|
toolpath_outside = other.toolpath_outside;
|
||||||
|
label_object_enabled = other.label_object_enabled;
|
||||||
printable_height = other.printable_height;
|
printable_height = other.printable_height;
|
||||||
settings_ids = other.settings_ids;
|
settings_ids = other.settings_ids;
|
||||||
extruders_count = other.extruders_count;
|
extruders_count = other.extruders_count;
|
||||||
|
|
|
@ -4583,6 +4583,7 @@ int PartPlateList::store_to_3mf_structure(PlateDataPtrs& plate_data_list, bool w
|
||||||
plate_data_item->gcode_prediction = std::to_string(
|
plate_data_item->gcode_prediction = std::to_string(
|
||||||
(int) m_plate_list[i]->get_slice_result()->print_statistics.modes[static_cast<size_t>(PrintEstimatedStatistics::ETimeMode::Normal)].time);
|
(int) m_plate_list[i]->get_slice_result()->print_statistics.modes[static_cast<size_t>(PrintEstimatedStatistics::ETimeMode::Normal)].time);
|
||||||
plate_data_item->toolpath_outside = m_plate_list[i]->m_gcode_result->toolpath_outside;
|
plate_data_item->toolpath_outside = m_plate_list[i]->m_gcode_result->toolpath_outside;
|
||||||
|
plate_data_item->is_label_object_enabled = m_plate_list[i]->m_gcode_result->label_object_enabled;
|
||||||
Print *print = nullptr;
|
Print *print = nullptr;
|
||||||
m_plate_list[i]->get_print((PrintBase **) &print, nullptr, nullptr);
|
m_plate_list[i]->get_print((PrintBase **) &print, nullptr, nullptr);
|
||||||
if (print) {
|
if (print) {
|
||||||
|
@ -4631,8 +4632,8 @@ int PartPlateList::load_from_3mf_structure(PlateDataPtrs& plate_data_list)
|
||||||
{
|
{
|
||||||
BOOST_LOG_TRIVIAL(warning) << __FUNCTION__ << boost::format(":plate index %1% seems invalid, skip it")% plate_data_list[i]->plate_index;
|
BOOST_LOG_TRIVIAL(warning) << __FUNCTION__ << boost::format(":plate index %1% seems invalid, skip it")% plate_data_list[i]->plate_index;
|
||||||
}
|
}
|
||||||
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << boost::format(": plate %1%, gcode_file %2%, is_sliced_valid %3%, toolpath_outside %4%, is_support_used %5%")
|
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << boost::format(": plate %1%, gcode_file %2%, is_sliced_valid %3%, toolpath_outside %4%, is_support_used %5% is_label_object_enabled %6%")
|
||||||
%i %plate_data_list[i]->gcode_file %plate_data_list[i]->is_sliced_valid %plate_data_list[i]->toolpath_outside %plate_data_list[i]->is_support_used;
|
%i %plate_data_list[i]->gcode_file %plate_data_list[i]->is_sliced_valid %plate_data_list[i]->toolpath_outside %plate_data_list[i]->is_support_used %plate_data_list[i]->is_label_object_enabled;
|
||||||
//load object and instance from 3mf
|
//load object and instance from 3mf
|
||||||
//just test for file correct or not, we will rebuild later
|
//just test for file correct or not, we will rebuild later
|
||||||
/*for (std::vector<std::pair<int, int>>::iterator it = plate_data_list[i]->objects_and_instances.begin(); it != plate_data_list[i]->objects_and_instances.end(); ++it)
|
/*for (std::vector<std::pair<int, int>>::iterator it = plate_data_list[i]->objects_and_instances.begin(); it != plate_data_list[i]->objects_and_instances.end(); ++it)
|
||||||
|
@ -4653,6 +4654,7 @@ int PartPlateList::load_from_3mf_structure(PlateDataPtrs& plate_data_list)
|
||||||
}
|
}
|
||||||
ps.total_used_filament *= 1000; //koef
|
ps.total_used_filament *= 1000; //koef
|
||||||
gcode_result->toolpath_outside = plate_data_list[i]->toolpath_outside;
|
gcode_result->toolpath_outside = plate_data_list[i]->toolpath_outside;
|
||||||
|
gcode_result->label_object_enabled = plate_data_list[i]->is_label_object_enabled;
|
||||||
m_plate_list[index]->slice_filaments_info = plate_data_list[i]->slice_filaments_info;
|
m_plate_list[index]->slice_filaments_info = plate_data_list[i]->slice_filaments_info;
|
||||||
gcode_result->warnings = plate_data_list[i]->warnings;
|
gcode_result->warnings = plate_data_list[i]->warnings;
|
||||||
if (m_plater && !plate_data_list[i]->thumbnail_file.empty()) {
|
if (m_plater && !plate_data_list[i]->thumbnail_file.empty()) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue