Search

# A bolt circle parametric program in three versions

### FANUC's Custom Macro

Here is a custom macro that machines a bolt hole pattern. First, let's look at an example calling program

• O0008 (Main program)

• N005 G54 G90 S800 M03 T02 (Select coordinate system, absolute mode, start spindle, get next tool ready)

• N010 G00 X3.0 Y2.5 (Rapid to center of bolt hole pattern)

• N015 G43 H01 Z.1 (Instate tool length compensation, rapid up to workpiece)

• N020 G65 P1008 X3.0 Y2.5 Z0 R1.75 D0.75 A45.0 H8.0 C81. F5.0 (Machine entire bolt hole pattern with drilling cycle)

• N025. . . . . .

Note that as with any user created canned cycle, the custom macro will only be doing the machining once a tool has been loaded, the spindle started, tool length compensation is instated, and so on.

The G65 command (N020), of course, calls the bolt hole macro. Variables representations are as follows:

• X - Position in X for center of bolt hole pattern

• Y - Position in Y for center of bolt hole pattern

• Z - Surface in Z into which holes are machined

• R - Radius of bolt hole pattern

• D - Depth of holes

• A - Starting angle (0 is three o'clock position, plus is ccw)

• H - Number of holes

• C - Cycle type (81 is for drilling, 84 for tapping, etc.)

• F - Feedrate for machining

Now, here's the actual custom macro (program O1008).

• O1008 (Custom macro to machine bolt hole circle)

• #101=1 (Initialize counter)

• #102=#1 (Initialize current angle to A)

• #103=360 / #11 (Constant for incremental angular distance between holes)

• #104=#26 + 0.1 (Constant for rapid approach plane)

• #105=#26 - #7 (Constant for Z bottom position of hole)

• N1 IF [#101 GT #11] GOTO 99 (Test if loop is finished)

• #110=#24 + COS[#102] * #18 (Calculate X position for current hole based on current angle)

• #111=#25 + SIN[#102] * #18 (Calculate Y position for current hole based on current angle)

• G#3 X#110 Y#111 R#104 Z#105 F#9 (Machine current hole)

• G80 (Cancel cycle)

• #101=#101 + 1 (Step counter)

• #102=#102 + #103 (Step current angle)

• GOTO 1 (Go back to test at loop beginning)

• N99 M99 (End of custom macro)

Here is a user task program that machines a bolt hole pattern. First, let's look at an example calling program

• O0008 (Main program)

• N005 G15 H1G90 S800 M03 T02 (Select coordinate system, absolute mode, start spindle, get next tool ready)

• N010 G00 X3.0 Y2.5 (Rapid to center of bolt hole pattern)

• N015 G56 H01 Z.1 (Instate tool length compensation, rapid up to workpiece)

• N020 CALL O1008 XCTR=3.0 YCTR=2.5 ZSUR=0 RAD=1.75 HDEP=0.75 AGL=45.0 HLES=8.0 CYCL=81. FEED=5.0 (Machine entire bolt hole pattern with drilling cycle)

• N025. . . . . .

Note that as with any user created canned cycle, the user task program will only be doing the machining once a tool has been loaded, the spindle started, tool length compensation is instated, and so on.

The CALL command (N020), of course, calls the bolt hole user task program. Variables representations are as follows:

• XCTR - Position in X for center of bolt hole pattern

• YCTR - Position in Y for center of bolt hole pattern

• ZSUR - Surface in Z into which holes are machined

• HDEP - Depth of holes

• AGL - Starting angle (0 is three o'clock position, plus is ccw)

• HLES - Number of holes

• CYCL - Cycle type (81 is for drilling, 84 for tapping, etc.)

• FEED - Feedrate for machining

Now, here's the actual user task program (program O1008).

• O1008 (User task program to machine bolt hole circle)

• HLE=1 (Initialize counter)

• CURA=AGL (Initialize current angle to AGL)

• IAGL=360 / HLES (Constant for incremental angular distance between holes)

• RAPP=ZSUR + 0.1 (Constant for rapid approach plane)

• ZBTM=ZSUR - HDEP (Constant for Z bottom position of hole)

• N1 IF [HLE GT HLES] GOTO N99 (Test if loop is finished)

• CURX=XCTR + COS[CURA] * RAD (Calculate X position for current hole based on current angle)

• CURY=YCTR + SIN[CURA] * RAD (Calculate Y position for current hole based on current angle)

• G=CYCL X=CURX Y=CURY R=RAPP Z=ZBTM F=FEED (Machine current hole)

• G80 (Cancel cycle) HLE=HLE + 1 (Step counter)

• CURA=CURA + IAGL (Step current angle)

• GOTO N1 (Go back to test at loop beginning)

• N99 RTS (End of use task program)

Here is a user Fadal macro program that machines a bolt hole pattern. First, let's look at an example calling program

• O0008 (Main program)

• N005 G54 G90 S800 M03 T02 (Select coordinate system, absolute mode, start spindle, get next tool ready)

• N010 G00 X3.0 Y2.5 (Rapid to center of bolt hole pattern)

• N015 G43 H01 Z.1 (Instate tool length compensation, rapid up to workpiece)

• N020 #V1=3.0 ‘Assign argument V1

• N025 #V2=2.5 ‘Assign argument V2

• N030 #V3=0 ‘Assign argument V3

• N035 #V4=1.75 ‘Assign argument V4

• N040 #V5=45.0 ‘Assign argument V5

• N045 #V6=8.0 ‘Assign argument V6

• N050 #V7=5.0 ‘Assign argument V7

• N055 #V8=81. ‘Assign argument V8

• N060 #V9=0.75 ‘Assign argument V9

• N065 M98 P1008 (Machine entire bolt hole pattern with drilling cycle)

• N070. . . .

Note that as with any user created canned cycle, the macro will only be doing the machining once a tool has been loaded, the spindle started, tool length compensation is instated, and so on.

The variable assignments (V words) must be set and the M98 command calls the macro. Variables representations are as follows:

• V1 - Position in X for center of bolt hole pattern

• V2 - Position in Y for center of bolt hole pattern

• V3 - Surface in Z into which holes are machined

• V4 - Radius of bolt hole pattern

• V4 - Starting angle (0 is three o'clock position, plus is ccw)

• V5 - Depth of holes

• V6 - Number of holes

• V8 - Cycle type (81 is for drilling, 84 for tapping, etc.)

• V9 - Feedrate for machining

Now, here's the actual macro (program O1008).

• O1008 (Macro to machine bolt hole circle)

• #V21=1 ‘Initialize counter

• #V22=V5 ‘Initialize current angle to V5

• #V23=360 / V6 ‘Constant for incremental angular distance between holes

• #R4=V7 ‘Set R4 to feedrate

• #R5=V8 ‘Set R5 to cycle type

• #R6=V3 + 0.1 ‘Constant for rapid approach plane

• #R7=V3 - V9 ‘Constant for Z bottom position of hole

• #:LOOPBEGIN ‘Beginning point of loop

• #IF [V21 > V6] THEN GOTO :EXIT ‘Test if loop is finished

• #R8=V1 + COS(V22) * V4 ‘Calculate X position for current hole based on current angle

• #R9=V2 + SIN(V22) * V4 ‘Calculate Y position for current hole based on current angle

• G+R5 X+R8 Y+R9 R0+R6 Z+R7 F+R4 (Machine current hole)

• G80 (Cancel cycle) #V21=V21 + 1 ‘Step counter

• #V22=V22 + V23 ‘Step current angle

• #GOTO :LOOPBEGIN ‘Go back to test at loop beginning

• #:EXIT ‘End of loop

• M99 (End of macro)

72 views

### Recent Posts

See All

#### Outputting Fixture Offset Settings 