Verison 1.0.3 Release
Based on Buildbotics 0.4.14
This commit is contained in:
27
scripts/log-position-to-gcode
Normal file
27
scripts/log-position-to-gcode
Normal file
@@ -0,0 +1,27 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
import json
|
||||
import sys
|
||||
|
||||
p = [0, 0, 0]
|
||||
|
||||
|
||||
print('F400 G21')
|
||||
|
||||
for line in sys.stdin:
|
||||
try:
|
||||
if not line.startswith('I:Comm:> '): continue
|
||||
line = line[9:]
|
||||
|
||||
data = json.loads(line)
|
||||
|
||||
changed = False
|
||||
for axis in range(3):
|
||||
var = 'xyz'[axis] + 'p'
|
||||
if var in data:
|
||||
p[axis] = data[var]
|
||||
changed = True
|
||||
|
||||
if changed: print('G1 X%d Y%d Z%d' % tuple(p))
|
||||
|
||||
except json.decoder.JSONDecodeError: pass
|
||||
Reference in New Issue
Block a user