Parametric Program for Drilling Circular Bolt Hole Patterns

Sample Parametric Program to Drill Circular Bolt Hole Patterns:

Bolt Hole SampleO0124 (MAIN PROGRAM)

(WRITTEN BY ADVANCED CNC SOLUTIONS)
( A CNC CONTRACT PROGRAMMING SERVICES PROVIDER)

(PARAMETRIC PROGRAM TO DRILL A CIRCULAR BOLT HOLE PATTERN)
(USED ON 3 AXIS OR 4 AXIS CNC MACHINING CENTERS WITH)
( MOST ANY FANUC CNC CONTROL)

(Copyright © 2012 AdvancedCNCSolutions.com)

(NOTE: THIS IS CURRENTLY AN UNPROVEN EXAMPLE PROGRAM!)

(PROGRAM DESIGNED TO DRILL ANY ONE OF AN)
( INFINITE NUMBER OF CIRCULAR HOLE PATTERNS)
( ON A FULL CIRCLE OR PARTIAL ARC PATTERN)

(6 PARAMETERS CONTROL ALL DIMENSIONS OF HOLE PATTERN FEATURE)

(WILL DRILL A FULL CIRCLE PATTERN USING ONLY NUMBER OF HOLES = H )
(   OR DRILL A FULL CIRCLE PATTERN USING ONLY INCREMENT ANGLE = I )
(   OR DRILL A PARTIAL CIRCLE PATTERN USING NUMBER OF HOLES = H )
(        AND INCREMENT ANGLE = I )

(CAN USE A NON-ZERO START ANGLE = S WITH ANY OF ABOVE VARIATIONS )

Bolt Sample( SAMPLE SETTINGS: )
( IF H=0 I = 0  S = 0 DEFAULTS TO 8 HOLES AT EVERY 45 DEGREES )
( IF H=5 I = 0  S = 0 THEN HOLES AT 0,72,144,216,288 DEGREES )
( IF H=0 I = 60 S = 0 THEN HOLES AT 0,60,120,180,240,300 DEGREES )
( IF H=6 I = 10 S = 0 THEN HOLES AT 0,10,20,30,40,50 DEGREES )
( IF H=4 I = 15 S = 45 THEN HOLES AT 45,60,75,90 DEGREES )

(===== MACRO VARIABLE DEFINITIONS =====)
(X = X COORDINATE OF CIRCLE CENTER)
(Y = Y COORDINATE OF CIRCLE CENTER)
(R = RADIUS OF HOLE PATTERN)
(H = NUMBER OF HOLES)
(I = INCREMENT ANGLE)
(S = START ANGLE)


 

 


Bolt(SAMPLE OF MAIN PROGRAM STUB TO CALL FANUC CUSTOM MACRO B PROGRAM)

(FANUC MACRO CALL TO DRILL CIRCULAR PATTERN OF HOLES)

N100 T12 M06

N110 G90 G17 G54

N120 S1650 M03

N130 G00 X1. Y2.

N140 G43 Z5. H12

N150 M08

N160 G99 G81 R4.1 Z2.25 F12.2 L0

N170 G65 P1001 X1. Y2. R3.25 H5. I0. S0.

/N18 G65 P1001 X1. Y2. R3.25 H0. I60. S0.

/N19 G65 P1001 X1. Y2. R3.25 H6. I10. S0.

/N20 G65 P1001 X1. Y2. R3.25 H4. I15. S45.

N210 G80

N220 M09

N230 G91 G28 Z0 M05

N240 M01

N250 M30

%

O1001 (CNC PARAMETRIC PROGRAM)

 

(===== INPUT ERROR CHECKING =====)

N10 IF [#24 EQ #0] GOTO 9001

N11 IF [#25 EQ #0] GOTO 9002

N12 IF [#18 EQ #0] GOTO 9003

N13 IF [#11 NE #0] GOTO 14

#11 = 0 (IF H MISSING THEN SET DEFAULT TO 0)

N14 IF [#4 NE #0] GOTO 15

#4 = 0 (IF I MISSING THEN SET DEFAULT TO 0)

N15 IF [#19 NE #0] GOTO 16

#19 = 0 (IF S MISSING THEN SET DEFAULT TO 0)

N16 IF [#18 LE 0] GOTO 9004

N17 IF [#11 NE FIX[#11]] GOTO 9005

N18 IF [#11 LT 0] GOTO 9006

 

(===== VARIABLE ASSIGNMENTS =====)

#101 = #24            (X = X COORDINATE OF CIRCLE CENTER)

#102 = #25            (Y = Y COORDINATE OF CIRCLE CENTER)

#103 = #18            (R = RADIUS OF HOLE PATTERN)

#104 = #11            (H = NUMBER OF HOLES)

#105 = #4              (I = INCREMENT ANGLE)

#106 = #19            (S = START ANGLE FROM +X AXIS)

 

(===== CALCULATIONS =====)

IF [#105 EQ 0] GOTO 31           (IF I = 0 THEN SKIP)

#111 = #105                           (SET STEP ANGLE IF I<>0)

GOTO 33

N31

IF [#104 EQ 0] GOT0 32           (IF H = 0 THEN SKIP)

#111 = 360/#104                    (SET STEP ANGLE IF H>0 AND I=0)

GOTO 33

N32

(IF H&I = 0 THEN SET TO 45 DEGREES AS DEFAULT = 8 HOLES)

#111 = 45                              (SET STEP ANGLE IF H=0 AND I=0)

N33

#112 = #106                          (SET INC ANGLE = START ANGLE)

IF [#104 EQ 0] GOTO 41

IF [#105 EQ 0] GOTO 41         (IF H>0 AND I<>0)

#113 = (#104*#105+#106-#111)  (SET END ANGLE = H*I+S-#111)

GOTO 42

N41                                       (IF H=0 OR I=0)

#113 = (360+#106-1)            (SET END ANGLE = 360+S-1)

N42

 

(===== PARAMETRIC HOLE PATTERN DRILLING OPERATION =====)

WHILE [#112 LE #113] DO1

#114 = #101+#103*COS[#112]    (X COORD)

#115 = #102+#103*SIN[#112]     (Y COORD)

X#114 Y#115                               (DRILL HOLE)

#112 = #112+#111                     (INCREMENT ANGLE)

END1

 

(==================================================)

GOTO 9999

N9001 #3000=101 (X COORD MISSING IN MACRO CALL)

N9002 #3000=102 (Y COORD MISSING IN MACRO CALL)

N9003 #3000=103 (RADIUS MISSING IN MACRO CALL)

N9004 #3000=104 (RADIUS MUST BE GREATER THAN ZERO)

N9005 #3000=105 (HOLE VALUE MUST BE AN INTEGER)

N9006 #3000=106 (HOLE VALUE MUST BE POSITIVE)

N9999

M99

%

Return to News