Skip to content

Instantly share code, notes, and snippets.

@alexqzd
Created August 17, 2021 02:05
Show Gist options
  • Select an option

  • Save alexqzd/8f4b8fe1f35fe10884f436d5c8ddc2ca to your computer and use it in GitHub Desktop.

Select an option

Save alexqzd/8f4b8fe1f35fe10884f436d5c8ddc2ca to your computer and use it in GitHub Desktop.
PrusaSlicer post-processing script to show on the LCD screen which type of feature is currently being printed.
#!/usr/bin/python
import sys
import re
import os
import sys
sourceFile = sys.argv[1]
# Read the ENTIRE g-code file into memory
with open(sourceFile, "r") as f:
lines = f.read()
type_expresion = r'(;TYPE:(.*))'
lines = re.sub(type_expresion, r"\1\nM117 Printing: \2", lines)
with open(sourceFile, "w") as of:
of.write(lines)
of.close()
f.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment