diff --git a/lib/Slic3r/GUI/PresetEditor.pm b/lib/Slic3r/GUI/PresetEditor.pm index 13c8cf978..570cf86db 100644 --- a/lib/Slic3r/GUI/PresetEditor.pm +++ b/lib/Slic3r/GUI/PresetEditor.pm @@ -464,6 +464,7 @@ sub options { notes complete_objects extruder_clearance_radius extruder_clearance_height gcode_comments output_filename_format + label_printed_objects post_process perimeter_extruder infill_extruder solid_infill_extruder support_material_extruder support_material_interface_extruder @@ -727,6 +728,7 @@ sub build { { my $optgroup = $page->new_optgroup('Output file'); $optgroup->append_single_option_line('gcode_comments'); + $optgroup->append_single_option_line('label_printed_objects'); { my $option = $optgroup->get_option('output_filename_format'); diff --git a/lib/Slic3r/Print/GCode.pm b/lib/Slic3r/Print/GCode.pm index 8bff1e471..c5a9457f3 100644 --- a/lib/Slic3r/Print/GCode.pm +++ b/lib/Slic3r/Print/GCode.pm @@ -546,7 +546,7 @@ sub process_layer { my $copy_idx = 0; for my $copy (@$object_copies) { - if ($self->config->gcode_comments) { + if ($self->config->label_printed_objects) { $gcode .= "; printing object " . $object->model_object()->name . " id:" . $obj_idx . " copy " . $copy_idx . "\n"; } # when starting a new object, use the external motion planner for the first travel move diff --git a/xs/src/libslic3r/PrintConfig.cpp b/xs/src/libslic3r/PrintConfig.cpp index bd6a43c03..b170ce12b 100644 --- a/xs/src/libslic3r/PrintConfig.cpp +++ b/xs/src/libslic3r/PrintConfig.cpp @@ -757,6 +757,12 @@ PrintConfigDef::PrintConfigDef() def->category = "Layers and Perimeters"; def->default_value = new ConfigOptionBool(false); + 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("layer_gcode", coString); def->label = "After layer change G-code"; def->tooltip = "This custom code is inserted at every layer change, right after the Z move and before the extruder moves to the first layer point. Note that you can use placeholder variables for all Slic3r settings as well as [layer_num], [layer_z] and [current_retraction]."; diff --git a/xs/src/libslic3r/PrintConfig.hpp b/xs/src/libslic3r/PrintConfig.hpp index 02f6887a4..cca79a2c0 100644 --- a/xs/src/libslic3r/PrintConfig.hpp +++ b/xs/src/libslic3r/PrintConfig.hpp @@ -338,6 +338,7 @@ class GCodeConfig : public virtual StaticPrintConfig ConfigOptionStrings filament_notes; ConfigOptionBool gcode_comments; ConfigOptionEnum gcode_flavor; + ConfigOptionBool label_printed_objects; ConfigOptionString layer_gcode; ConfigOptionFloat max_print_speed; ConfigOptionFloat max_volumetric_speed; @@ -381,6 +382,7 @@ class GCodeConfig : public virtual StaticPrintConfig OPT_PTR(filament_notes); OPT_PTR(gcode_comments); OPT_PTR(gcode_flavor); + OPT_PTR(label_printed_objects); OPT_PTR(layer_gcode); OPT_PTR(max_print_speed); OPT_PTR(max_volumetric_speed);