Advertisement
Guest User

Untitled

a guest
Jan 1st, 2014
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.41 KB | None | 0 0
  1. (Vlad's annulus milling subroutine for ngcgui)
  2. (takes a position and a few parameters to mill an annulus)
  3. (tool number and feedrates should be defined prior to calling)
  4.  
  5. (arguments: 1[x center] 2[y center] 3[ID] 4[OD] 5[depth] 6[start of cut height])
  6. ( 7[z safe] [depth of cut per pass] [stepover percent] [feedrate])
  7.  
  8.  
  9. F23
  10.  
  11. #1 = 0
  12. #2 = 0
  13. #3 = .9
  14. #4 = 2
  15. #5 = -.2
  16. #6 = .05
  17. #7 = .1
  18. #8 = 25
  19. #9 = 70
  20. #10 = 24
  21. #11 = [#5410*#9/100]
  22.  
  23. #<x> = #1 (=0)
  24. #<y> = #2 (=0)
  25. #<id> = #3
  26. #<od> = #4
  27. #<z_end> = #5
  28. #<zstart> = #6 (=.05: height to ramp in from, above material sugg)
  29. #<z_safe> = #7 (=.1)
  30. #<doc_p> = #8 (=25 : percent depth per pass)
  31. #<sop> = #9 (=30 : percent stepover)
  32. #<feed> = #10 (=24)
  33. #<finish> = #11 (=[#5410*#<sop>/100] : default to step size)
  34.  
  35. #<tool_diam> = #5410
  36. #<doc> = [#<tool_diam>*#<doc_p>/100]
  37. #<step> = [#<tool_diam>*#<sop>/100]
  38. #<z_curr> = [#<zstart>-#<doc>] (convenient var for Z height)
  39. (if depth can be done in one pass, reset z_curr)
  40. o10 if [#<z_curr> lt #<z_end>]
  41. #<z_curr> = #<z_end>
  42. o10 endif
  43. o20 if [#<tool_diam> eq 0]
  44. (msg, YOU MUST LOAD A NON 0 TOOL PRIOR TO USING ANNULUS)
  45. m2
  46. o20 endif
  47.  
  48. G40
  49. F#<feed> (set feedrate)
  50. G00 Z#<z_safe>
  51. G00 X#<x> Y#<y> (go to center)
  52. G92 X0 Y0 (set temp coordinate around center)
  53. G00 X[#<tool_diam>/2] (prime for simple leadin 3 oclock park)
  54. G41 (cut starts inside, left comp CW cutter and CW 02 arc)
  55.  
  56. #<rad> = [#<id>/2+#<finish>] (convenient dim holder)
  57. (start finish dist from final ID)
  58. (o<passes> sub)
  59. G00 X-#<rad> Z#<zstart> (lower to 9 start pos, also leadin)
  60. G02 I#<rad> Z#<z_curr> P1 (ramp down in and cut circle)
  61. G02 I#<rad> (clean cut)
  62. G02 X0 Y[#<id>/2] I#<rad> J[[#<id>*#<id>/4-#<rad>*#<rad>]/#<id>] (arc into inner surface)
  63. G02 J-[#<id>/2] P1 (clean inner surface)
  64. #<rad>= [#<rad>+#<tool_diam>] (sets rad to uncut wall dim)
  65. G00 X0 Y#<rad> (moves to fresh surface 12)
  66. #<startRad> = #<rad> (save old value to shorten eqs)
  67. #<rad> = [#<rad>+#<step>] (set rad to next pass)
  68.  
  69. o<expandingbulk> while [#<rad> le [[#<od>/2]-#<finish>]] (keep pushing out, evals to final not cur dim)
  70. G03 X-#<rad> Y0 I[[#<rad>*#<rad>-#<startRad>*#<startRad>]/[-2*#<rad>]] J-[#<startRad>] (arc out to 9)
  71. G03 X0 Y#<rad> I#<rad> (3/4 circle to 12)
  72. o<exitexpanding> if [[#<rad>+#<step>] le [[#<od>/2]-#<finish>]] (check if next cut is <=od-finish, if so increment)
  73. #<startRad> = #<rad> (save old value to shorten eqs)
  74. #<rad> = [#<rad>+#<step>] (keeps change nested but avoids extra final)
  75. o<exitexpanding> endif
  76. o<expandingbulk> endwhile
  77. G03 X-#<rad> Y0 J-#<rad> (finsh last cut)
  78.  
  79. #<rad> = [#<od>/2]
  80. G03 X-#<rad> Y0 I[[#<rad>*#<rad>-#<startRad>*#<startRad>]/[-2*#<rad>]] J-[#<startRad>] (arc out to 9 final dim)
  81. G03 X0 Y#<rad> I#<rad> (3/4 circle to 12)
  82. G03 X-#<rad> Y0 J-#<rad> (finsh last cut)
  83.  
  84. (o<passes> endsub)
  85.  
  86. #<zstart> = #<z_curr>
  87. #<z_curr> = [#<z_curr>-#<doc>]
  88.  
  89. G00 Z#<z_safe>
  90. G00 X#<x> Y#<y>
  91. G92.1 G40
  92.  
  93. m2
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement