Hello!
I'm having trouble with my helical mill and thread mill macro.
For counter clockwise (climb) milling, D has to be positive, and it is used for hole milling.
For clockwise (conventional) milling, D has to be negative, and it is used for thread milling.
If Q is positive, tool makes one final cicrular pass at constant Z to level the botom of the hole.
If Q is negative, tool stops at final depth, and moves to center of hole.
Controller is FANUC 18i-MB and I'm calling this function using G13.
ie. G13 X50 Y25 Z-40 R2 Q1,5 D30 F300
or it it is thread
G13 X50 Y25 Z-40 R2 Q-1,5 D-30 F300
Here is the code:
%
( HELIX MACRO)
( #24 - X - X CENTER OF BORE )
( #25 - Y - Y CENTER OF BORE )
( #7 - D - DIAMETER )
( #18 - R - STARTING DEPTH - RETRACT )
( #26 - Z - FINAL DEPTH )
( #17 - Q - STEP PER TURN )
( #9 - F - FEED )
#14 = #7 / 2 ( RADIUS )
#15 = #24 - #14 (X OFFSET)
#2 = 0
IF [#17 LT 0] THEN #2 = 1 ( IS IT THREAD )
#17 = ABS[#17]
#21 = ABS[#26]
#21 = #21 + #18 ( U - TOTAL DEPTH )
( 20 = T - TEMP )
#20 = #21 / #17 ( NUMBER OF FULL CIRCLE PASSES )
#20 = FIX[#20]
#6 = #20 * #17 ( K - DEPTH OF FINAL NON FULL CIRCLE PASS )
#6 = #21 - #6
#1 = #6 / #17
#1 = 360 * #1 ( A - ALPHA - REST OF ANGLE )
#1 = #1 + 180
IF [#3 GT 360] THEN #1 = #1 - 360
IF [#7 LT 0] THEN #1 = 360 - #1
#22 = #24 + [#14 * COS[#1]] (V - FINAL X)
#22 = FIX[#22 * 1000] /1000
#19 = #25 + [#14 * SIN[#1]] (S - FINAL Y)
#19 = FIX[#19 * 1000] /1000
#10 = 3 ( USED FOR G3 )
IF [#7 LT 0] THEN #10 = 2 ( IF Q IS LESS THEN 0 THEN G2)
#12 = 44 - #10 ( G41 OR G42 )
#23 = #18 - #17 ( FIRST DEPTH )
G0 G90 X#24 Y#25 ( MOVE TO CENTER POSITION )
Z#18 ( MOVE TO STARTING DEPTH, R )
G1 G#12 X#15 D#1035 F#9 ( MAKE TOOL OFFSET COMPENSATION, D#1035 IS TOOL NUMBER LOCATED IN SPINDLE ) <---- HERE IS THE PROBLEM
N1 G#10 X#15 Y#25 Z#23 I#14 J0 ( FULL CIRCLE )
#23 = #23 - #17 ( LOWER Z ONE STEP )
IF [#23LT#26] GOTO998 ( IF DEPTH IS LESS THAN FINAL DEPTH, GO TO 998 )
GOTO1 ( RETURN TO N1 IF DEPTH ISN'T LESS THEN FINAL DEPTH )
N998 IF [#2 EQ 0] GOTO999 ( IF IT IS NOT A THREAD, GO TO 999 )
G#10 X#22 Y#19 Z#26 I#14 ( MAKE FINAL RADIUS IF IT IS THREAD )
GOTO1000 ( SKIP LEVELING )
N999 G#10 Z#26 I#14
G#10 I#14 J0 ( MAKE ONE FINAL PASS TO LEVEL THE BOTTOM )
N1000 G1 G40 X#24 Y#25 ( RETURN TO CENTER )
Z#18 ( RETURN TO STARTING POSITION )
M99
%
My problem is that when machine is making tool radius compensation, it moves in both X and Y axis, and not only in X.
I know there is a "PROGRAMMER STUPIDITY ERROR" but I just can't put my finger on what am I doing wrong.
Help???