Just so it's clear, this subroutine allows you to make an external thread mill with one subroutine call. The sub handles all math and positioning.
Before making the subroutine call, make sure that the following items are as described:
- Correct tool in spindle, with tool data for nominal diameter and diameter offset correctly set in the tool table
- Tool running at proper RPM and direction
- Coolant on or off as desired
In the CLS block, enter the following:
X, Y=center of boss in X and Y
Z=surface of part
D=depth of thread from surface
F=feedrate at tool tip
That's all you have to do - the sub handles all math, blend in and out, coordination of Z and K so endpoint is correct, etc. It's also all written in G90.
I hope this helps someone.