ENH: skip_objects: add the skipped_objects into sliced_info
Change-Id: I2a04aa00503a04cfe3e9d680ceabdb4947142d34 (cherry picked from commit ca548d69daa0bc2970efc080fcf1537e6babb278)
This commit is contained in:
parent
b437f6d646
commit
c7775ace16
|
@ -423,7 +423,9 @@ int CLI::run(int argc, char **argv)
|
|||
//const ForwardCompatibilitySubstitutionRule config_substitution_rule = m_config.option<ConfigOptionEnum<ForwardCompatibilitySubstitutionRule>>("config_compatibility", true)->value;
|
||||
const ForwardCompatibilitySubstitutionRule config_substitution_rule = ForwardCompatibilitySubstitutionRule::Enable;
|
||||
const std::vector<std::string> &load_filaments = m_config.option<ConfigOptionStrings>("load_filaments", true)->values;
|
||||
//skip model object logic
|
||||
const std::vector<int> &skip_objects = m_config.option<ConfigOptionInts>("skip_objects", true)->values;
|
||||
std::map<int, bool> skip_maps;
|
||||
bool need_skip = (skip_objects.size() > 0)?true:false;
|
||||
|
||||
if (start_gui) {
|
||||
|
@ -1810,6 +1812,8 @@ int CLI::run(int argc, char **argv)
|
|||
std::string outfile_dir = m_config.opt_string("outputdir");
|
||||
std::vector<ThumbnailData*> calibration_thumbnails;
|
||||
int max_slicing_time_per_plate = 0, max_triangle_count_per_plate = 0;
|
||||
std::vector<bool> plate_has_skips(partplate_list.get_plate_count(), false);
|
||||
std::vector<std::vector<size_t>> plate_skipped_objects(partplate_list.get_plate_count());
|
||||
for (auto const &opt_key : m_actions) {
|
||||
if (opt_key == "help") {
|
||||
this->print_help();
|
||||
|
@ -1879,8 +1883,7 @@ int CLI::run(int argc, char **argv)
|
|||
pre_check = false;
|
||||
bool finished = false;
|
||||
|
||||
//skip model object
|
||||
std::map<int, bool> skip_maps;
|
||||
//skip model object logic
|
||||
if (need_skip) {
|
||||
BOOST_LOG_TRIVIAL(info) << boost::format("need to skip objects, size %1%:")%skip_objects.size();
|
||||
for (int index = 0; index < skip_objects.size(); index++)
|
||||
|
@ -1974,6 +1977,8 @@ int CLI::run(int argc, char **argv)
|
|||
i->printable = false;
|
||||
if (i->print_volume_state == ModelInstancePVS_Inside) {
|
||||
skipped_count++;
|
||||
plate_has_skips[index] = true;
|
||||
plate_skipped_objects[index].emplace_back(i->loaded_id);
|
||||
BOOST_LOG_TRIVIAL(info) << boost::format("Plate %1%: skip object %2%.")%(index+1)%i->loaded_id;
|
||||
//need to regenerate the thumbnail
|
||||
if (plate_data_src.size() > index) {
|
||||
|
@ -2247,6 +2252,8 @@ int CLI::run(int argc, char **argv)
|
|||
PlateData *plate_data = plate_data_list[i];
|
||||
bool skip_this_plate = ((plate_to_slice != 0) && (plate_to_slice != (i + 1)))?true:false;
|
||||
|
||||
plate_data->skipped_objects = plate_skipped_objects[i];
|
||||
|
||||
for (auto it = plate_data->slice_filaments_info.begin(); it != plate_data->slice_filaments_info.end(); it++) {
|
||||
//it->filament_id = filament_id?filament_id->get_at(it->id):"unknown";
|
||||
std::string display_filament_type;
|
||||
|
@ -2266,6 +2273,11 @@ int CLI::run(int argc, char **argv)
|
|||
}
|
||||
}
|
||||
else {
|
||||
if (regenerate_thumbnails) {
|
||||
BOOST_LOG_TRIVIAL(info) << boost::format("thumbnails stage: plate %1%'s thumbnail file %2% cleared, need to regenerate")%(i+1) %plate_data->thumbnail_file;
|
||||
plate_data->thumbnail_file.clear();
|
||||
}
|
||||
else
|
||||
BOOST_LOG_TRIVIAL(info) << boost::format("thumbnails stage: plate %1%'s thumbnail file exists, no need to regenerate")%(i+1);
|
||||
}
|
||||
}
|
||||
|
@ -2292,6 +2304,12 @@ int CLI::run(int argc, char **argv)
|
|||
}
|
||||
}
|
||||
else {
|
||||
if (regenerate_thumbnails) {
|
||||
BOOST_LOG_TRIVIAL(info) << boost::format("thumbnails stage: plate %1%'s top_thumbnail file %2% cleared, need to regenerate")%(i+1) %plate_data->top_file;
|
||||
plate_data->top_file.clear();
|
||||
plate_data->pick_file.clear();
|
||||
}
|
||||
else
|
||||
BOOST_LOG_TRIVIAL(info) << boost::format("thumbnails stage: plate %1%'s top_thumbnail file exists, no need to regenerate")%(i+1);
|
||||
}
|
||||
}
|
||||
|
@ -2555,7 +2573,7 @@ int CLI::run(int argc, char **argv)
|
|||
glfwTerminate();
|
||||
}
|
||||
else {
|
||||
BOOST_LOG_TRIVIAL(info) << boost::format("use previous thumbnails, no need to regenerate");
|
||||
BOOST_LOG_TRIVIAL(info) << boost::format("Line %1%: use previous thumbnails, no need to regenerate")%__LINE__;
|
||||
for (int i = 0; i < partplate_list.get_plate_count(); i++) {
|
||||
PlateData *plate_data = plate_data_list[i];
|
||||
bool skip_this_plate = ((plate_to_slice != 0) && (plate_to_slice != (i + 1)))?true:false;
|
||||
|
|
|
@ -284,6 +284,8 @@ 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* SKIPPED_OBJECT_ATTR = "skipped_object";
|
||||
static constexpr const char* SKIPPED_OBJECT_ID_TAG = "id";
|
||||
|
||||
static constexpr const char* OBJECT_TYPE = "object";
|
||||
static constexpr const char* VOLUME_TYPE = "volume";
|
||||
|
@ -1418,6 +1420,7 @@ void PlateData::parse_filament_info(GCodeProcessorResult *result)
|
|||
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->skipped_objects = it->second->skipped_objects;
|
||||
plate->slice_filaments_info = it->second->slice_filaments_info;
|
||||
plate->warnings = it->second->warnings;
|
||||
plate->thumbnail_file = it->second->thumbnail_file;
|
||||
|
@ -2051,6 +2054,7 @@ void PlateData::parse_filament_info(GCodeProcessorResult *result)
|
|||
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]->skipped_objects = it->second->skipped_objects;
|
||||
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]->pattern_file = (m_load_restore || it->second->pattern_file.empty()) ? it->second->pattern_file : m_backup_path + "/" + it->second->pattern_file;
|
||||
|
@ -3930,6 +3934,10 @@ void PlateData::parse_filament_info(GCodeProcessorResult *result)
|
|||
if (m_curr_plater)
|
||||
std::istringstream(value) >> std::boolalpha >> m_curr_plater->is_label_object_enabled;
|
||||
}
|
||||
else if (key == SKIPPED_OBJECT_ATTR)
|
||||
{
|
||||
//currently not processed
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -7217,6 +7225,11 @@ void PlateData::parse_filament_info(GCodeProcessorResult *result)
|
|||
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->skipped_objects.begin(); it != plate_data->skipped_objects.end(); it++)
|
||||
{
|
||||
stream << " <" << SKIPPED_OBJECT_ATTR << " " << SKIPPED_OBJECT_ID_TAG << "=\"" << std::to_string(*it) << "\" />\n";
|
||||
}
|
||||
|
||||
for (auto it = plate_data->slice_filaments_info.begin(); it != plate_data->slice_filaments_info.end(); it++)
|
||||
{
|
||||
stream << " <" << FILAMENT_TAG << " " << FILAMENT_ID_TAG << "=\"" << std::to_string(it->id + 1) << "\" "
|
||||
|
|
|
@ -78,6 +78,7 @@ struct PlateData
|
|||
std::string gcode_weight;
|
||||
std::string plate_name;
|
||||
std::vector<FilamentInfo> slice_filaments_info;
|
||||
std::vector<size_t> skipped_objects;
|
||||
DynamicPrintConfig config;
|
||||
bool is_support_used {false};
|
||||
bool is_sliced_valid = false;
|
||||
|
|
|
@ -4942,7 +4942,7 @@ CLIMiscConfigDef::CLIMiscConfigDef()
|
|||
def = this->add("skip_objects", coStrings);
|
||||
def->label = L("Skip Objects");
|
||||
def->tooltip = L("Skip some objects in this print");
|
||||
def->cli_params = "\"3;5;10;77\"";
|
||||
def->cli_params = "\"3,5,10,77\"";
|
||||
def->set_default_value(new ConfigOptionInts());
|
||||
|
||||
/*def = this->add("output", coString);
|
||||
|
|
Loading…
Reference in New Issue