Well I think I have it now, I used the very nice thread calculator from Vardex (used it for years and its always spot on) to get different values so I could modify my VB.
Here is what I have come up with, it should work well for me for any 60 degree thread form that I regularly do
Code:
2005. Program Block 5.
StartX = LATHE_Getprofilestartx()
Pitch = LATHE_GetThreadLead()
EndX = LATHE_GetThreadX2()
If EndX < StartX then
height=(StartX*2)-(Pitch*1.226)
Else
height=(StartX*2) +(Pitch*1.17)
End If
height = FormatNumber(height ,3)
LATHE_SetReturnString(height)
The actual G76 lines in the PP are
Code:
87. Start of thread (G76) cycle
n,"M49"
n,"G76","X",program_block_5,thread_z2,thread_lead,thread_first_cut,thread_angle_in,rough_retract_amount,thread_last_cut
n,"M48"
88. End of thread (G76) cycle
n,spindle_off
n,program_block_2
For metric internal threads the normal way to determine the drill size is to subtract pitch from nominal thread size and that gets you close enough for most things, however as I am turning the thread rather than tapping I want to leave a wee bit extra so the insert will form the crest. I use the formula of pitch *1.1 and subtract that from the nominal thread dia and again it seems very close.
I may end up doing another programme block which will automatically give me the start dia even if my drawing is not quite right but will likely not bother.
One thing I thought about was having some advanced programming options in BobCAD so I can choose the threadform (metric, whitworth etc) and it would automatically adjust the G76 to suit but I thought about it and as I mainly do metric or Unified threads then its not worth the hassle as I can easily tweak the code if I am doing a Whit/BSP or some oddball thread.
Hood