Guest User

Untitled

a guest
May 19th, 2015
291
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.79 KB | None | 0 0
  1.  
  2. o<toolchange> sub
  3.  
  4. M19 R0 ;align the spindle
  5.  
  6. ; only unload the tool if there is a tool in the spindle
  7. ; This assumes that the carousel is already aligned correctly.
  8. ; It is important to unload the tool before shutting down the machine.
  9.  
  10. O100 IF [#<tool_in_spindle> GT 0]
  11. G53 G0 Z -100
  12.  
  13. M64 P2 ; move arm in
  14. M66 P2 L3 Q5 ; wait for arm-in = true
  15. O104 if [#5399 LT 0]
  16. (abort, failed to move arm in)
  17. O104 endif
  18.  
  19. M64 P3 ; release tool
  20. M66 P3 L3 Q2 ; wait for tool-released = true
  21. O105 if [#5399 LT 0]
  22. (abort, failed to release tool)
  23. O105 endif
  24.  
  25. O100 ENDIF
  26.  
  27. G53 G0 Z0
  28.  
  29. O200 IF [#<selected_tool> GT 0]
  30.  
  31. M65 P1 ; unlock carousel
  32. M66 P1 L4 Q1 ; wait for locked=false
  33. O106 if [#5399 LT 0]
  34. (abort, failed to unlock carousel)
  35. O106 endif
  36.  
  37. M68 E0 Q#<selected_pocket> ;set the carousel to move to the right pocket
  38.  
  39. M64 P0 ; start carousel
  40. G4 P2
  41. M66 P0 L3 Q60 ; wait for carousel finished
  42. O107 if [#5399 LT 0]
  43. (abort, failed to align carousel)
  44. O107 endif
  45. M65 P0; stop carousel
  46. M64 P1 ; lock carousel
  47. M66 P1 L3 Q1 ; wait for locked=true
  48. O108 if [#5399 LT 0]
  49. (abort, failed to lock carousel)
  50. O108 endif
  51.  
  52. M64 P2 ; move arm in (might already be in)
  53. M66 P2 L3 Q5 ; wait for arm-in = true
  54. O109 if [#5399 LT 0]
  55. (abort, failed to move arm in)
  56. O109 endif
  57.  
  58. G53 G0 Z-100 ; pick up the tool
  59.  
  60. O200 ENDIF
  61.  
  62. M65 P3 ; clamp tool
  63. M66 P3 L4 Q2 ; wait for tool-released = false
  64. O110 if [#5399 LT 0]
  65. (abort, failed to clamp tool)
  66. O110 endif
  67.  
  68. M65 P2 ; move arm back out
  69. M66 P4 L3 Q5 ; wait for arm-out = true
  70. O111 if [#5399 LT 0]
  71. (abort, failed to move arm in)
  72. O111 endif
  73.  
  74.  
  75. o<toolchange> endsub [1]
  76.  
  77.  
  78. M2
Advertisement
Add Comment
Please, Sign In to add comment