Advertisement
Guest User

Oval slot milling func

a guest
Aug 21st, 2012
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.38 KB | None | 0 0
  1.  
  2.  
  3. o105 sub
  4. (makes torpedo oval slot from X1,Y1 to X2,Y2)
  5. (parameters)
  6. (#1 = X1)
  7. (#2 = Y1)
  8. (#3 = X2)
  9. (#4 = Y2)
  10.  
  11. (#5 = slot width)
  12.  
  13. (#6 = start depth)
  14. (#7 = end depth)
  15. (#8 = depth of cut)
  16.  
  17. (globals used)
  18. (#33 = tool diameter - until this is adapted for proper g41 TC)
  19. (#35 = safety height)
  20.  
  21.  
  22. #10 = [#3-#1] (x2-x1)
  23. #11 = [#4-#2] (y2-y1)
  24.  
  25. (normalise vector)
  26. #12 = SQRT[[#10*#10]+[#11*#11]]
  27. #10 = [#10/#12]
  28. #11 = [#11/#12]
  29.  
  30. (scale vector to slot width)
  31. #13 = [[#5 - #33]/2] (slot radius - tool radius)
  32. #10 = [#10*#13]
  33. #11 = [#11*#13]
  34.  
  35. g17 (set XY plane for arcs)
  36. g40 (turn off TC for now - TODO fix for g41)
  37.  
  38. (start at X1,Y1 + right vector {yd,-xd})
  39. g0 X[#1+#11] Y[#2-#10] Z#35
  40.  
  41. #20 = #6 (current depth)
  42.  
  43. o115 while [#20 gt #7]
  44.  
  45. g2 x[#1-#11] y[#2+#10] i[0-#11] j[0+#10] z#20
  46. g1 x[#3-#11] y[#4+#10]
  47. g2 x[#3+#11] y[#4-#10] i[0+#11] j[0-#10]
  48. g1 x[#1+#11] y[#2-#10]
  49.  
  50. #20 = [#20 - #8]
  51.  
  52. o115 endwhile
  53.  
  54. (last circuit at end depth)
  55. g2 x[#1-#11] y[#2+#10] i[0-#11] j[0+#10] z#7
  56. g1 x[#3-#11] y[#4+#10]
  57. g2 x[#3+#11] y[#4-#10] i[0+#11] j[0-#10]
  58. g1 x[#1+#11] y[#2-#10]
  59. g2 x[#1-#11] y[#2+#10] i[0-#11] j[0+#10]
  60.  
  61. g0 x#1 y#2 (move clear for extraction)
  62. g0 z#35 (extract to safety height)
  63.  
  64. o105 endsub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement