mechanics.py 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. #!/usr/bin/env python
  2. """
  3. #
  4. # CNC-control
  5. # Frontplate PYNC program
  6. #
  7. # Copyright (C) 2011 Michael Buesch <mb@bues.ch>
  8. #
  9. """
  10. from pync import *
  11. r = 1.19 # Tool radius
  12. t = 3.5 # Depth
  13. s = 1.8 # Step
  14. FEED = 100
  15. ZFEED = 80
  16. G0(Z=5) -G64(0.05)
  17. S(15000) -M3
  18. def jogButtons(z):
  19. G0(X=25+r+2, Y=-18.25-r-2, Z=5)
  20. G0(Z=1)
  21. G1(Z=z) -F(ZFEED)
  22. G1(X=25+r, Y=-18.25-r) -F(FEED)
  23. G1(Y=-35.75-r)
  24. G1(X=20+r)
  25. G1(Y=-48.25+r)
  26. G1(X=25+r)
  27. G1(Y=-65.75+r)
  28. G1(X=37.5-r)
  29. G1(Y=-48.25+r)
  30. G1(X=55-r)
  31. G1(Y=-35.75-r)
  32. G1(X=37.5-r)
  33. G1(Y=-18.25-r)
  34. G1(X=25+r)
  35. G1(X=25+r+2, Y=-18.25-r-2)
  36. G0(Z=5)
  37. def dials(z):
  38. G0(X=50, Y=-64)
  39. G0(Z=1)
  40. G1(Z=z) -F(ZFEED)
  41. G0(Z=5)
  42. G0(X=50, Y=-20)
  43. G0(Z=1)
  44. G1(Z=z)
  45. G0(Z=5)
  46. def selectButtons(z):
  47. G0(X=63+r+2, Y=-10.75-r-2, Z=5)
  48. G0(Z=1)
  49. G1(Z=z) -F(ZFEED)
  50. G1(X=63+r, Y=-10.75-r) -F(FEED)
  51. G1(Y=-73.25+r)
  52. G1(X=80.5-r)
  53. G1(Y=-10.75-r)
  54. G1(X=63+r)
  55. G1(X=63+r+2, Y=-10.75-r-2)
  56. G0(Z=5)
  57. def softKeys(z):
  58. G0(X=89+r+2, Y=-18.25-r-2, Z=5)
  59. G0(Z=1)
  60. G1(Z=z) -F(ZFEED)
  61. G1(X=89+r, Y=-18.25-r) -F(FEED)
  62. G1(Y=-35.75-r)
  63. G1(X=84+r)
  64. G1(Y=-48.25+r)
  65. G1(X=89+r)
  66. G1(Y=-65.75+r)
  67. G1(X=101.5-r)
  68. G1(Y=-18.25-r)
  69. G1(X=89+r)
  70. G1(X=89+r+2, Y=-18.25-r-2)
  71. G0(Z=5)
  72. dials(-t)
  73. z=0
  74. while not equal(z, -t):
  75. z = max(-t, z-s)
  76. jogButtons(z)
  77. selectButtons(z)
  78. softKeys(z)