Fanuc Bolt Hole Circle Custom Macro (BHC)


Submit by: cnc programmer

Drawing/Image

Fanuc Bolt Hole Circle Custom Macro (BHC)

CNC Program

/*Parameters
G65 P9100 Xx Yy Zz Rr Ff Ii Aa Bb Hh
X: X coordinate of the center of the circle (#24)
Y: Y coordinate of the center of the circle (#25)
Z: Hole depth (#26)
R: Coordinates of an approach point (#18)
F: Cutting feedrate (#9)
I: Radius of the circle (#4)
A: Drilling start angle (#1)
B: Incremental angle (Clockwise when negative value) (#2)
H: Number of holes (#11)
*/

O9100
#3=#4003
G81 Z#26 R#18 F#9 K0
IF[#3 EQ 90]GOTO 1
#24=#5001+#24
#25=#5002+#25
N1 WHILE[#11 GT 0]DO 1
#5=#24+#4*COS[#1]
#6=#25+#4*SIN[#1]
G90 X#5 Y#6
#1=#1+#2
#11=#11-1
END 1
G#3 G80
M99

/*Fanuc Bolt Hole Macro Example
Example macro call to drill 5 holes at intervals of 45 degrees
after a start angle of 0 degrees
on the circumference of a circle with radius 4”.
The absolute center of the circle is (10”, 5”).*/
O0002
G90 G92 X0 Y0 Z4.0
G65 P9100 X10.0 Y5.0 R1.0 Z-2.0 F20 I4.0 A0 B45.0 H5
M30