Guest User

Tool_get_move.ngc

a guest
Nov 19th, 2026
20
0
27 days
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.38 KB | None | 0 0
  1. ; parameter: last_slot
  2. o<tool_get_move> sub
  3. ; (MSG, Tool_get_move started)
  4. o100 if [#1 EQ 0]
  5. G04 P0.5
  6.  
  7. o100 elseif [#1 GE 1 AND #1 LE 7] (take the tool from one of tool slots)
  8.  
  9. M66 P02 L3 Q3 (check if spindle is in top position)
  10. o1001 if [#5399 EQ -1]
  11. (MSG, Spindle is not lifted up, will try to do that)
  12. M64 P00 (raise spindle up in top position)
  13. M64 P03
  14. G04 P0.5
  15. M65 P00
  16. M65 P03
  17. M66 P00 L3 Q3 (check if spindle is in top position)
  18. o10011 if [#5399 EQ -1]
  19. (MSG, Spindle is not lifted up, cycle paused)
  20. M0
  21. o10011 endif
  22. o1001 else
  23. G04 P0.1
  24. o1001 endif
  25.  
  26. M66 P18 L0 (make sure spindle is empty)
  27.  
  28. o101 if [#5399 EQ 1]
  29. (MSG, There is a tool in spindle, cycle paused)
  30. M0
  31. o101 else
  32. G04 P0.1
  33. o101 endif
  34.  
  35. ;o110 if [#1 EQ 1]
  36. ; G53 G0 C205.7 (move carousel slot under tool presence sensor)
  37. ;o110 elseif [#1 EQ 2]
  38. ; G53 G0 C154.1
  39. ;o110 elseif [#1 EQ 3]
  40. ; G53 G0 C102.7
  41. ;o110 elseif [#1 EQ 4]
  42. ; G53 G0 C51.5
  43. ;o110 elseif [#1 EQ 5]
  44. ; G53 G0 C-0.7
  45. ;o110 elseif [#1 EQ 6]
  46. ; G53 G0 C308.3
  47. ;o110 elseif [#1 EQ 7]
  48. ; G53 G0 C256.9
  49. ;o110 endif
  50.  
  51. ; M66 P06 L3 Q1 (check if carousel slot is empty)
  52.  
  53. ;o111 if [#5399 NE 1]
  54. ; (DEBUG, Tool slot is empty, cycle paused)
  55. ; M0
  56. ;o111 else
  57. ; G04 P0.5
  58. ;o111 endif
  59.  
  60. o120 if [#1 EQ 1]
  61. G53 G0 C264.810 (move carousel slot to match the spindle)
  62. o120 elseif [#1 EQ 2]
  63. G53 G0 C213.394
  64. o120 elseif [#1 EQ 3]
  65. G53 G0 C162.407
  66. o120 elseif [#1 EQ 4]
  67. G53 G0 C110.910
  68. o120 elseif [#1 EQ 5]
  69. G53 G0 C59.390
  70. o120 elseif [#1 EQ 6]
  71. G53 G0 C7.852
  72. o120 elseif [#1 EQ 7]
  73. G53 G0 C316.352
  74. o120 endif
  75.  
  76. M66 P04 L3 Q2 (check if carousel is in)
  77. o121 if [#5399 EQ -1]
  78. (MSG, Carousel is not in, will try to do that)
  79. M64 P05 (move carousel in)
  80. G04 P0.5
  81. M65 P05
  82. M66 P04 L3 Q2 (check if carousel is in)
  83. o1211 if [#5399 EQ -1]
  84. (DEBUG, Carousel is not in position for spindle to take the tool, cycle paused)
  85. M0
  86. o1211 else
  87. G04 P0.5
  88. o1211 endif
  89. o121 else
  90. G04 P0.5
  91. o121 endif
  92.  
  93. M64 P10 (release the spindle so that it can take the tool)
  94. G04 P0.5
  95. M65 P10
  96. G04 P0.2
  97.  
  98. M66 P16 L3 Q1 (check if spindle is released)
  99. o122 if [#5399 EQ -1]
  100. (DEBUG, Tool is not released, cycle paused)
  101. M0
  102. o122 else
  103. G04 P0.1
  104. o122 endif
  105.  
  106. M64 P04 (lower spindle to middle position)
  107. G04 P0.5
  108. M65 P04
  109.  
  110. M66 P00 L3 Q3 (check if spindle is in middle position)
  111. o123 if [#5399 EQ -1]
  112. (MSG, Spindle is not in middle position, cycle paused)
  113. M0
  114. o123 else
  115. G04 P0.4
  116. o123 endif
  117.  
  118. M64 P11 (lock the tool in spindle)
  119. G04 P0.5
  120. M65 P11
  121.  
  122. M66 P18 L3 Q1 (check if there is tool in spindle)
  123. o124 if [#5399 EQ -1]
  124. (MSG, There is no tool in spindle, cycle paused)
  125. M0
  126. o124 else
  127. G04 P0.1
  128. o124 endif
  129. M64 P06 (move carousel out)
  130. G04 P0.5
  131. M65 P06
  132.  
  133. M66 P05 L3 Q3 (check if carousel is out and does not interfere with spindle)
  134. o125 if [#5399 NE 1]
  135. (MSG, Carousel is not out, will try to do that)
  136. M64 P06 (move carousel out)
  137. G04 P0.5
  138. M65 P06
  139. M66 P05 L3 Q4 (check if carousel is out and does not interfere with spindle)
  140. o1251 if [#5399 EQ -1]
  141. (MSG, Carousel is not out, cycle paused)
  142. M0
  143. o1251 endif
  144. o125 else
  145. G04 P0.1
  146. o125 endif
  147.  
  148. M64 P03 (lower the chip guard)
  149. G04 P0.5
  150. M65 P03
  151.  
  152. G04 P0.2
  153.  
  154. M64 P01 (lower spindle down to working position)
  155. M64 P04
  156. G04 P0.5
  157. M65 P01
  158. M65 P04
  159.  
  160.  
  161. o100 elseif [#1 GE 51 AND #1 LE 84] (use one of the drills)
  162.  
  163. M66 P00 L0 (check if spindle is in middle)
  164. o1002 if [#5399 NE 1]
  165. (MSG, Spindle is not lifted up, will try to do that)
  166. M64 P00 (raise spindle up)
  167. G04 P0.5
  168. M65 P00
  169. M66 P02 L3 Q3 (make sure that spindle is middle)
  170. o10021 if [#5399 EQ -1]
  171. (MSG, Spindle is not lifted up, cycle paused)
  172. M0
  173. o10021 endif
  174. o1002 else
  175. G04 P0.1
  176. o1002 endif
  177.  
  178.  
  179. M64 P[#1 - 30]
  180. M64 P55
  181.  
  182.  
  183.  
  184.  
  185. o100 else (manually insert tool in spindle)
  186.  
  187. M66 P01 L0 (check if spindle is down)
  188. o1004 if [#5399 NE 1]
  189. (MSG, Spindle is not down, will try to do that)
  190. M64 P01 (lower the spindle)
  191. G04 P0.5
  192. M65 P01
  193. M66 P01 L3 Q10 (make sure that cover is closed)
  194. o10041 if [#5399 EQ -1]
  195. (MSG, Spindle1 is not down!!!)
  196. M0
  197. o10041 endif
  198. o1004 else
  199. G04 P0.1
  200. o1004 endif
  201.  
  202.  
  203. G53 G0 Z95
  204. G53 G0 Y250
  205. (MSG, Insert tool #1 in spindle)
  206. M0
  207. o100 endif
  208. o<tool_get_move> endsub
  209.  
  210. m2
  211.  
Add Comment
Please, Sign In to add comment