label_printed_objects for Octoprint-Cancelobject

This commit is contained in:
supermerill 2018-12-07 17:02:42 +01:00
parent 2eab8fd3ef
commit 577b8444a4
6 changed files with 18 additions and 7 deletions

View File

@ -1557,7 +1557,7 @@ void GCode::process_layer(
unsigned int copy_id = 0;
for (const Point &copy : 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;

View File

@ -128,6 +128,7 @@ bool Print::invalidate_state_by_config_options(const std::vector<t_config_option
"first_layer_speed",
"first_layer_infill_speed",
"gcode_comments",
"label_printed_objects",
"gcode_flavor",
"infill_acceleration",
"layer_gcode",

View File

@ -934,11 +934,17 @@ PrintConfigDef::PrintConfigDef()
def = this->add("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. "

View File

@ -630,6 +630,7 @@ public:
ConfigOptionFloats filament_cooling_final_speed;
ConfigOptionStrings filament_ramming_parameters;
ConfigOptionBool gcode_comments;
ConfigOptionBool label_printed_objects;
ConfigOptionEnum<GCodeFlavor> 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);

View File

@ -314,7 +314,8 @@ const std::vector<std::string>& 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;
}

View File

@ -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);