Advertisement
Guest User

Untitled

a guest
Jan 1st, 2014
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.36 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 = 20
  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. #<finish> = [#<tool_diam>*#<finish>/100]
  40. (if depth can be done in one pass, reset z_curr)
  41. o10 if [#<z_curr> lt #<z_end>]
  42. #<z_curr> = #<z_end>
  43. o10 endif
  44. o20 if [#<tool_diam> eq 0]
  45. (msg, YOU MUST LOAD A NON 0 TOOL PRIOR TO USING ANNULUS)
  46. m2
  47. o20 endif
  48.  
  49. G40
  50. F#<feed> (set feedrate)
  51. G00 Z#<z_safe>
  52. G00 X#<x> Y#<y> (go to center)
  53. G92 X0 Y0 (set temp coordinate around center)
  54. G00 X[#<tool_diam>/2] (prime for simple leadin 3 oclock park)
  55. G41 (cut starts inside, left comp CW cutter and CW 02 arc)
  56.  
  57. #<rad> = [#<id>/2+#<finish>] (convenient dim holder)
  58. (start finish dist from final ID)
  59. G00 X-#<rad> Z#<zstart> (lower to 9 start pos, also leadin)
  60.  
  61. o<passes> while [#<z_curr> gt #<z_end>] (if not too deep)
  62. G02 I#<rad> Z#<z_curr> P1 (ramp down in and cut circle)
  63. G02 I#<rad> (clean cut)
  64. G02 X0 Y[#<id>/2] I#<rad> J[[#<id>*#<id>/4-#<rad>*#<rad>]/#<id>] (arc into inner surface)
  65. G02 J-[#<id>/2] P1 (clean inner surface)
  66. #<rad>= [#<rad>+#<tool_diam>] (sets rad to uncut wall dim)
  67. G00 X0 Y#<rad> (moves to fresh surface 12)
  68. #<startRad> = #<rad> (save old value to shorten eqs)
  69. #<rad> = [#<rad>+#<step>] (set rad to next pass)
  70.  
  71. o<expandingbulk> while [#<rad> le [[#<od>/2]-#<finish>]] (keep pushing out, evals to final not cur dim)
  72. G03 X-#<rad> Y0 I[[#<rad>*#<rad>-#<startRad>*#<startRad>]/[-2*#<rad>]] J-[#<startRad>] (arc out to 9)
  73. G03 X0 Y#<rad> I#<rad> (3/4 circle to 12)
  74. o<exitexpanding> if [[#<rad>+#<step>] lt [[#<od>/2]-#<finish>]] (check if next cut is <=od-finish, if so increment)
  75. #<startRad> = #<rad> (save old value to shorten eqs)
  76. #<rad> = [#<rad>+#<step>] (keeps change nested but avoids extra final)
  77. o<exitexpanding> elseif [#<rad> eq [[#<od>/2]-#<finish>]] (last rough was done, finish him!)
  78. #<startRad> = #<rad> (save it)
  79. #<rad> = [[#<od>/2]] (set to final value)
  80. G03 X-#<rad> Y0 I[[#<rad>*#<rad>-#<startRad>*#<startRad>]/[-2*#<rad>]] J-[#<startRad>] (arc out to 9)
  81. G03 X0 Y#<rad> I#<rad> (3/4 circle to 12)
  82. G03 X0 Y-#<rad> J-#<rad> (finish cut)
  83. o<exitexpanding> else (next cut would have landed in finish region, so snap to)
  84. #<startRad> = #<rad> (save it)
  85. #<rad> = [[#<od>/2]-#<finish>] (set to final rough value)
  86. o<exitexpanding> endif
  87. o<expandingbulk> endwhile
  88.  
  89. #<rad> = [#<id>/2+#<finish>] (reset goal rad)
  90. G00 X-#<rad> Y0 (go to inner start pos)
  91. o<zcontrol> if [[#<z_curr>-#<doc>] gt #<z_end>] (if next cut makes sense but wont finish)
  92. #<z_curr> = [#<z_curr>-#<doc>]
  93. o<zcontrol> ifelse [#<z_curr> eq #<z_end>] (if this cut just finished)
  94. #<z_curr> = [#<z_end>-1] (set excessive to quit)
  95. o<zcontrol> ifelse [[#<z_curr>-#<doc>] le #<z_end>] (if next cut finishes or is excessive, force finish)
  96. #<z_curr> = #<z_end>
  97. o<zcontrol> endif
  98. o<passes> endwhile
  99.  
  100. G00 Z#<z_safe>
  101. G00 X#<x> Y#<y>
  102. G92.1 G40
  103.  
  104. m2
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement