Guest User

Spiral gcode generator

a guest
Feb 12th, 2015
283
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.12 KB | None | 0 0
  1. #! /usr/bin/python
  2.  
  3. # This spiral drilling gcode generator by Dmitry Platonov is public domain
  4. # Feel free to edit, distribute and use it any way you like
  5. # contact author [email protected]
  6.  
  7. #setup
  8. feed = 800
  9. feed_finish = 100
  10. center_x = 25.0
  11. center_y = 90.0
  12. safe_z = 15.0
  13. start_z = 0.0
  14. stop_z = -24.0
  15. step_z = -2.0
  16. r = 1.1
  17. #setup end
  18.  
  19. base_x = center_x - r
  20. base_y = center_y
  21.  
  22. cur_z = start_z
  23. print "G0 Z%.4f" % (safe_z,)
  24. print "G0 X%.4f Y%.4f" % (base_x, base_y)
  25. print "G0 Z%.4f" % (start_z,)
  26. while cur_z > stop_z:
  27.         cur_z += step_z
  28.         print "G3 X%.4f Y%.4f I%.4f J0 Z%.4f F%f" % (base_x, base_y, r, cur_z, feed)
  29. print "G3 X%.4f Y%.4f I%.4f J0 Z%.4f F%f" % (base_x, base_y, r, cur_z, feed)
  30. print "G3 X%.4f Y%.4f I%.4f J0 Z%.4f F%f" % (base_x, base_y, r, cur_z, feed)
  31. print "G3 X%.4f Y%.4f I%.4f J0 Z%.4f F%f" % (base_x, base_y, r, cur_z, feed)
  32. print "G3 X%.4f Y%.4f I%.4f J0 Z%.4f F%f" % (base_x, base_y, r, cur_z, feed_finish)
  33. print "G3 X%.4f Y%.4f I%.4f J0 Z%.4f F%f" % (base_x, base_y, r, cur_z, feed_finish)
  34. print "G0 X%.4f Y%.4f Z%.4f" % (center_x, center_y, safe_z)
  35. print "M30"
  36. print "%"
Advertisement
Add Comment
Please, Sign In to add comment