I am using actually an Raspberry PI to print my files now (do not want to have PC running and will integrate also camera).
Only problem is that if I look at printer I do not know how far I am with print!
This caused me to (re)write a small Python script which I can add to Kisslicer (Printer/Firmware postprocess line)
The printer discplays on bottom line: Ln/m x%
where n=current layer, m = total layers and x = % of layers printed
The code for "Count.py" is:
Code: Select all
#!/usr/bin/env python """ Gcode to add 'layer/of layers %' message to KISSlicer. Please add to Kisslicer Printer/Firmware/Post-Process the following: /full/path/to/Count.py "<FILE>" """ import math import os import re import sys def rewrite(infile, outfile, verbose=False): nl = 0 ml = 0 for line in infile: match = re.match(r'^; BEGIN_LAYER_OBJECT',line.rstrip()) if match: nl += 1 infile.seek(0) ml = nl nl = 0 if verbose: print("Max Layer=",ml) for line in infile: outfile.write(line) match = re.match(r'^; BEGIN_LAYER_OBJECT',line.rstrip()) if match: line = "M117 L%d/%d %2.1f%%" %(nl,ml,(100.0*nl)/ml) outfile.write(line+'\n') nl += 1 line = "M117 L%d/%d Done" %(nl,ml) outfile.write(line) if verbose: print(line) outfile.write("\n; Count.py END") if __name__ == '__main__': if len(sys.argv) < 2: sys.exit('usage: Count.py <filename> [--verbose]') infilename = sys.argv outfilename = '%s.count%s' % os.path.splitext(infilename) with open(infilename) as infile: with open(outfilename, 'w') as outfile: rewrite(infile, outfile, '--verbose' in sys.argv)
Oh yes, the new file created will be called *.count.gcode, so you can select the original or the one which is counting
I put the script into Kisslicer directory where I have others as well, maybe I combine them later to something more configurable