diff --git a/xs/src/libslic3r/GCode.cpp b/xs/src/libslic3r/GCode.cpp index 3b346bf2d..6c431f99a 100644 --- a/xs/src/libslic3r/GCode.cpp +++ b/xs/src/libslic3r/GCode.cpp @@ -1557,7 +1557,7 @@ void GCode::process_layer( unsigned int copy_id = 0; for (const Point © : copies) { - if (this->config().gcode_comments){ + if (this->config().label_printed_objects) { gcode += ((std::ostringstream&)(std::ostringstream() << "; printing object " << print_object->model_object()->name << " id:" << layer_id << " copy " << copy_id << "\n")).str(); } // When starting a new object, use the external motion planner for the first travel move. @@ -1580,7 +1580,7 @@ void GCode::process_layer( gcode += this->extrude_perimeters(print, by_region_specific, lower_layer_edge_grids[layer_id]); gcode += this->extrude_infill(print, by_region_specific, false); } - if (this->config().gcode_comments) { + if (this->config().label_printed_objects) { gcode += ((std::ostringstream&)(std::ostringstream() << "; stop printing object " << print_object->model_object()->name << " id:" << layer_id << " copy " << copy_id << "\n")).str(); } ++copy_id; diff --git a/xs/src/libslic3r/Print.cpp b/xs/src/libslic3r/Print.cpp index ca4db7d65..c16041eea 100644 --- a/xs/src/libslic3r/Print.cpp +++ b/xs/src/libslic3r/Print.cpp @@ -128,6 +128,7 @@ bool Print::invalidate_state_by_config_options(const std::vectoradd("gcode_comments", coBool); def->label = L("Verbose G-code"); def->tooltip = L("Enable this to get a commented G-code file, with each line explained by a descriptive text. " - "If you print from SD card, the additional weight of the file could make your firmware " - "slow down."); + "If you print from SD card, the additional weight of the file could make your firmware " + "slow down."); def->cli = "gcode-comments!"; def->default_value = new ConfigOptionBool(0); + def = this->add("label_printed_objects", coBool); + def->label = "Label Prints with Object ID"; + def->tooltip = "Enable this to add comments in the G-Code that label print moves with what object they belong. Can be used with Octoprint CancelObject plugin."; + def->cli = "label-printed-objects!"; + def->default_value = new ConfigOptionBool(0); + def = this->add("gcode_flavor", coEnum); def->label = L("G-code flavor"); def->tooltip = L("Some G/M-code commands, including temperature control and others, are not universal. " diff --git a/xs/src/libslic3r/PrintConfig.hpp b/xs/src/libslic3r/PrintConfig.hpp index f73cad18a..4dc2d95c8 100644 --- a/xs/src/libslic3r/PrintConfig.hpp +++ b/xs/src/libslic3r/PrintConfig.hpp @@ -630,6 +630,7 @@ public: ConfigOptionFloats filament_cooling_final_speed; ConfigOptionStrings filament_ramming_parameters; ConfigOptionBool gcode_comments; + ConfigOptionBool label_printed_objects; ConfigOptionEnum gcode_flavor; ConfigOptionString layer_gcode; ConfigOptionFloat max_print_speed; @@ -698,6 +699,7 @@ protected: OPT_PTR(filament_cooling_final_speed); OPT_PTR(filament_ramming_parameters); OPT_PTR(gcode_comments); + OPT_PTR(label_printed_objects); OPT_PTR(gcode_flavor); OPT_PTR(layer_gcode); OPT_PTR(max_print_speed); diff --git a/xs/src/slic3r/GUI/Preset.cpp b/xs/src/slic3r/GUI/Preset.cpp index ea70bfdfe..cc432d3cd 100644 --- a/xs/src/slic3r/GUI/Preset.cpp +++ b/xs/src/slic3r/GUI/Preset.cpp @@ -314,7 +314,8 @@ const std::vector& Preset::print_options() , "seam_travel" , "remove_small_gaps" , "infill_not_connected" - ,"first_layer_infill_speed" + , "first_layer_infill_speed" + , "label_printed_objects" }; return s_opts; } diff --git a/xs/src/slic3r/GUI/Tab.cpp b/xs/src/slic3r/GUI/Tab.cpp index c62daa2ca..d3d74f6c2 100644 --- a/xs/src/slic3r/GUI/Tab.cpp +++ b/xs/src/slic3r/GUI/Tab.cpp @@ -1011,8 +1011,9 @@ void TabPrint::build() line.append_option(option); optgroup->append_line(line); - optgroup = page->new_optgroup(_(L("Output file"))); - optgroup->append_single_option_line("gcode_comments"); + optgroup = page->new_optgroup(_(L("Output file"))); + optgroup->append_single_option_line("gcode_comments"); + optgroup->append_single_option_line("label_printed_objects"); option = optgroup->get_option("output_filename_format"); option.opt.full_width = true; optgroup->append_single_option_line(option);