tuergriff.py 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. #!/usr/bin/env python
  2. from pync import *
  3. FEED = 200
  4. ZFEED = 50
  5. REDUCEDFEED = 120
  6. MILL_RADIUS = 5.0
  7. WP_RADIUS = 5.0
  8. STEPS = 20
  9. # sin(a) = Z/radius
  10. # cos(a) = XY/radius
  11. def calcOffsets(angle, radius):
  12. angle = radians(angle)
  13. xy = radius * cos(angle)
  14. z = radius * sin(angle)
  15. return (xy, z)
  16. G64(0.03)
  17. G0(0, 0, 5)
  18. S(1500) - M3 - F(FEED)
  19. angle = 0.0
  20. while True:
  21. (millXY, millZ) = calcOffsets(angle, MILL_RADIUS)
  22. (wpXY, wpZ) = calcOffsets(angle, WP_RADIUS)
  23. Comment("mXY%f mZ%f wXY%f wZ%f" % (millXY, millZ, wpXY, wpZ))
  24. xyOff = WP_RADIUS - millXY - wpXY
  25. Comment("PLANE OFFSET %f" % xyOff)
  26. X = 39.5
  27. Y = 9.5
  28. Z = 0.0 - WP_RADIUS - MILL_RADIUS + millZ + wpZ
  29. if equal(angle, 0):
  30. G0(X - WP_RADIUS - 2, Y + xyOff - 2) # Clear X/Y
  31. else:
  32. G0(Z=(Z + 5))
  33. M1()
  34. # G0(Z=Z)
  35. G1(X - WP_RADIUS, Y + xyOff, Z=Z) - F(ZFEED)
  36. G1(-(X - WP_RADIUS), Y + xyOff) - F(FEED)
  37. G3(X = -(X + xyOff), Y = Y - WP_RADIUS,
  38. I = 0, J = -(WP_RADIUS + xyOff)) - F(REDUCEDFEED)
  39. G1(-(X + xyOff), -(Y - WP_RADIUS)) - F(FEED)
  40. G3(X = -(X - WP_RADIUS), Y = -(Y + xyOff),
  41. I = WP_RADIUS + xyOff, J = 0) - F(REDUCEDFEED)
  42. G1(X - WP_RADIUS, -(Y + xyOff)) - F(FEED)
  43. G3(X = X + xyOff, Y = -(Y - WP_RADIUS),
  44. I = 0, J = WP_RADIUS + xyOff) - F(REDUCEDFEED)
  45. G1(X + xyOff, Y - WP_RADIUS) - F(FEED)
  46. G3(X = X - WP_RADIUS, Y = Y + xyOff,
  47. I = -(WP_RADIUS + xyOff), J = 0) - F(REDUCEDFEED)
  48. G1(X - WP_RADIUS - 2, Y + xyOff) - F(FEED)
  49. G0(X - WP_RADIUS - 2, Y + xyOff - 2) # Clear X/Y
  50. angle += 90.0 / STEPS
  51. if equal(angle, 90):
  52. break
  53. G0(Z=5) - M5