face_lathe3

More
04 Sep 2013 14:49 #38461 by Rick G
face_lathe3 was created by Rick G
Here is a facing sub for the lathe that allows you to select the start and finish diameter of the facing as well as the start and finish depth.
For simple lathe without tool offsets, tool change, etc.
;face_lathe3 for lathe
;face cut for lathe from Start Diameter to Finish Diameter 

;UNTESTED concept only, edit and test for your own use before using

;Before running make sure tool is in a position that it can safely travel to Z start then X Start Diam.

o<face_lathe3>sub
     #<Start_Diam> =    #1 (=1.00 Large Diameter)
     #<Finish_Diam> =   #2 (=0.625 Small Diameter)
     #<Max_Cut> =       #3 (=0.005 Max Depth of Cut)
     #<Start_z> =       #4 (=0.00 Z Start of Cut)
     #<End_z> =         #5 (=-0.025 Z End of Cut)
     #<Feed> =          #6 (=4 Feed IPM)
     #<RPM> =           #7 (=500 RPM)
     #<Final_Cut> =     #8 (=.002 Final Cut)
     #<Fin_ Feed> = 	  	#9 (=2 Final cut speed IPM)
     #<Spring_Cuts> =   #10 (=1 Spring Cuts)
     
#<Z_Len> = [ #<Start_z> - [#<End_z> + #<Final_Cut>]] ; calculate total Z depth 
#<Cuts> = FUP [[#<Z_Len> /  #<Max_Cut>]] ; round up the number of passes to reach total Z depth
#<Z_Cut> = [#<Z_Len> / #<Cuts>] ; depth of each Z cut

G18 (xz plane)
G20 (inches)
G40 (cancel cutter radius compensation)
G49 (cancel tool length offset)
G90 (absolute distance mode)
G94 (units/min feed rate)
G7  (diameter mode)
G64 p.001 q.001 (set path tolerance)

; if Z End of Cut is greater than Z Start of Cut do not run
o201 if [#<End_z> gt #<Start_z>]
(debug, Z End of Cut #<End_z># greater than  Z Start of Cut #<Start_z>)
o200 return
o201 endif

F#<Feed>
S#<RPM>
M3 ; spindle on cw
G4 P1 ; pause for spindle to reach RPM
G0 Z[#<Start_z> + .010]
G0 X #<Start_Diam>
G1 Z#<Start_z>

#<Z_Target> = #<Start_z> 

o100 while [#<Cuts> gt 0]
	#<Z_Target> = [#<Z_Target> - #<Z_Cut>]
	G0 X #<Start_Diam>  ; X to cut position
	G0 Z [#<Z_Target> + .010]
	G1 Z #<Z_Target>
	G1 X #<Finish_Diam> ; Cut face 
 G0 Z [#<Z_Target> + .010]
		#<Cuts> = [#<Cuts> - 1]
o100 endwhile

; finish cut 
F#<Fin_ Feed>
G0 X #<Start_Diam>  ; X to cut position
G0 Z [#<End_z> + .010]
G1 Z #<End_z>
G1 X #<Finish_Diam> ; Cut face
G0 Z [#<Z_Target> + .010]

;Spring cuts
o102 while [#<Spring_Cuts> gt 0]
	G0 X #<Start_Diam>  ; X to cut position
	G0 Z [#<End_z> + .010]
	G1 Z #<End_z>
	G1 X #<Finish_Diam> ; Cut face
 G0 Z [#<Z_Target> + .010]
 #<Spring_Cuts> = [#<Spring_Cuts> -1]
o102 endwhile

M5 ;stop spindle
G0  X#<Start_Diam> Z #<Start_z>

o<face_lathe3>endsub

Rick G

Please Log in or Create an account to join the conversation.

More
04 Sep 2013 21:27 #38469 by andypugh
Replied by andypugh on topic face_lathe3

Here is a facing sub for the lathe that allows you to select the start and finish diameter


My subs (with pretty GUI) include a taper angle for turning, boring and facing too:
www.linuxcnc.org/index.php/english/forum...s/26550-lathe-macros

Less convenient to call from MDI though, so they would need editing for that usage model.

Please Log in or Create an account to join the conversation.

Time to create page: 0.060 seconds
Powered by Kunena Forum