
PROGRAMMING
15. CUSTOM MACRO
B–63514EN/01
318
O9100;
#3=#4003;
Stores G code of group 3.
G81 Z#26 R#18 F#9 K0; (Note) Drilling cycle.
Note: L0 can also be used.
IF[#3 EQ 90]GOTO 1; Branches to N1 in the G90 mode.
#24=#5001+#24; Calculates the X coordinate of the center.
#25=#5002+#25; Calculates the Y coordinate of the center.
N1 WHILE[#11 GT 0]DO 1;
Until the number of remaining holes reaches 0. .
#5=#24+#4*COS[#1]; Calculates a drilling position on the X–axis.
#6=#25+#4*SIN[#1]; Calculates a drilling position on the Y–axis.
G90 X#5 Y#6; Performs drilling after moving to the target position.
#1=#1+#2; Updates the angle.
#11=#11–1; Decrements the number of holes.
END 1;
G#3 G80; Returns the G code to the original state.
M99;
Meaning of variables:
#3: Stores the G code of group 3.
#5: X coordinate of the next hole to drill
#6: Y coordinate of the next hole to drill
Once G66 is issued to specify a modal call a macro is called after a block
specifying movement along axes is executed. This continues until G67
is issued to cancel a modal call.
O0001 ;
:
G66 P9100 L2 A1.0 B2.0 ;
G00 G90 X100.0 ;
Y200.0 ;
X150.0 Y300.0 ;
G67 ;
:
M30 ;
O9100 ;
:
G00 Z–#1 ;
G01 Z–#2 F300 ;
:
:
:
:
M99 ;
G66 P p L ȏ <argument–specification> ;
P : Number of the program to call
ȏ : Repetition count (1 by default)
Argument : Data passed to the macro
S After G66, specify at address P a program number subject to a modal
call.
S When a number of repetitions is required, a number from 1 to 9999 can
be specified at address L.
S As with a simple call (G65), data passed to a macro program is
specified in arguments.
When a G67 code is specified, modal macro calls are no longer performed
in subsequent blocks.
D Macro program
(called program)
15.6.2
Modal Call (G66)
Explanations
D Call
D Cancellation