All pastes #732579 Raw Edit

thread_mill

public text v1 · immutable
#732579 ·published 2007-10-11 02:54 UTC
rendered paste body
o300 sub
  (o300 call 	[1 x pos] [2 y pos] [3 safety height] [4 top] [5 depth] ) 
  (		[6 tool diam] [7 minor diam] [8 thead depth] [9 turns per unit length] ) 
  (		[10 start angle] [11 right/left thread] )
  (		[12 helical infeed / radial infeed] )

#15 = [#7/2+#8-#6/2]	(distance from center to cut depth of thread)
#16 = [#1+COS[#10]*#15]	(set x start)
#17 = [#2+SIN[#10]*#15]	(set y start)
#18 = [1/#9] 		(depth per revolution)
#19 = [#4-#18]		(reset depth stop)

g0 z#3			(rapid to saftey height)
g0 x#1y#2 		(rapid to center)

g1 z#4 		
g1 x#16y#17

o301 while [#19 gt [#4-#5]]
	o302 if [#11 eq 1]
		g3 x#16 y#17 i[#1-#16] j[#2-#17] z#19
	o302 else
		g2 x#16 y#17 i[#1-#16] j[#2-#17] z#19
	o302 endif

	#19 = [#19-#18]

	o303 if [#19 lt [#4-#5]]
		#20 = [#5*#9*360-#10]
		#21 = [#1+COS[#20]*#15]
		#22 = [#2+SIN[#20]*#15]
		#19 = [#4-#5]

		o304 if [#11 eq 1]
			g3 x#21 y#22 i[#1-#16] j[#2-#17] z#19
		o304 else
			g2 x#21 y#22 i[#1-#16] j[#2-#17] z#19
		o304 endif

	o303 endif

o301 endwhile

g0 x#1y#2
g0 z#3

o300 endsub

(1.25" diameter hole centered on 1.5,1)
(0.5" diameter tool saftey height of 2.25")
(Right hand 18 pitch screw with 0.01" deep thread 3" long)
(Thread starts 45 degrees clockwise from the 12:00 position)

F30
o300 call [0] [0] [.5] [0] [.27] [0.5] [1.25] [0.01] [18] [45] [1]

m30