Threading cycle
I have come up with a macro for threading I haven't got to test it yet but thought I would post anyway. As soon as I test it I'll let you know how it works here is the code.
G65 P9011 X1.840 Z-1.3 F.0869 K4.0 Q0.005 R.125
X= major diameter of thread
Z= thread length
F= lead
K= number of passes you want to take
Q= depth of finish pass (diam)
R= thread hieght (diam)
Here is the macro. It is used in the same sense as G76(tool,speed, x and y position set before macro call). Once I test it I will put checksum code in it to make sure all required variables have been passed in the G65 call.
%
O9011
#100=[#18-#17] (Calculates depth of cut - finish depth)
#101=[#100/[#6-1]] (Calculates the depth of each pass)
#102=0 (Sets counter to 0)
WHILE [#102 NE [#6-1]] DO 1
G92 X[#24-#101] Z[#26] F[#9]
#24=[#24-#101]
#102=[#102+1]
END1
G92 X[#24-#17] Z[#26] F[#9]
M99
%
I will report back once it has been tested.
Edit due to typo.
No matter how good you are, there is always someone better!!!