Hello Parabellum,
The issue I have with using a Subprogram and repeating it a number of times, is that you must make sure that the Lead of the Helix is compatible with the Z full depth and the number of time the Subprogram is repeated. Further, as arguments can't be passed to a Subprogram, unless you were to register these values in Common Variables,you would have to edit the Subprogram for each different Z Depth, Helix Lead, Cutter Diameter and Diameter of Helix.
My option would be to create a Helical Milling Macro Program and call it with a Custom G Code. Following is a typical Call Block for such a Macro
G00 G90 G54 X0.0 Y0.0
G43 Z0.5 H01 M08
G103 Z-2.5 W-0.040 R0.04 I2.0 D1.0 V0.020 F15.0
---------------
---------------
Remainder of Program
---------------
---------------
M30
%
Where:
103 = The number registered to create a Custom G Code
Z = Z Absolute Full Depth Coordinate
W = Direction and Lead of Helix
R = R Plane
I = Diameter of Helix
D = Diameter of Cutter
V = Z Start Coordinate
F = Cut Feed Rate
Following is an example of a Macro for Helical Milling. This is a bare bones example with minimal Error Trapping. This program could be easily expanded so as to use a Tool Radius registered in an Offset Registry. You could have the program use Cutter Radius Compensation without actually using G41/G42 in the Macro. Instead of passing the diameter of the tool as an argument, the Offset Number would be passed and the value stored therein retrieved within the Macro Program.
Code:
O9010
(ERROR TAPS GO HERE)
IF[[#4 = #0] OR [#7 = #0] OR [#9 = #0] OR [#18 = #0] OR [#22 = #0] OR [#23 = #0] OR [#26 = #0]] GOTO900
G31 (or G53) (HALT BUFFERING)
#100 = #4003 (STORE GROUP 3 G CODE)
#1 = #5041 (GET CURRENT X POSITION)
#3 = #5043 (GET CURRENT Z POSITION)
#4 = [ #4/2 - #7/2] (GET RADIAL MOVE OF CUTTER)
G90 G00 Z#18 (RAPID TO R PLANE)
G01 Z#22 F50.0 (MOVE TO Z START)
G01 X[#1 + #4] (MOVE TO CIRCUMFERENCE OF HELICAL PATH)
WHILE [#22 GT #26] DO1
#22 = #22 + #23
IF [#22 LT #26]TH #22=#26 (STOP OVER CUT IN Z)
G03 I-#4 Z#22 F#9
END 1
G03 I-#4 (CLEAN CUT AT FULL DEPTH)
G01 X#1 (RETURN TO CENTRE OF HELIX)
G00 Z#3 (RETURN TO INITIAL LEVEL)
GOTO901
N900
#3000 = 1 (MISSING REQ DATA - FIX)
N901
G#100 (RESTORE GROUP 3 G CODE)
M99
%
The above program allows for the Lead of the Helix to be changed without any thought of the number of time the Helical command must be repeated and whether the full Z Depth will be reached, or passed.
I have not tested the above code, but I can't see any obvious errors. Tread carefully if you use the code.
Regards,
Bill