View Single Post
  #2   Report Post  
Posted to rec.crafts.metalworking
Ignoramus3931 Ignoramus3931 is offline
external usenet poster
 
Posts: 4
Default VIDEO of cutting a thread on 4th axis of my Bridgeport InteractCNC mill with LinuxCNC

On 2013-03-22, Ignoramus3931 wrote:
My guy asked me to cut a 1mm pitch thread on a custom shaft.

I could not do it on my lathe, so I finally bit the bullet and wrote a
subroutine to do threading with my 4th axis rotary table. I use a 60
degree chamfering end mill.

Now I can cut any thread, any pitch, right or left handed, and if the
thread is very coarse, the subroutine does it in several passes.

http://www.youtube.com/watch?v=JMENnIJrl9Y

I am afraid that it does not create a 100% correct thread geometry,
but I hope that I can do enough things with it to be useful with some
adjustments to diameter.

i


And here's the subroutine, released under GPL v3


(Makes a thread on a round part rotated in my fourth axis)
(Uses a 60 degree end mill)

Othread_on_fourth_axis sub
#x0 = #1 (X0, left side)
#x1 = #2 (X1, right side)
#y = #3 (Y, middle of the top edge of the round)
#z0 = #4 (Z, top of the edge of the round)
#safez = #5 (Safe Z for rapids)
#zstep = #6 (Z Step, positive)
#spr = #7 (Step Per Revolution, Also determines Total Depth)
#depth = #8 (Depth of thread, positive, determined automatically if 0 based on 60 degree thread.)
#diameter = #9 (Diameter of the round, needed for calculations of feed rate)
#frate = #10 (feed rate based on surface speed)
#left_handed = #11 (Set to 1 if left handed)

#rpm = [#frate/3.1415/#diameter]
#horizontal_feedrate = [#rpm*#spr]
#vertical_feedrate = [#frate/5]
#total_angle = [ 360 * [#x1-#x0]/#spr ]

(Set negative total angle if left handed thread)
Oif if [#left_handed NE 0]
#total_angle = [-#total_angle]
Oif endif

Oif if [#depth EQ 0]
;#depth = [#spr*1.73205/2] (depth = spr * sqrt 3 / 2 )

; http://upload.wikimedia.org/wikipedi...-p21--v001.png
#depth = [#spr*0.64952] (depth = spr * sqrt 3 / 2 )
Oif endif

Owithdraw call [#safez]
G0 A0 (go to 0 degree)

G0 X[#x0] Y[#y] Z[#safez]

( Start drilling down to Z0, I could rapid, )
( but slow is safer, will not break end mill )
G1 Z[#z0] F[#vertical_feedrate]

#direction = 1 (1 is right, 2 is left)

#z = #z0

Oloop while [ 1 ]
#z = [#z - #zstep]
Oif if [#z LT [#z0 - #depth] ]
#z = [#z0 - #depth]
Oif endif

G1 Z[#z] F[#vertical_feedrate]

(Depending on direction, we go to X1 on the right and turn total_angle,)
(or go to X0 on the left and go back to ZERO angle)

Oif if [#direction EQ 1 ]
#direction = 0
G1 X[#x1] A[#total_angle] F[#horizontal_feedrate]
Oif else
#direction = 1
G1 X[#x0] A0 F[#horizontal_feedrate]
Oif endif

Oif if [ #z LE [#z0 - #depth] ]
Oloop break
Oif endif


Oloop endwhile

Owithdraw call [#safez]
G0 X[#x1]

G0 A0 (go to 0 degree)

Othread_on_fourth_axis endsub

M2