Jump to content

Welcome to eMastercam

Register now to participate in the forums, access the download area, buy Mastercam training materials, post processors and more. This message will be removed once you have signed in.

Use your display name or email address to sign in:

Fanuc Macro for 3-Axis drilling with Angle Head.


Guest MTB Technical Services
 Share

Recommended Posts

Guest MTB Technical Services

For anyone who might have the need.

I helped a customer today who had a need for 3-Axis drilling on a VMC using an Universal Angle Head.

G68.1 wasn't an option so I did it with a Macro.

 

You'll notice that the retracts are done in G01 mode as not all Fanuc equipped machines are or can be set

to rapid in a straight line at full feed.

 

mill_universal_angle_head.PNG

 

%

O0001 (FANUC ANGLE HEAD MACRO TEST)

(FILE = TEST.NC)

(DATE = 11/5/2013)

(TIME = 8:16:23 AM)

G00 G17 G20 G40 G49 G80 G90 G94

G00 G91 G28 Z0.0 M09

T01 M06

G00 G90 G54 X0.0 Y0.0 S2500 M04 (REVERSE SPINDLE FOR CW ON HEAD)

G00 G43 H01 Z12.0 M08

G65 P9180 X-3.5 Y0.0 Z0.0 D2.0 H0.02 Q0.1 R0.1 W500 U5.9055 V5.5 F10.0 A3 B-30.0 C0.0

G00 Z12.0 M05

G00 G91 G28 Z0.0 M09

G00 G91 G28 Y0.0

M30

 

O9180 (UNIVERSAL_ANGLE_HEAD.MACRO)

(--------------------------)

(GENERATE LINEARIZED POINT-TO-POINT NC CODE)

(FOR MULTI-AXIS DRILLING OPERATIONS)

 

(PARAMETERS)

(#24 = HOLE LOCATION - X {0})

(#25 = HOLE LOCATION - Y {0})

(#26 = HOLE LOCATION - Z {0})

(#7 = HOLE DEPTH - D {2.0})

(#11 = SWARF CLEARANCE(G73/G83 ONLY) - H {0.02})

(#17 = PECK AMOUNT(G73/G83 ONLY) - Q {0.1})

(#18 = INCREMENTAL CLEARANCE - R {0.1})

(#23 = DWELL IN MILLISECONDS(G82 ONLY) - W {500})

(#21 = PIVOT DISTANCE - U {5.9055})

(#22 = TOOL GAUGE LENGTH - V {5.5})

(#9 = FEED RATE - F {10.0})

(#2 = B-AXIS ANGLE (ROTATE ABOUT Y) {10.0})

(#3 = C-AXIS ANGLE (ROTATE ABOUT Z) {45.0})

(#1 = TYPE G81=0/G82=1/G73=2/G83=3/G84=4/G85=5 {3})

 

(FORCE ABSOLUTE VALUES)

#1 = [ABS[#1]]

IF[#1GT5] GOTO 9991 (INVALID CYCLE TYPE!)

 

#7 = [ABS[#7]]

IF[#7EQ0.0] GOTO 9992 (INVALID HOLE DEPTH!)

 

#9 = [ABS[#9]]

IF[#9EQ0.0] GOTO 9993 (INVALID FEEDRATE!)

 

#17 = [ABS[#17]]

IF[#1EQ2] GOTO 17

IF[#1EQ3] GOTO 17

GOTO 18

N17

IF[#9EQ0.0] GOTO 9994 (INVALID PECK VALUE!)

 

N18

#18 = [ABS[#18]]

IF[#18EQ0.0] GOTO 9995 (INVALID R CLEARANCE!)

 

#21 = [ABS[#21]]

IF[#21EQ0.0] GOTO 9996 (INVALID PIVOT LENGTH!)

 

#22 = [ABS[#22]]

IF[#22EQ0.0] GOTO 9997 (INVALID TOOL GAGE LENGTH!)

 

#11 = [ABS[#11]]

IF[#11EQ0.0] GOTO 9998 (INVALID CHIP CLEARANCE!)

 

#23 = [ABS[#23]]

 

(CALCULATE THE UNIT VECTORS)

#4 = [COS[#3] * SIN[#2]]

#5 = [COS[#3] * [TAN[#3] * SIN[#2]]]

#6 = [COS[#2]]

 

(CALCULATE THE TOTAL GAUGE LENGTH)

#8=[#21+#22]

 

(CALCULATE X,Y,Z SHIFTS FOR TOTAL GAUGE LENGTH)

#101=[#8*#4]

#102=[#8*#5]

#103=[#8*#6]

 

(CALCULATE X,Y,Z SHIFTS FOR R-PLANE CLEARANCE)

#111=[#18*#4]

#112=[#18*#5]

#113=[#18*#6]

 

(START POINT W/CLEARANCE)

#124=[#101+#111+#24]

#125=[#102+#112+#25]

#126=[#103+#113+#26]

 

#134=[#101+#111+#24]

#135=[#102+#112+#25]

#136=[#103+#113+#26]

 

(FINAL END POINT)

#144=[#24-[#7*#4]+#101]

#145=[#25-[#7*#5]+#102]

#146=[#26-[#7*#6]+#103]

 

IF[#1EQ0.0]GOTO 10

IF[#1EQ1.0]GOTO 20

IF[#1EQ2.0]GOTO 30

IF[#1EQ3.0]GOTO 40

IF[#1EQ4.0]GOTO 50

IF[#1EQ5.0]GOTO 60

 

GOTO 9991 (INVALID CYCLE SELECTION!)

 

N10 (G81 - STANDARD DRILL CYCLE)

(**********************)

(HOLE LOCATION - 'X' = #24)

(HOLE LOCATION - 'Y' = #25)

(HOLE LOCATION - 'Z' = #26)

(ANGLE 'B' = #2)

(ANGLE 'C' = #3)

(**********************)

(UNIT VECTOR - 'I' = #4)

(UNIT VECTOR - 'J' = #5)

(UNIT VECTOR - 'K' = #6)

(**********************)

(PIVOT DISTANCE = #21)

(TOOL GAUGE LENGTH = #22)

(TOTAL SET LENGTH = #8)

(**********************)

(HOLE DEPTH - 'D' = #7)

(INCREMENTAL CLEARANCE - 'R' = #18)

(FEED RATE - 'F' = #9)

(**********************)

 

G00 X[#124] Y[#125] Z[#126]

G01 X[#144] Y[#145] Z[#146] F[#9]

G01 X[#134] Y[#135] Z[#136] F[#9*50]

GOTO 99

(**********************)

 

N20 (G82 - STANDARD DRILL CYCLE W/DWELL)

(**********************)

(HOLE LOCATION - 'X' = #24)

(HOLE LOCATION - 'Y' = #25)

(HOLE LOCATION - 'Z' = #26)

(ANGLE 'B' = #2)

(ANGLE 'C' = #3)

(**********************)

(UNIT VECTOR - 'I' = #4)

(UNIT VECTOR - 'J' = #5)

(UNIT VECTOR - 'K' = #6)

(**********************)

(PIVOT DISTANCE = #21)

(TOOL GAUGE LENGTH = #22)

(TOTAL SET LENGTH = #8)

(**********************)

(HOLE DEPTH - 'D' = #7)

(INCREMENTAL CLEARANCE - 'R' = #18)

(DWELL IN MILLISECONDS - 'P' = #23)

(FEED RATE - 'F' = #9)

(**********************)

G00 X[#124] Y[#125] Z[#126]

G01 X[#144] Y[#145] Z[#146] F[#9]

G04 P#23

G01 X[#134] Y[#135] Z[#136] F[#9*50]

GOTO 99

(**********************)

 

N30 (G73 - CHIP BREAK CYCLE)

(**********************)

(HOLE LOCATION - 'X' = #24)

(HOLE LOCATION - 'Y' = #25)

(HOLE LOCATION - 'Z' = #26)

(ANGLE 'B' = #2)

(ANGLE 'C' = #3)

(**********************)

(UNIT VECTOR - 'I' = #4)

(UNIT VECTOR - 'J' = #5)

(UNIT VECTOR - 'K' = #6)

(**********************)

(PIVOT DISTANCE = #21)

(TOOL GAUGE LENGTH = #22)

(TOTAL SET LENGTH = #8)

(**********************)

(HOLE DEPTH - 'D' = #7)

(PECK AMOUNT - 'Q' = #17)

(SWARF CLEARANCE - 'H' = #11)

(INCREMENTAL CLEARANCE - 'R' = #18)

(FEED RATE - 'F' = #9)

(**********************)

G00 X[#124] Y[#125] Z[#126]

WHILE[#126GT#146]DO 1

 

#124=[#124-[#17*#4]]

#125=[#125-[#17*#5]]

#126=[#126-[#17*#6]]

 

IF[#126LT#146] GOTO 73

 

G01 X[#124] Y[#125] Z[#126] F[#9]

G01 X[#124+[#11*#4]] Y[#125+[#11*#5]] Z[#126+[#11*#6]] F[#9*50]

 

END 1

N73

G01 X[#144] Y[#145] Z[#146] F[#9]

G01 X[#134] Y[#135] Z[#136] F[#9*50]

GOTO 99

(**********************)

 

N40 (G83 - DEEP HOLE CYCLE)

(**********************)

(HOLE LOCATION - 'X' = #24)

(HOLE LOCATION - 'Y' = #25)

(HOLE LOCATION - 'Z' = #26)

(ANGLE 'B' = #2)

(ANGLE 'C' = #3)

(**********************)

(UNIT VECTOR - 'I' = #4)

(UNIT VECTOR - 'J' = #5)

(UNIT VECTOR - 'K' = #6)

(**********************)

(PIVOT DISTANCE = #21)

(TOOL GAUGE LENGTH = #22)

(TOTAL SET LENGTH = #8)

(**********************)

(HOLE DEPTH - 'D' = #7)

(PECK AMOUNT - 'Q' = #17)

(SWARF CLEARANCE - 'H' = #11)

(INCREMENTAL CLEARANCE - 'R' = #18)

(FEED RATE - 'F' = #9)

(**********************)

G00 X[#124] Y[#125] Z[#126]

WHILE[#126GT#146]DO 2

 

#124=[#124-[#17*#4]]

#125=[#125-[#17*#5]]

#126=[#126-[#17*#6]]

 

IF[#126LT#146] GOTO 83

 

G01 X[#124] Y[#125] Z[#126] F[#9]

G01 X[#134] Y[#135] Z[#136] F[#9*50]

G01 X[#124+[#11*#4]] Y[#125+[#11*#5]] Z[#126+[#11*#6]] F[#9*50]

 

END 2

N83

G01 X[#144] Y[#145] Z[#146] F[#9]

G01 X[#134] Y[#135] Z[#136] F[#9*50]

GOTO 99

(**********************)

 

N50 (G84 - TAPPING CYCLE)

(**********************)

(HOLE LOCATION - 'X' = #24)

(HOLE LOCATION - 'Y' = #25)

(HOLE LOCATION - 'Z' = #26)

(ANGLE 'B' = #2)

(ANGLE 'C' = #3)

(**********************)

(UNIT VECTOR - 'I' = #4)

(UNIT VECTOR - 'J' = #5)

(UNIT VECTOR - 'K' = #6)

(**********************)

(PIVOT DISTANCE = #21)

(TOOL GAUGE LENGTH = #22)

(TOTAL SET LENGTH = #8)

(**********************)

(HOLE DEPTH - 'D' = #7)

(INCREMENTAL CLEARANCE - 'R' = #18)

(FEED RATE - 'F' = #9)

(**********************)

G00 X[#124] Y[#125] Z[#126]

G01 X[#144] Y[#145] Z[#146] F[#9]

M03

G01 X[#134] Y[#135] Z[#136] F[#9]

M04

GOTO 99

 

(**********************)

N60 (G85 - BORING CYCLE)

(**********************)

(HOLE LOCATION - 'X' = #24)

(HOLE LOCATION - 'Y' = #25)

(HOLE LOCATION - 'Z' = #26)

(ANGLE 'B' = #2)

(ANGLE 'C' = #3)

(**********************)

(UNIT VECTOR - 'I' = #4)

(UNIT VECTOR - 'J' = #5)

(UNIT VECTOR - 'K' = #6)

(**********************)

(PIVOT DISTANCE = #21)

(TOOL GAUGE LENGTH = #22)

(TOTAL SET LENGTH = #8)

(**********************)

(HOLE DEPTH - 'D' = #7)

(INCREMENTAL CLEARANCE - 'R' = #18)

(FEED RATE - 'F' = #9)

(**********************)

G00 X[#124] Y[#125] Z[#126]

G01 X[#144] Y[#145] Z[#146] F[#9]

G01 X[#134] Y[#135] Z[#136] F[#9]

GOTO 99

(**********************)

 

N99 G00 (END MACRO - SUCCESS)

M99

 

N9991

#3000=1(INVALID CYCLE TYPE!)

GOTO 9999

 

N9992

#3000=2(INVALID HOLE DEPTH!)

GOTO 9999

 

N9993

#3000=3(INVALID FEEDRATE!)

GOTO 9999

 

N9994

#3000=4(INVALID PECK VALUE!)

GOTO 9999

 

N9995

#3000=5(INVALID R CLEARANCE!)

GOTO 9999

 

N9996

#3000=6(INVALID PIVOT LENGTH!)

GOTO 9999

 

N9997

#3000=7(INVALID TOOL GAGE LENGTH!)

GOTO 9999

 

N9998

#3000=8(INVALID CHIP CLEARANCE!)

GOTO 9999

 

N9999 (END MACRO - FAIL)

M30

%

  • Like 1
Link to comment
Share on other sites
Guest MTB Technical Services

+10000000000

 

Tim is an inspiration for the new generation, like me!

 

Thanks bro!

 

I appreciate the sentiment but you're not to bad yourself. :-)

Link to comment
Share on other sites
Guest MTB Technical Services

Tim think we can make a drill cycle that would output the Call for the Macro?

 

Absolutely!

 

There are enough Custom Drill Cycle Parameters to handle the arguments.

Maybe use a Misc Integer as a Flag depending on desired customization.

 

Normally, I'd convert this to a Custom G-Code with a Modal Call for the benefit of the operator.

It's been my experience they are more comfortable with a dedicated G-Code Call vs a G65 Macro Call.

  • Like 1
Link to comment
Share on other sites
Absolutely!

 

There are enough Custom Drill Cycle Parameters to handle the arguments.

Maybe use a Misc Integer as a Flag depending on desired customization.

 

Normally, I'd convert this to a Custom G-Code with a Modal Call for the benefit of the operator.

 

It's been my experience they are more comfortable with a dedicated G-Code Call vs a G65 Macro Call.

 

Tim this would be a cool project.

 

Not sure how aggregate defined in the Machine and Control definition would work with this, but would be a great addition to Mastercam post to map all of this and make something people could use.

Link to comment
Share on other sites
Guest MTB Technical Services

Tim this would be a cool project.

 

Not sure how aggregate defined in the Machine and Control definition would work with this, but would be a great addition to Mastercam post to map all of this and make something people could use.

 

 

I think so too.

 

This would be a good one to get Colin involved with.

Link to comment
Share on other sites
Guest MTB Technical Services

Tim this is really and easy drill op. Let me put something together and see how it turns out.

 

Cool!

 

This could really be a solution for a lot of users. :thumbup:

Link to comment
Share on other sites
  • 5 years later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.

Join us!

eMastercam - your online source for all things Mastercam.

Together, we are the strongest Mastercam community on the web with over 56,000 members, and our online store offers a wide selection of training materials for all applications and skill levels.

Follow us

×
×
  • Create New...