Added gcode_label_objects and gcode_comments option

This commit is contained in:
SoftFever 2023-03-12 17:36:54 +08:00
parent 11679d6858
commit a47c756112
12 changed files with 37 additions and 19 deletions

View file

@ -80,8 +80,6 @@ static const float g_min_purge_volume = 100.f;
static const float g_purge_volume_one_time = 135.f;
static const int g_max_flush_count = 4;
bool GCode::gcode_label_objects = true;
Vec2d travel_point_1;
Vec2d travel_point_2;
Vec2d travel_point_3;
@ -1036,6 +1034,7 @@ void GCode::do_export(Print* print, const char* path, GCodeProcessorResult* resu
// BBS
m_curr_print = print;
GCodeWriter::full_gcode_comment = print->config().gcode_comments;
CNumericLocalesSetter locales_setter;
// Does the file exist? If so, we hope that it is still valid.
@ -1046,11 +1045,6 @@ void GCode::do_export(Print* print, const char* path, GCodeProcessorResult* resu
GCodeProcessor::s_IsBBLPrinter = print->is_BBL_printer();
print->set_started(psGCodeExport);
if (print->is_BBL_printer())
gcode_label_objects = false;
else
gcode_label_objects = true;
// check if any custom gcode contains keywords used by the gcode processor to
// produce time estimation and gcode toolpaths
@ -3189,7 +3183,7 @@ GCode::LayerResult GCode::process_layer(
m_object_layer_over_raft = object_layer_over_raft;
if (m_config.reduce_crossing_wall)
m_avoid_crossing_perimeters.init_layer(*m_layer);
if (GCode::gcode_label_objects) {
if (this->config().gcode_label_objects) {
gcode += std::string("; printing object ") + instance_to_print.print_object.model_object()->name + " id:" + std::to_string(instance_to_print.layer_id) + " copy " + std::to_string(instance_to_print.instance_id) + "\n";
if (!m_config.use_relative_e_distances)
gcode += m_writer.reset_e(true);
@ -3281,7 +3275,7 @@ GCode::LayerResult GCode::process_layer(
// ironing
gcode += this->extrude_infill(print,by_region_specific, true);
}
if (GCode::gcode_label_objects) {
if (this->config().gcode_label_objects) {
gcode += std::string("; stop printing object ") + instance_to_print.print_object.model_object()->name + " id:" + std::to_string(instance_to_print.layer_id) + " copy " + std::to_string(instance_to_print.instance_id) + "\n";
if (!m_config.use_relative_e_distances)
gcode += m_writer.reset_e(true);