Advertisement
Guest User

Untitled

a guest
Oct 16th, 2018
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.47 KB | None | 0 0
  1. import math
  2. import numpy as np
  3.  
  4. R = 10
  5.  
  6. def lower_pen(f):
  7. f.write('G1 Z-2.0\n')
  8.  
  9. def raise_pen(f):
  10. f.write('G1 Z0.0\n')
  11.  
  12. def move(f, x, y):
  13. f.write('G1 X{:.2f} Y{:.2f}\n'.format(x, y))
  14.  
  15. f = open('simple_test.gcode', 'w')
  16.  
  17. move(f, 1, 0)
  18.  
  19. lower_pen(f)
  20.  
  21. for i in np.arange(0, 2 * math.pi, (2 * math.pi) / 50):
  22. x = math.cos(i)
  23. y = math.sin(i)
  24. print('angle: {}; x: {}; y: {}'.format(i, x, y))
  25. move(f, x, y)
  26.  
  27. raise_pen(f)
  28.  
  29. f.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement