#!/usr/bin/env python2.7
import linuxcnc
import time

stat = linuxcnc.stat()

with open("position-log.txt", "w") as outfile:
    while True:
       

       stat.poll()
       x,y,z,a,b,c,u,v,w = stat.actual_position

       outfile.write("X ")
       outfile.write("{:.4f}\n".format(x))
       outfile.write("Y ")
       outfile.write("{:.4f}\n".format(y))
       

       time.sleep(0.01)