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:

Recommended Posts

Guest MTB Technical Services


%

O1234(TEST MACRO)

G00 G17 G20 G40 G49 G80 G90 G94 G98

G91 G28 Z0.0

T01 M06 (0.5 DIA ENDMILL)

G00 G90 G54 X11.0 Y-3.0 S4500 M03

G43 H01 Z1.0 M08

(6.0 X 4.0 X 1.0 POCKET)

G65 P3334 X6.0 Y4.0 Q0.25 S50.0 T0.5 R0.1 Z0.0 E-1.0 F20.0

M05

M09

G00 G91 G28 Z0.0

M30

 

O3334(ROUGH POCKET)

(ABSOLUTE MACRO)

(MUST HAVE START HOLE IN CENTER)

(PROVEN ON NC PLOT ONLY)

 

(FORMAT G65/G66 XYQSTRZEF)

(#24= X - X DIMENSION)

(#25= Y - Y DIMENSION)

(#17= Q - STEPOVER IN Z/ DOC)

(#19= S - STEPOVER IN XY/ PERCENTAGE)

(#20= T - TOOL DIAMETER)

(#18= R - PLANE)

(#26= Z - Z START/ TOP OF STOCK)

(#8=  E - END OF POCKET IN Z)

(#9=  F - FEEDRATE)

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

 

IF[[#24*#25*#17*#19*#20*#8*#9]EQ0]GOTO1000

(CALCULATE DOC IN Z)

#100=ABS[#26]-ABS[#8]

#100=ABS[#100]

IF[[#26*#8]GE0]GOTO1

#100=ABS[#26]+ABS[#8]

N1#101=ROUND[#100/#17]

#102=#100/#101

IF[#102GT[#100/2.]]THEN#102=#100

(CALCULATE DOC IN X)

#103=[#19*.01]*#20

#104=[#24/2.]-[#20/2.]

#105=ROUND[#104/#103]

#106=#104/#105

IF[#106GT[#104/2.]]THEN#106=#104

(CALCULATE DOC IN Y)

#107=[#19*.01]*#20

#108=[#25/2.]-[#20/2.]

#109=ROUND[#108/#107]

#110=#108/#109

IF[#110GT[#108/2.]]THEN#110=#108

(STORE POSTIONS AND GO TO Z START)

#111=#5001

#112=#5002

#114=#112

#115=#111

#116=#112

#117=#111

G0G90X#111Y#112

Z[#26+.1]

G1Z#26F#9

#113=#5003-#102

#120=#105

IF[#120LT#109]THEN#120=#109

#125=#105

#129=#109

#130=#120

WHILE[#101GE1.]DO1

IF[#101EQ0]GOTO10

#101=#101-1.

G90G1Z#113F#9

WHILE[#120GE1.]DO2

IF[#120EQ0]GOTO100

(CALCULATE TOOL PATH)

IF[#109LE0]GOTO20

#114=#114+#110

N20

IF[#105LE0]GOTO30

#115=#115-#106

N30

IF[#109LE0]GOTO40

#116=#116-#110

N40

IF[#105LE0]GOTO50

#117=#117+#106

N50

(CUT POCKET)

G1G90Y#114F#9

X#115

Y#116

X#117

Y#114

X#111

(DOWN COUNT)

#105=#105-1.

#109=#109-1.

#120=#120-1.

END2

N100

#105=#125

#109=#129

#114=#112

#115=#111

#116=#112

#117=#111

#120=#130

X#111Y#112

#113=#113-#102

END1

N10

X#111Y#112

Z#18

M99

 

N1000

#3000=1(DATA LACKING!)

M30

%

 

  • Like 1
Link to comment
Share on other sites
This was requested through a personal message. I am going to have to go through all of my unproven programs for you guys. 

 

O1111(FACE MILL MACRO)

(STARTS AT UPPER LEFT CORNER)

(BASED ON X0Y0 MIDDLE OF STOCK)

(IF YOU WANT TO COMPLETELY EXIT)

(OFF STOCK FOR FINISH MAKE YOUR)

(E VARIABLE BIGGER THAN TOOL DIAMETER)

(PROVEN ON NC PLOT ONLY) 

 

(FORMAT G65/G66 QTXYSEZWRF)

(Q = #17 - STEPOVER IN Z/ DOC)

(T = #20 - TOOL DIAMETER)

(X = #24 - MATERIAL SIZE -X-)

(Y = #25 - MATERIAL SIZE -Y-)

(S = #19 - STEPOVER PERCENTAGE) 

(E = #8  - EDGE HANGOVER AMOUNT)

(Z = #26 - Z ZERO/TOP OF STOCK)

(W = #23 - END Z)

(R = #18 - CLEARANCE PLANE)

(F = #9  - FEEDRATE)

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

(CALCULATE Y STEPOVER AMOUNT)

#100=[#19*.01]*#20

(STORE X AND Y ABSOLUTES)

#101=#5001

#102=#5002

(CALCULATE # OF PASSES)

#103=#25+[#20-#100]

#104=FUP[#103/#100]

#114=#104

(CALCULATE PATTERN)

(CLEARANCE POSITION X LEFT)

#105=#101-[[#24/2.]+1.]

#105=#105-[#20/2.]

(CLEARANCE POSITION X RIGHT)

#106=#101+[[#24/2.]+1.]

#106=#106+[#20/2.]

(HANGOVER POSTION X LEFT)

#115=#101-[[#24/2.]+#8]

#115=#115+[#20/2.]

(HANGOVER POSTION X RIGHT)

#116=#101+[[#24/2.]+#8]

#116=#116-[#20/2.]

(Y INITIAL START)

#107=#102+[[#25/2.]+[#20-#100]]

#107=#107-[#20/2.]

(CALCULATE Z STEPOVER)

#120=ABS[#26]-ABS[#23]

#120=ABS[#120]

IF[[#26*#23]GE0]GOTO1

#120=ABS[#26]+ABS[#23]

N1#121=ROUND[#120/#17]

#122=#120/#121

IF[#122GT[#120/2.]]THEN#122=#120

(RAPID TO MIDDLE OF STOCK)

G0G90X#101Y#102

(GOTO INITIAL CLEARANCE PLANE)

(UPPER LEFT CORNER)

X#105Y#107

Z[#26+.1]

G1Z#26F#9

#123=#5003-#122

(CUT FACE)

WHILE[#121GE1.]DO1

IF[#121EQ0]GOTO1001

G1Z#123F#9

#121=#121-1.

WHILE[#104GE1.]DO2

IF[#104LT1.]GOTO10

#104=#104-1.

G90G1X#116

IF[#104LT1.]GOTO10

G91Y-#100

#104=#104-1.

G90G1X#115

IF[#104LT1.]GOTO10

G91Y-#100

END2

N10

#104=#114

(EXIT OFF STOCK)

IF[#5001GT#101]GOTO100

G90G1X#105

GOTO1000

N100

G90G1X#106

N1000

G0Z[#123+.1]

X#105Y#107

#123=#123-#122

END1

N1001G0Z#18

X#101Y#102

M99

Link to comment
Share on other sites

 

OK, I think I got it. Please give me any feedback that you can.
 
O3334(ROUGH POCKET)
(ABSOLUTE MACRO)
(MUST HAVE START HOLE IN CENTER)
(PROVEN ON NC PLOT ONLY)
 
(FORMAT G65/G66 XYQSTRZEF)
(#24= X - X DIMENSION)
(#25= Y - Y DIMENSION)
(#17= Q - STEPOVER IN Z/ DOC)
(#19= S - STEPOVER IN XY/ PERCENTAGE)
(#20= T - TOOL DIAMETER)
(#18= R - PLANE)
(#26= Z - Z START/ TOP OF STOCK)
(#8=  E - END OF POCKET IN Z)
(#9=  F - FEEDRATE)
(*********************************)
 
IF[[#24*#25*#17*#19*#20*#8*#9]EQ0]GOTO1000
(CALCULATE DOC IN Z)
#100=ABS[#26]-ABS[#8]
#100=ABS[#100]
IF[[#26*#8]GE0]GOTO1
#100=ABS[#26]+ABS[#8]
N1#101=ROUND[#100/#17]
#102=#100/#101
IF[#102GT[#100/2.]]THEN#102=#100
(CALCULATE DOC IN X)
#103=[#19*.01]*#20
#104=[#24/2.]-[#20/2.]
#105=ROUND[#104/#103]
#106=#104/#105
IF[#106GT[#104/2.]]THEN#106=#104
(CALCULATE DOC IN Y)
#107=[#19*.01]*#20
#108=[#25/2.]-[#20/2.]
#109=ROUND[#108/#107]
#110=#108/#109
IF[#110GT[#108/2.]]THEN#110=#108
(STORE POSTIONS AND GO TO Z START)
#111=#5001
#112=#5002
#114=#112
#115=#111
#116=#112
#117=#111
G0G90X#111Y#112
Z[#26+.1]
G1Z#26F#9
#113=#5003-#102
#120=#105
IF[#120LT#109]THEN#120=#109
#125=#105
#129=#109
#130=#120
WHILE[#101GE1.]DO1
IF[#101EQ0]GOTO10
#101=#101-1.
G90G1Z#113F#9
WHILE[#120GE1.]DO2
IF[#120EQ0]GOTO100
(CALCULATE TOOL PATH)
IF[#109LE0]GOTO20
#114=#114+#110
N20
IF[#105LE0]GOTO30
#115=#115-#106
N30
IF[#109LE0]GOTO40
#116=#116-#110
N40
IF[#105LE0]GOTO50
#117=#117+#106
N50
(CUT POCKET)
G1G90Y#114F#9
X#115
Y#116
X#117
Y#114
X#111
(DOWN COUNT)
#105=#105-1.
#109=#109-1.
#120=#120-1.
END2
N100
#105=#125
#109=#129
#114=#112
#115=#111
#116=#112
#117=#111
#120=#130
X#111Y#112
#113=#113-#102
END1
N10
X#111Y#112
Z#18
M99
N1000
M00(DATA LACKING)

 

Hello! I tried your program pocket and face mill and they work- Thank you!

In one line was a mistake Z# 26 + .1 need Z[# 26 + .1]

Link to comment
Share on other sites

I got asked at work if I knew how to probe a flat surface and have the control figure out the adjustment to update the axis offset so the surface is flat.

 

I understand the basic concept of how to achieve this, but I lack the experience to wrap my head around the logic that needs to be written for something like this.

 

This is for a NMV to allow us to prove the A-axis flat instead of indicate the surfaces while setting up the part. Any help or general direction someone can point me to would be great. I don't run this machine, but it's a good opportunity to start learning it.

Link to comment
Share on other sites

I got asked at work if I knew how to probe a flat surface and have the control figure out the adjustment to update the axis offset so the surface is flat. I understand the basic concept of how to achieve this, but I lack the experience to wrap my head around the logic that needs to be written for something like this. This is for a NMV to allow us to prove the A-axis flat instead of indicate the surfaces while setting up the part. Any help or general direction someone can point me to would be great. I don't run this machine, but it's a good opportunity to start learning it.

Usually when you have a probe it will come with macros already built into it to square up A axis. For instance here at work we use a O9917 which is custom for our use. If you want to write your own macro you could use this general guide and this would be for a horizontal:

 

1st probe hit Z: X+ direction and then store position into variable #600

2nd probe hit Z: X- direction and then store position into variable #601

Run Macro:

 

#602=[#601-#600]/2.

#603=ATAN[#602]/[width of X total distance divided by 2.]

IF[#603GT180.]THEN#603=#603-360.

(Update G54 A)

#5224=#5224+#603

 

Note: If A goes the wrong direction subtract #603 from #5224

#5224 is the system variable for G54 A on a Fanuc and Haas controls.

Link to comment
Share on other sites

Usually when you have a probe it will come with macros already built into it to square up A axis. For instance here at work we use a O9917 which is custom for our use. If you want to write your own macro you could use this general guide and this would be for a horizontal:

 

1st probe hit Z: X+ direction and then store position into variable #600

2nd probe hit Z: X- direction and then store position into variable #601

Run Macro:

 

#602=[#601-#600]/2.

#603=ATAN[#602]/[width of X total distance divided by 2.]

IF[#603GT180.]THEN#603=#603-360.

(Update G54 A)

#5224=#5224+#603

 

Note: If A goes the wrong direction subtract #603 from #5224

#5224 is the system variable for G54 A on a Fanuc and Haas controls.

Or you run Renishaw's 2 line cycle... ;)

Link to comment
Share on other sites

I'll try to take a look tomorrow at the NMV to see what cycles are where on that thing. It's not a machine I run or deal with. The guy who does asked me if I worked with Macros and could help. Told him I knew just the place to ask questions and hopefully get steered in the right direction.

 

Thank you for pointing me in the correct direction.

Link to comment
Share on other sites
  • 2 weeks later...

My newest macro. This is the version of the ID cone macro but with an adjustable lead-in radius programmed into it. Have Fun!

 

O6888(CUT 0-180 DEG ID TAPER)
(ABSOLUTE AND INCREMENTAL SURFACING MACRO)
(PROVEN ON NC PLOT ONLY)

(FORMAT G65/G66 AQUDTSRZEF)
(A = #1  - INCLUDED ANGLE OF PART FROM BOTTOM)
(Q = #17 - STEPOVER IN Z/ CUSP HEIGHT)
(U = #21 - ARC LEAD IN RADIUS)
(D = #7  - TOOL DIAMETER)
(T = #20 - TOOL RADIUS/ BALL OR BULL)
(S = #19 - PART ID/ TOP)
(R = #18 - R PLANE)
(Z = #26 - Z START ZERO)
(E = #8  - END OF TOOL POSITION IN Z)
(F = #9  - FEEDRATE)
(***********************************)

#100=ABS[#26]-ABS[#8]
#100=ABS[#100]
IF[[#26*#8]GE0]GOTO1
#100=ABS[#26]+ABS[#8]
N1#101=ROUND[#100/#17]
#102=#100/#101
IF[#102GT[#100/2]]GOTO1000
#103=#5001
#105=#5002
#113=#105
#115=0
IF[#7EQ[#20*2]]GOTO10
#105=#105-[[#7/2]+#20]
#115=#115-[[#7/2]+#20]
N10#105=#105+[#19/2]
#115=#115+[#19/2]
#125=90.+[#1/2]
#105=#105-[#20/TAN[#125/2]]
#115=#115-[#20/TAN[#125/2]]
#107=#105-#21
G0G90X#103Y#107
Z[#26+.1]
G1Z#26F#9
WHILE[#101GE0]DO1
IF[#101LT0]GOTO100
#101=#101-1.
G90G1G41X[#103+#21]F#9
G03X#103Y#105I-[#21]
J-#115
X[#103-#21]Y#107J-[#21]
G1G40X#103
#105=#105-[TAN[#1/2]*#102]
#115=#115-[TAN[#1/2]*#102]
#107=#105-#21
G91G1Z-[#102]
G90Y#107
END1
N100G0G90Z#18
X#103Y#113
M99
N1000#3000= 1( Q VALUE TOO BIG )

Link to comment
Share on other sites
  • 1 month later...

We use macros to automate the indexing and WCS selection for our horizontals and verticals,

as well as T-code,H-code and D-code syncronization.

 

It doesn't matter if there is only 1 part on the fixture or 100 parts, change the value of 1 variable and

the machine will do either 1 part (great for setup) or multiple parts using the exact same code.

 

Using a standardized tool launching macro, we no longer worry about T,H, and D- code syncronization.

Just copy the spindle tools H-offset to an unused location (say 99) and ditto for the D-offset (or use say, 98 or whichever).

Then call up the tool, jump to the macro to copy the offsets , G43 the tool w/ H99 and return to the main program.

Link to comment
Share on other sites

^^^

 

Or the better way to handle offsets is in the Tool Change MACRO, write the tool number into a MACRO variable (#517 for example) then call H#517 D#517 and be done with it. Never have to change and H or D again (or at least VERY rarely). :yes:

Link to comment
Share on other sites

^^^

 

Or the better way to handle offsets is in the Tool Change MACRO, write the tool number into a MACRO variable (#517 for example) then call H#517 D#517 and be done with it. Never have to change and H or D again (or at least VERY rarely). :yes:

True you are.

I used offset 99 to be compatible with machines that were using Fanuc Tool Life Management.

(sorta an ersatx TLM)

Link to comment
Share on other sites
  • 3 weeks later...
Guest MTB Technical Services

Hello to all. Who ever tried to write a macro program as a modal G code? How to do it on Fanuc 0 ?

 

Construct a Modal Macro that can be executed with a G66 Pxxxx and its arguments.

G66 is a Modal Macro Cal.

 

Then assign the program the proper program number so it can be used as a custom G-Code.

Assign the G-Code in the parameter.

 

The syntax would now be your custom G- Code G??? and any argument that were required previously.

However, you MUST cancel it with a G67.

 

Here's one for a Vectored Retract via MDI on a Doosan Mill/Turn.

It's non-modal but would work either way.

It was necessary for any time a power outage or alarm occurs during non-orthogonal drilling ops.

I wrote it for a customer who was having power issues in a new facility and needed it to work from an E-Stop condition.

 

%

O9013 (DOOSAN MX-SERIES G180 VECTORED RETRACT)

(THIS MACRO SUPPORTS A FANUC 31IM SERIES CONTROL)

(SET PARAMETER 6053=180)

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

(G180 PROPER PROGRAMMING SYNTAX)

(THIS MACRO IS DESIGNED TO BE USED FOR RETRACTING)

(ALONG THE TOOL AXIS VECTOR, IF G368 IS NOT ACTIVE)

(AND AN ALARM OR POWER OUTAGE HAS STOPPED THE MACHINE.)

(MDI THE SINGLE LINE BELOW AND PRESS CYCLE START.)

(G180 B-45.0 R6.0 F25.0)

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

(B-45.0 - B AXIS POSITION - REQUIRED)

(R6.0 - RETRACT LENGTH ALONG VECTOR - RADIAL VALUE - REQUIRED)

(F50.0 - UPM FEEDRATE - REQUIRED)

(VERIFY ALL REQUIRED VARIABLES ARE SPECIFIED)

#1=[0.0]

#3=[90.0]

#5=[-90.0]

IF[#2 EQ #0] GOTO 9991

IF[#2 EQ #1] GOTO 9991

IF[#2 EQ #3] GOTO 9991

IF[#2 EQ #5] GOTO 9991

IF[#18 EQ #0] GOTO 9992

IF[#9 EQ #0]  GOTO 9993

(INITIALIZE VALUES TO FORCE ABSOLUTE VALUES)

#9=ABS[#9]

#18=ABS[#18]

(CALCULATE UNIT VECTORS FROM ANGLE)

#4=[COS[#2*[-1.0]]]

#6=[sIN[#2*[-1.0]]]

(RETRACT INCREMENTALLY ALONG VECTOR W/LINEAR INTERPOLATION)

G98 G01 U[[#4*#18]] W[[#6*#18]] F#9

G99

M99

(ALARMS)

N9991 #3000=1(INVALID ANGULAR VALUE - B)

GOTO 9999

N9992 #3000=2(INVALID VECTOR LENGTH - R)

GOTO 9999

N9993 #3000=3(INVALID FEEDRATE - F)

N9999

M30

%

Link to comment
Share on other sites

Construct a Modal Macro that can be executed with a G66 Pxxxx and its arguments.

G66 is a Modal Macro Cal.

 

Then assign the program the proper program number so it can be used as a custom G-Code.

Assign the G-Code in the parameter.

 

The syntax would now be your custom G- Code G??? and any argument that were required previously.

However, you MUST cancel it with a G67.

 

Here's one for a Vectored Retract via MDI on a Doosan Mill/Turn.

It's non-modal but would work either way.

It was necessary for any time a power outage or alarm occurs during non-orthogonal drilling ops.

I wrote it for a customer who was having power issues in a new facility and needed it to work from an E-Stop condition.

 

That's what I mean, it's written in the documentation for Fanuc

post-47580-0-58085000-1442251381_thumb.jpg

But I tried it, but it works not modal.

Link to comment
Share on other sites

^^^

 

Or the better way to handle offsets is in the Tool Change MACRO, write the tool number into a MACRO variable (#517 for example) then call H#517 D#517 and be done with it. Never have to change and H or D again (or at least VERY rarely). :yes:

 

Or you could just get an Okuma that uses the variables HA and DA to match the offsets to the active tool number in the spindle.

Link to comment
Share on other sites
Guest MTB Technical Services

That's what I mean, it's written in the documentation for Fanuc

attachicon.gif1.jpg

But I tried it, but it works not modal.

 

Then you're doing something wrong.

 

You need to set the G-code as negative to be recognized as a modal G-Code.

Link to comment
Share on other sites

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...