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
file.write_format("; HEADER_BLOCK_START\n"); // Get the thumbnails value as a string
// Write information on the generator. std::string thumbnails_value = print.config().option<ConfigOptionString>("thumbnails")->value;
file.write_format("; generated by %s on %s\n", Slic3r::header_slic3r_generated().c_str(), Slic3r::Utils::local_timestamp().c_str()); // search string for the BTT_TFT label
if (is_bbl_printers) bool has_BTT_thumbnail = (thumbnails_value.find("BTT_TFT") != std::string::npos);
file.write_format(";%s\n", GCodeProcessor::reserved_tag(GCodeProcessor::ETags::Estimated_Printing_Time_Placeholder).c_str());
//BBS: total layer number if(!has_BTT_thumbnail){
file.write_format(";%s\n", GCodeProcessor::reserved_tag(GCodeProcessor::ETags::Total_Layer_Number_Placeholder).c_str()); file.write_format("; HEADER_BLOCK_START\n");
m_enable_exclude_object = config().exclude_object; // Write information on the generator.
//Orca: extra check for bbl printer file.write_format("; generated by %s on %s\n", Slic3r::header_slic3r_generated().c_str(), Slic3r::Utils::local_timestamp().c_str());
if (is_bbl_printers) { if (is_bbl_printers)
if (print.calib_params().mode == CalibMode::Calib_None) { // Don't support skipping in cali mode file.write_format(";%s\n", GCodeProcessor::reserved_tag(GCodeProcessor::ETags::Estimated_Printing_Time_Placeholder).c_str());
// list all label_object_id with sorted order here //BBS: total layer number
m_enable_exclude_object = true; file.write_format(";%s\n", GCodeProcessor::reserved_tag(GCodeProcessor::ETags::Total_Layer_Number_Placeholder).c_str());
m_label_objects_ids.clear(); m_enable_exclude_object = config().exclude_object;
m_label_objects_ids.reserve(print.num_object_instances()); //Orca: extra check for bbl printer
for (const PrintObject *print_object : print.objects()) if (is_bbl_printers) {
for (const PrintInstance &print_instance : print_object->instances()) if (print.calib_params().mode == CalibMode::Calib_None) { // Don't support skipping in cali mode
m_label_objects_ids.push_back(print_instance.model_instance->get_labeled_id()); // list all label_object_id with sorted order here
m_enable_exclude_object = true;
std::sort(m_label_objects_ids.begin(), m_label_objects_ids.end()); m_label_objects_ids.clear();
m_label_objects_ids.reserve(print.num_object_instances());
std::string objects_id_list = "; model label id: "; for (const PrintObject *print_object : print.objects())
for (auto it = m_label_objects_ids.begin(); it != m_label_objects_ids.end(); it++) for (const PrintInstance &print_instance : print_object->instances())
objects_id_list += (std::to_string(*it) + (it != m_label_objects_ids.end() - 1 ? "," : "\n")); m_label_objects_ids.push_back(print_instance.model_instance->get_labeled_id());
file.writeln(objects_id_list);
} else { std::sort(m_label_objects_ids.begin(), m_label_objects_ids.end());
m_enable_exclude_object = false;
m_label_objects_ids.clear(); std::string objects_id_list = "; model label id: ";
} 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"));
file.writeln(objects_id_list);
} else {
m_enable_exclude_object = false;
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