
13. Program Support Functions
13.5 User Macro Specifications
366
(Example 2) Bolt hole circle
After defining the hole data with canned cycle (G72 to G89), the macro command is
issued as the hole position command.
G81Z–100.R50.F300L0
G65L9920Aa1Bb1Rr1Xx1Yy1 ;
-Y
y1
W
x1
-X
a1
#101=0 ;
#102=#4003 ;
#103=#5001 ;
#104=#5002 ;
#111=#1 ;
WHILE [#101LT#2] DO1 ;
#120=#24+#18
∗
COS [#111] ;
#121=#25+#18
∗
SIN [#111] ;
#122=#120 #123=#121 ;
IF [#102EQ90] GOTO100 ;
#122=#120
−
#103 ;
#123=#121
−
#104 ;
#103=#120
#104=#121
N100 X#122Y#123 ;
#101=#101+1 ;
#111=#1+360.
∗
#101/#2 ;
END1 ;
G23 ;
Main program
L9920 (Subprogram)
(Note 1)
The processing time can be shortened
by programming in one block.
a1 ; Start angle
b1 ; No. of holes
r1 ; Radius
x1 ; X axis center
position
y1 ; Y axis center
position
(Note 1)
(Note 1)
(Note 1)
To subprogram
L9920
0
→
#101
G90, G91 mode
Read in
→
#102
Read previous coordinates
X
→
#103
Y
→
#104
Start angle
→
111
#101 = No. of hole count
#102 = G90 or G91
#103 = X axis current position
#104 = Y axis current position
#111 = Start angle
#101
≤
No. of holes
#102=90
Radius
∗
COS [#111]
+ Center coordinates X
→
#120
Radius
∗
SIN [#111]
+ Center coordinates Y
→
#121
#120
→
#122
#121
→
#123
#120 = Hole position
X coordinates
#121 = Hole position
Y coordinates
#122 = X axis absolute value
#123 = Y axis absolute value
END
#120-#103
→
#122
#121-#104
→
#123
#120
→
#103
#121
→
#104
#122 = X axis incremental value
123 = Y axis incremental value
X axis current position update
Y axis current position update
Judgment of G90, G91
mode
#101+1
→
#101
360 deg.
∗
#101/
No. of holes+#1
→
#111
No.of holes counter up
#111 = Hole position angle
N100X#122Y#123
Drilling command
Y
N
N
Y
(Note 1)
(Note 1)