Add G02/03 arc conversion/pre-processor script and example streaming script

Beta pre-processor script used to clean and streamline g-code for
streaming and converts G02/03 arcs into linear segments. Allows for full
acceleration support if the pre-processed g-code is then streamed to
grill, sans G02/03 arcs. Added a simple example streaming script for
Python users.
This commit is contained in:
Sonny J
2011-09-03 16:08:42 -06:00
parent 5c2150daa9
commit 75bd4c5ac3
2 changed files with 257 additions and 0 deletions

33
script/simple_stream.py Executable file
View File

@ -0,0 +1,33 @@
#!/usr/bin/env python
"""\
Simple g-code streaming script for grbl
"""
import serial
import time
# Open grbl serial port
s = serial.Serial('/dev/tty.usbmodem1811',9600)
# Open g-code file
f = open('grbl.gcode','r');
# Wake up grbl
s.write("\r\n\r\n")
time.sleep(2) # Wait for grbl to initialize
s.flushInput() # Flush startup text in serial input
# Stream g-code to grbl
for line in f:
l = line.strip() # Strip all EOL characters for consistency
print 'Sending: ' + l,
s.write(l + '\n') # Send g-code block to grbl
grbl_out = s.readline() # Wait for grbl response with carriage return
print ' : ' + grbl_out.strip()
# Wait here until grbl is finished to close serial port and file.
raw_input(" Press <Enter> to exit and disable grbl.")
# Close file and serial port
f.close()
s.close()