Added specific option for labelling gcode sections on object change. Finishes implementing #4444

Thanks to @supermerill for the initial implementation.
This commit is contained in:
Joseph Lenox 2018-07-05 13:55:33 -05:00
parent 89f8623eea
commit 75de746431
4 changed files with 11 additions and 1 deletions

View File

@ -464,6 +464,7 @@ sub options {
notes notes
complete_objects extruder_clearance_radius extruder_clearance_height complete_objects extruder_clearance_radius extruder_clearance_height
gcode_comments output_filename_format gcode_comments output_filename_format
label_printed_objects
post_process post_process
perimeter_extruder infill_extruder solid_infill_extruder perimeter_extruder infill_extruder solid_infill_extruder
support_material_extruder support_material_interface_extruder support_material_extruder support_material_interface_extruder
@ -727,6 +728,7 @@ sub build {
{ {
my $optgroup = $page->new_optgroup('Output file'); my $optgroup = $page->new_optgroup('Output file');
$optgroup->append_single_option_line('gcode_comments'); $optgroup->append_single_option_line('gcode_comments');
$optgroup->append_single_option_line('label_printed_objects');
{ {
my $option = $optgroup->get_option('output_filename_format'); my $option = $optgroup->get_option('output_filename_format');

View File

@ -546,7 +546,7 @@ sub process_layer {
my $copy_idx = 0; my $copy_idx = 0;
for my $copy (@$object_copies) { 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"; $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 # when starting a new object, use the external motion planner for the first travel move

View File

@ -757,6 +757,12 @@ PrintConfigDef::PrintConfigDef()
def->category = "Layers and Perimeters"; def->category = "Layers and Perimeters";
def->default_value = new ConfigOptionBool(false); 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 = this->add("layer_gcode", coString);
def->label = "After layer change G-code"; 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]."; 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].";

View File

@ -338,6 +338,7 @@ class GCodeConfig : public virtual StaticPrintConfig
ConfigOptionStrings filament_notes; ConfigOptionStrings filament_notes;
ConfigOptionBool gcode_comments; ConfigOptionBool gcode_comments;
ConfigOptionEnum<GCodeFlavor> gcode_flavor; ConfigOptionEnum<GCodeFlavor> gcode_flavor;
ConfigOptionBool label_printed_objects;
ConfigOptionString layer_gcode; ConfigOptionString layer_gcode;
ConfigOptionFloat max_print_speed; ConfigOptionFloat max_print_speed;
ConfigOptionFloat max_volumetric_speed; ConfigOptionFloat max_volumetric_speed;
@ -381,6 +382,7 @@ class GCodeConfig : public virtual StaticPrintConfig
OPT_PTR(filament_notes); OPT_PTR(filament_notes);
OPT_PTR(gcode_comments); OPT_PTR(gcode_comments);
OPT_PTR(gcode_flavor); OPT_PTR(gcode_flavor);
OPT_PTR(label_printed_objects);
OPT_PTR(layer_gcode); OPT_PTR(layer_gcode);
OPT_PTR(max_print_speed); OPT_PTR(max_print_speed);
OPT_PTR(max_volumetric_speed); OPT_PTR(max_volumetric_speed);