don't create HEADER_BLOCK_START if using BTT_TFT thumbnails (#7488)

* don't create HEADER_BLOCK_START if using BTT_TFT thumbnails

* Update GCode.cpp
This commit is contained in:
discip 2024-11-30 14:43:02 +01:00 committed by GitHub
parent e6eda3e7d0
commit c899c3ea6e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1898,36 +1898,42 @@ void GCode::_do_export(Print& print, GCodeOutputStream &file, ThumbnailsGenerato
if (!print.config().small_area_infill_flow_compensation_model.empty()) if (!print.config().small_area_infill_flow_compensation_model.empty())
m_small_area_infill_flow_compensator = make_unique<SmallAreaInfillFlowCompensator>(print.config()); m_small_area_infill_flow_compensator = make_unique<SmallAreaInfillFlowCompensator>(print.config());
// Orca: Don't output Header block if BTT thumbnail is identified in the list
// Get the thumbnails value as a string
std::string thumbnails_value = print.config().option<ConfigOptionString>("thumbnails")->value;
// search string for the BTT_TFT label
bool has_BTT_thumbnail = (thumbnails_value.find("BTT_TFT") != std::string::npos);
file.write_format("; HEADER_BLOCK_START\n"); if(!has_BTT_thumbnail){
// Write information on the generator. file.write_format("; HEADER_BLOCK_START\n");
file.write_format("; generated by %s on %s\n", Slic3r::header_slic3r_generated().c_str(), Slic3r::Utils::local_timestamp().c_str()); // Write information on the generator.
if (is_bbl_printers) file.write_format("; generated by %s on %s\n", Slic3r::header_slic3r_generated().c_str(), Slic3r::Utils::local_timestamp().c_str());
file.write_format(";%s\n", GCodeProcessor::reserved_tag(GCodeProcessor::ETags::Estimated_Printing_Time_Placeholder).c_str()); if (is_bbl_printers)
//BBS: total layer number file.write_format(";%s\n", GCodeProcessor::reserved_tag(GCodeProcessor::ETags::Estimated_Printing_Time_Placeholder).c_str());
file.write_format(";%s\n", GCodeProcessor::reserved_tag(GCodeProcessor::ETags::Total_Layer_Number_Placeholder).c_str()); //BBS: total layer number
m_enable_exclude_object = config().exclude_object; file.write_format(";%s\n", GCodeProcessor::reserved_tag(GCodeProcessor::ETags::Total_Layer_Number_Placeholder).c_str());
//Orca: extra check for bbl printer m_enable_exclude_object = config().exclude_object;
if (is_bbl_printers) { //Orca: extra check for bbl printer
if (print.calib_params().mode == CalibMode::Calib_None) { // Don't support skipping in cali mode if (is_bbl_printers) {
// list all label_object_id with sorted order here if (print.calib_params().mode == CalibMode::Calib_None) { // Don't support skipping in cali mode
m_enable_exclude_object = true; // list all label_object_id with sorted order here
m_label_objects_ids.clear(); m_enable_exclude_object = true;
m_label_objects_ids.reserve(print.num_object_instances()); m_label_objects_ids.clear();
for (const PrintObject *print_object : print.objects()) m_label_objects_ids.reserve(print.num_object_instances());
for (const PrintInstance &print_instance : print_object->instances()) for (const PrintObject *print_object : print.objects())
m_label_objects_ids.push_back(print_instance.model_instance->get_labeled_id()); for (const PrintInstance &print_instance : print_object->instances())
m_label_objects_ids.push_back(print_instance.model_instance->get_labeled_id());
std::sort(m_label_objects_ids.begin(), m_label_objects_ids.end()); std::sort(m_label_objects_ids.begin(), m_label_objects_ids.end());
std::string objects_id_list = "; model label id: "; std::string objects_id_list = "; model label id: ";
for (auto it = m_label_objects_ids.begin(); it != m_label_objects_ids.end(); it++) for (auto it = m_label_objects_ids.begin(); it != m_label_objects_ids.end(); it++)
objects_id_list += (std::to_string(*it) + (it != m_label_objects_ids.end() - 1 ? "," : "\n")); objects_id_list += (std::to_string(*it) + (it != m_label_objects_ids.end() - 1 ? "," : "\n"));
file.writeln(objects_id_list); file.writeln(objects_id_list);
} else { } else {
m_enable_exclude_object = false; m_enable_exclude_object = false;
m_label_objects_ids.clear(); m_label_objects_ids.clear();
} }
} }
{ {
@ -1949,7 +1955,7 @@ void GCode::_do_export(Print& print, GCodeOutputStream &file, ThumbnailsGenerato
} }
file.write_format("; HEADER_BLOCK_END\n\n"); file.write_format("; HEADER_BLOCK_END\n\n");
}
// BBS: write global config at the beginning of gcode file because printer // BBS: write global config at the beginning of gcode file because printer
// need these config information // need these config information