Not a member of Pastebin yet?
                        Sign Up,
                        it unlocks many cool features!                    
                - (120mm wooden faceplate for 4th axis)
 - o103 sub
 - (bores hole clockwise)
 - (parameters)
 - (#1 = X position)
 - (#2 = Y position)
 - (#3 = bore diameter)
 - (#4 = start depth)
 - (#5 = end depth)
 - (#6 = depth per turn)
 - (globals used)
 - (#33 = tool diameter)
 - (#35 = safety height)
 - #10 = [[#3-#33]/2] (effective radius = bore radius - tool radius)
 - g17 (set XY plane for arcs)
 - g0 z#33
 - g0 x#1 y[#2+#10]
 - #11 = #4
 - o113 while [#11 GT #5]
 - (down toward the specified depth a bit at a time)
 - g2 x#1 y[#2 + #10] i0 j[0 - #10] z#11
 - #11=[#11 - #6]
 - o113 endwhile
 - (down to the actual depth)
 - g2 x#1 y[#2 + #10] i0 j[0 - #10] z#5
 - (full circle at the actual depth)
 - g2 x#1 y[#2 + #10] i0 j[0 - #10]
 - g0 x#1 y#2
 - g0 z#35
 - o103 endsub
 - o104 sub
 - (mills outside circle)
 - (parameters)
 - (#1 = X position)
 - (#2 = Y position)
 - (#3 = outside diameter)
 - (#4 = start depth)
 - (#5 = end depth)
 - (#6 = depth per turn)
 - (globals used)
 - (#33 = tool diameter)
 - (#35 = safety height)
 - #10 = [[#3+#33]/2] (effective radius = radius + tool radius)
 - g17 (set XY plane for arcs)
 - g0 z#33
 - g0 x#1 y[#2+#10]
 - #11 = #4
 - o114 while [#11 GT #5]
 - (down toward the specified depth a bit at a time)
 - g3 x#1 y[#2 + #10] i0 j[0 - #10] z#11
 - #11=[#11 - #6]
 - o114 endwhile
 - (down to the actual depth)
 - g3 x#1 y[#2 + #10] i0 j[0 - #10] z#5
 - (full circle at the actual depth)
 - g3 x#1 y[#2 + #10] i0 j[0 - #10]
 - g0 z#35
 - o104 endsub
 - o105 sub
 - (makes torpedo oval slot from X1,Y1 to X2,Y2)
 - (parameters)
 - (#1 = X1)
 - (#2 = Y1)
 - (#3 = X2)
 - (#4 = Y2)
 - (#5 = slot width)
 - (#6 = start depth)
 - (#7 = end depth)
 - (#8 = depth of cut)
 - (globals used)
 - (#33 = tool diameter - until this is adapted for proper g41 TC)
 - (#35 = safety height)
 - #10 = [#3-#1] (x2-x1)
 - #11 = [#4-#2] (y2-y1)
 - (normalise vector)
 - #12 = SQRT[[#10*#10]+[#11*#11]]
 - #10 = [#10/#12]
 - #11 = [#11/#12]
 - (scale vector to slot width)
 - #13 = [[#5 - #33]/2] (slot radius - tool radius)
 - #10 = [#10*#13]
 - #11 = [#11*#13]
 - g17 (set XY plane for arcs)
 - g40 (turn off TC for now - TODO fix for g41)
 - (start at X1,Y1 + right vector {yd,-xd})
 - g0 X[#1+#11] Y[#2-#10] Z#35
 - #20 = #6 (current depth)
 - o115 while [#20 gt #7]
 - g2 x[#1-#11] y[#2+#10] i[0-#11] j[0+#10] z#20
 - g1 x[#3-#11] y[#4+#10]
 - g2 x[#3+#11] y[#4-#10] i[0+#11] j[0-#10]
 - g1 x[#1+#11] y[#2-#10]
 - #20 = [#20 - #8]
 - o115 endwhile
 - (last circuit at end depth)
 - g2 x[#1-#11] y[#2+#10] i[0-#11] j[0+#10] z#7
 - g1 x[#3-#11] y[#4+#10]
 - g2 x[#3+#11] y[#4-#10] i[0+#11] j[0-#10]
 - g1 x[#1+#11] y[#2-#10]
 - g2 x[#1-#11] y[#2+#10] i[0-#11] j[0+#10]
 - g0 x#1 y#2 (move clear for extraction)
 - g0 z#35 (extract to safety height)
 - o105 endsub
 - (main program)
 - (set globals)
 - #33 = 3.0 (set tool diameter)
 - #35 = 2.0 (set safety height)
 - g21 g40 (set metric, TC off)
 - f1000
 - (bore center hole)
 - o103 call [0] [0] [8] [0] [-18] [0.5]
 - (outside radius)
 - o104 call [0] [0] [120] [0] [-18] [0.5]
 - (cut 12 radial slots)
 - #10 = 25 (inner radius)
 - #11 = 45 (outer radius)
 - #12 = 0 (angle of first slot)
 - o200 while [#12 LT 359.9]
 - #13 = SIN[#12]
 - #14 = COS[#12]
 - o105 call [#10*#13] [#10*#14] [#11*#13] [#11*#14] [6.0] [0] [-18] [1.0]
 - #12 = [#12+30.0]
 - o200 endwhile
 - m30 (end program)
 
Advertisement
 
                    Add Comment                
                
                        Please, Sign In to add comment