FANUC Series 16/18/160/180-Model C for Lathe Operator Manual

PROGRAMMING
16. CUSTOM MACRO
B–62754EN/01
299
O0002;
G50 X100.0 Z200.0 ;
G00 X0 Z102.0 S1000 M03 ;
G65 P9100 Z50.0 K20.0 F0.3 ;
G00 X100.0 Z200.0 M05 ;
M30 ;
O9100;
#1=0 ; Clear the data for the depth of the current hole.......................
#2=0 ; Clear the data for the depth of the preceding......................
hole.
IF [#23 NE #0] GOTO 1 ; If incremental programming, specifies the.....
jump to N1.
IF [#26 EQ #0] GOTO 8 ; If neither Z nor W is specified, an error.....
occurs.
#23=#5002-#26 ; Calculates the depth of a hole............
N1 #1=#1+#6 ; Calculates the depth of the current hole................
IF [#1 LE #23] GOTO 2 ;
Determines whether the hole to be cut is......
too deep.?
#1=#23 ; Clamps at the depth of the current hole.....................
N2 G00 W-#2 ; Moves the tool to the depth of the preceding...............
hole at the cutting feedrate.
G01 W- [#1-#2] F#9 ; Drills the hole........
G00 W#1 ; Moves the tool to the drilling start point....................
IF [#1 GE #23] GOTO 9 ; Checks whether drilling is completed......
#2=#1 ; Stores the depth of the current hole......................
GOTO 1 ;
N9 M99 ;
N8 #3000=1 (NOT Z OR U COMMAND)
D Program calling a macro
program
D Macro program
(called program)

Leave a Reply

Your email address will not be published. Required fields are marked *