% (Program to mill a helical cam) (K. Lerman) (#1 = CenterX #2 - CenterY) (#3 = ToolDia) (#4 = MinRadius #5 = MaxRadius) (#6 = NumberOfSteps) (#7 = FeedRate) (#8 = Depth) o5300 sub (#10 = current angle degrees) (#11 = 1 if at depth) (#12 = tool radius) (#13 = radius at current angle) (#14 = X #15 = Y) (#16 = current step number) #12 = [#3/2.0] #16 = 0 #11 = 0 o5301 while [#16 LT #6] #10 = [#16 * 360. / #6] #13 = [#5 - [#10/360] * [#5 - #4] + #12] #14 = [[0 - #13 * cos[#10]] + #2] #15 = [[#13 * sin[#10]] + #1] o5302 if [#11 NE 1] #11 = 1 G1 F#7 X#14 Y#15 (Go to point) G1 F[#7/5.0] Z#8 (Plunge to depth) o5302 else G1 F#7 X#14 Y#15 (Mill to point) o5302 endif #16 = [#16 + 1] o5301 endwhile G0 Z.2 (Retract) o5300 endsub ([0,0,0] is at surface in center of cam) (Start above surface with clear path to initial point) (To do multiple passes, lie about the tool diameter first pass) S1M3 o5300 call [0][0][.800][.5][1.0][6000][5.0][-2.220] o5300 call [0][0][.650][.5][1.0][6000][5.0][-2.220] o5300 call [0][0][.530][.5][1.0][6000][5.0][-2.220] o5300 call [0][0][.500][.5][1.0][6000][5.0][-2.220] M5 %