CNC macro program for drilling angled holes that can be used on the FANUC system

CNC macro program for drilling angled holes that can be used on the FANUC system

drilling angled holes

O0001

G40G49G80G90G69G17G15                 ---- Program initialization

M03S1000                              ---- Spindle clockwise rotation

G54G00X0Y0Z50                         ---- Move to the programming origin point, 50mm above

#1=___                                ---- Length of the hypotenuse for the first hole

#2=___                                ---- Angle

#3=___                                ---- Distance between holes

#5=1                                ---- Start with processing the first hole

#6=___                                ---- Total number of holes

#7=___                                ---- Value of the R-point

#8=___                                ---- Drilling depth

WHILE[#5LE#6]DO1                      ---- If #5 is less than or equal to #6, enter Loop 1

#4=#1+[#5-1]#3                       ---- Length of the hypotenuse for any hole

#9=#4COS[#2]                         ---- X-axis length for any hole

#10=#4*SIN[#2]                        ---- Y-axis length for any hole

G01X#9Y#10F1000                        ---- Position above the hole location

G98G81R#7Z#8F1000                     ---- Drilling

#5=#5+1                               ---- Increment the hole counter by 1

END1                                  ---- End of Loop 1

G00Z200                               ---- Raise the tool to a safe height

M05                                   ---- Stop the spindle

M30                                   ---- End of program

Please note that this is just a sample program and you will need to adjust it according to your specific needs. You can fill in the relevant parameters for the angled hole, such as the hypotenuse length, angle, distance between holes, etc. Also, this program uses G code and macro variables, so make sure that your Fanuc system supports the corresponding instructions and variable functions.

Back to blog

Leave a comment

Please note, comments need to be approved before they are published.