Plugin to add M117 codes to gCode file during upload

I have a standalone perl script that modifies the Cura generated gCode.

The main functions include :

  1. count the total number of layers in the file
  2. count the total number of print lines in the file
  3. at each layer change, add an M117 gCode to show :
    layer count / total layers % of layers % of lines
    for example :
    M117 L 27/270 10% 14% ( = on layer 27 of 270, 10% thru the layers and 14% thru the lines to print )

I am using the existing plugin M117navbar to display the data in the Octoprint browser window.

Is there a way to turn this in to a plugin that modifies the gCode file as it is uploaded instead of having to run the gCode file thru a perl script ?

You're looking for this plugin ?!?

Thanks BerndJM.
Do you know if the % is calculated for the layer progress, or the number of lines printed ( % thru the gCode file lines ) ?

As far as I know the % are the same as in the progress bar on the left side.
How this is calculated - no idea. Think the easiest would be to ask the author of the plugin.

Hi,
I am the author of DisplayLayerProgress.
The answer was right, progress value is the same as already shown in Octoprint.
The octoprint progress is calculated on filesize. See https://discourse.octoprint.org/t/how-does-octoprint-calculate-progress/1265

BR
Olli

1 Like

Thank You for the clarification Olli