Skip to content

Instantly share code, notes, and snippets.

@tylermenezes
Created November 11, 2011 03:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tylermenezes/1357095 to your computer and use it in GitHub Desktop.
Save tylermenezes/1357095 to your computer and use it in GitHub Desktop.
Splits GCode
#!/usr/bin/python
import sys
if len(sys.argv) < 2:
print "Usage: split.py [filename]"
quit()
with open(sys.argv[1], 'r') as f:
data = f.readlines()
fileNo = 1
lineNo = 0
newFile = ''
for line in data:
if ++lineNo >= 499:
with open(str(fileNo) + "-" + sys.argv[1], 'w') as newF:
newF.write(newFile)
fileNo += 1
newFile = ''
lineNo = 0
else:
newFile += data + "\n"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment