G76 for Internal Threads

More
03 May 2020 19:49 #166530 by currinh
I need to hand code a G76 command for internal threads. I've come up with two questions.

1. For the compound setting, should one use Q = -29.5 deg? This will provide cutting on the front of the tool, as Q=29.5 does when cutting an outside thread. I can't find the answer online.

2. When cutting threads on a manual lathe, feeding the compound in will move the tool in the -Z direction as well as -X (external thread). This should be accounted for when threading to a shoulder. For G76 the Z value is to be the final position of the tool. Using a Q (i.e. = -29.5 for internal or +29.5 external) will LinuxCNC account for this compound motion in the Z and move to the asked for final Z position, or overshoot it? Can't find this answer either, and easier to ask than run into the shoulder.

Thank you for your help.

Hugh

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

More
06 May 2020 12:06 #166866 by andypugh
Replied by andypugh on topic G76 for Internal Threads
Here is my threading subroutine, which has examples of both:
O<threading> sub

G7 ; Lathe Diameter Mode
G18 ; XZ Plane
G21 ; Metric Units
G90 ; Absolute Distance


M6 T#3 G43

#14 = [#<_x> * 2] (starting X)
#13 = #<_z> (starting Z)

G96 D1500 S#2 ; Constant Surface Speed Mode
M3
g95 F0.1 ; Feed-Per-Rev Mode

g4p1 ; Wait to reach speed

;Threading
        O51 IF [#6 GT 0.5]
		#<OD> = [#1]
		#<ID> = [#1 - 1.3 * #4]
		;g1X [#<ID> - 1] ;thread truncation
		;g0 Z #13
		;g1 X #<ID>
		;g1 Z #5
		G0 X[#<ID> - 1]
		g0 Z #13
		#3 = [#4 * 1.3]
        (debug, INTERNAL Threading thread dia-#1 start-#13 finish-#5 Pitch-#4 Depth-#3)
		g1X [#<ID> - 1]
 		g76 p#4 z#5 i1 j0.2 k#3 h3 r1.5 q29.5 e0 l0
		
        O51 ELSE
		#<OD> = [#1 - 0.108 * #4]
		#<ID> = [#1 - 1.0825 * #4]
		(debug, EXTERNAL Threading OD = #<OD> ID = #<ID>)
		#3 = [#4 * 1.0825]
		g1X [#<OD> + 1] ;final thread truncation
		g0 z#13
		g1 X #<OD>
		g1 Z #5
		G0 X[#<OD> +1]
		G0 Z #13
 		g76 p#4 z#5 i-1 j0.2 k#3 h3 r1.5 q29.5 e0 l0
		
        O51 ENDIF
	G0 Z #13
	m5
O<threading> endsub

M2

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

More
06 May 2020 18:41 #166880 by currinh
Replied by currinh on topic G76 for Internal Threads
Andy:

Thank you for the reply. I think it, and more study of the documentation, has answered my questions. I think your code is starting with #1 as the theoretical diameter, 1/8*P, larger than the major diameter? Would depend on the tool and diameter of the blank but why did you choose this?

I haven't used subroutines in G-code so found this interesting. Thus a few questions on the code itself. Why did you pass the six parameters in the call but not <_x> and <_z>? I couldn't find a need for the moves I commented out. Are they needed? If so what is the purpose? Finally, is the ending M2 needed? Good practice?

o<threading> sub
# +-----------------------------------------------------------------------------+
# | o<threading> call [1][2][3][4][5][6]
# |
# | PASSED PARAMETERS
# |   #1   = "major" diam of thread (measured at theoretical sharp peaks
# |   #2   = surface speed S  (G20 -> ft/min  or  G21 -> m/min)
# |   #3   = tool number 
# |   #4   = thread pitch 
# |   #5   = final Z position, end of threading
# |   #6   = external thread (=0)  internal (=1)
# | GLOBAL PARAMETERS
# |   <_x> = starting X radius
# |   <_z> = starting Z
# |
# | NOTE: uses metric units
# +-----------------------------------------------------------------------------+

G7 ; Lathe Diameter Mode
G18 ; XZ Plane
G21 ; Metric Units
G90 ; Absolute Distance

M6 T#3 G43

#14 = [#<_x> * 2] (starting X)
#13 = #<_z> (starting Z)

G96 D1500 S#2 ; Constant Surface Speed Mode
M3
g95 F0.1 ; Feed-Per-Rev Mode

g4p1 ; Wait to reach speed

;Threading
        O51 IF [#6 GT 0.5]
		#<OD> = [#1]                                  ; major diam
		#<ID> = [#1 - 1.3 * #4]                    ; OD - 3/4*P/tan(30)
		G0 X[#<ID> - 1]                              ; 1mm inside initial cut
		g0 Z #13                                         ; Z start point
		#3 = [#4 * 1.3]	                               ; cut depth, diam (re-use #3)
        (debug, INTERNAL Threading thread dia-#1 start-#13 finish-#5 Pitch-#4 Depth-#3)
		g1X [#<ID> - 1]                               ; drive line 1mm inside cut
 		g76 p#4 z#5 i1 j0.2 k#3 h3 r1.5 q29.5 e0 l0
		
        O51 ELSE
		#<OD> = [#1 - 0.108 * #4]               ; OD = major - 1/8*P/tan(30)
		#<ID> = [#1 - 1.0825 * #4]               ; ID = major - 5/8*P/tan(30)
		(debug, EXTERNAL Threading OD = #<OD> ID = #<ID>)
		#3 = [#4 * 1.0825]	                         ; cut depth, diam (re-use #3)
		; g1X [#<OD> + 1]                                 ; 1mm outside initial cut
		; g0 z#13	                                              ; Z start point
		; g1 X #<OD>                                        ; X start point 
		; g1 Z #5                                                ; ?? Z final position
		G0 X[#<OD> +1]                              ; drive line 1mm outside cut
		G0 Z #13   				         ; Z start point
 		g76 p#4 z#5 i-1 j0.2 k#3 h3 r1.5 q29.5 e0 l0
		
        O51 ENDIF
	G0 Z #13
	m5
o<threading> endsub

M2

Thank you again for your help.

Hugh

Here is my threading subroutine, which has examples of both:

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

More
06 May 2020 19:19 #166885 by andypugh
Replied by andypugh on topic G76 for Internal Threads
The routine is part of this: forum.linuxcnc.org/41-guis/26550-lathe-macros?start=0#34357

And all those routines start at current X / current Y

For a thread I typically jog to where I want the thread to end, put that number in the box, jog back to 2mm off the end, put in the other numbers, and press "go"

I use 1/8 P flat top on the thread because I typically use metric:
en.wikipedia.org/wiki/ISO_metric_screw_thread

Threads are always smaller than the nominal size. (though I am not sure why, they could not be)

It took a bit of fiddling with numbers to get threads that fit, as touching-off a threading tool is touching off something that is itself tip-rounded.

As to why the OD threading routing makes a tip-flattening cut and the ID one doesn't? I have long forgotten. :-)

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

More
07 May 2020 15:36 #166971 by currinh
Replied by currinh on topic G76 for Internal Threads
Andy:

I read through the lathe-macros thread. It was mostly about getting it running and the interface, rather than the internal G-codes. I'll have to attempt loading it as it looks very useful. It's an older thread so I didn't want to add to it, but there was some talk of converting to english. They should note there is a 1.0 clearance offset built into the threading code. Not a problem for 1mm but an unknowing clearance move of 1in could be a surprise, particularly for internal threading.

I was just curious why you chose the theoretical thread peak rather than the major diameter to measure from. All the calculations use the peak. It probably doesn't matter though, it's likely lost in variations of cutting tools. A correctly flattened or rounded tool would bring the calculation back to the major diameter. Or, as you say, maybe it's needed to have the threads actually fit together?

Ah ha. A tip-flattening cut would explain what it does. The code is there for this in the internal threading, but was commented out. I dropped those lines for clarity.

But in reality, I'm real happy when the threaded pieces just fit together nicely.

Thank you again.

Hugh

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

Time to create page: 0.068 seconds
Powered by Kunena Forum