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:

Help with Fanuc Macro B


Leigh @ Kodiak
 Share

Recommended Posts

I have some macro code that is not behaving as I expect:

N1 G65 P1501 K079 H00 A011 
N2 #6 = [#6 * 10000]
N3 IF [#6 EQ 79] GOTO 41

 

Line N1 sets #6 to 0.0079

Line N2 changes #6 to 79.000 which I visually confirmed.

The program carries straight past N3 and errors out, when this line should be redirecting it to N41

I fixed this by changing N2 as follows:

N2 #6 = ROUND[#6 * 10000]

When looking at the value of #6 visually, the value appears the same as without the ROUND function, so does anybody know what is happening here?

 

Link to comment
Share on other sites

You shouldn't need decimal points.

N1 G65 P1501 K079 H00 A011 
N2 #6 = [#6 * 10000]
N3 IF [#6 EQ 79] GOTO 41

________________________________________

O5013 (8 PART CLUSTERTOWER ROUTER)
 
(-0-)
WHILE[#[#539+600+[7-1]]EQ1]DO1 (SURFACE 1)
IF[#172EQ5002]GOTO113 <<<<<<<<<<<<<<<<<<<<
IF[#172EQ5003]GOTO112 <<<<<<<<<<<<<<<<<<<
IF[#172EQ5006]GOTO112 <<<<<<<<<<<<<<<<<
#900=[#539+[7-1]]
G91 G00 X0 G54 P[#900]
G90 G00 B90.
G2201B90.
G91 G00 X0 G59
M#173 P[#170+1]
GOTO112
END1
N112 G69
WHILE[#[#539+600+[8-1]]EQ1]DO1 (SURFACE 2)
IF[#172EQ5001]GOTO116 <<<<<<<<<<<
IF[#172EQ5002]GOTO113 <<<<<<<<<<<<<
IF[#172EQ5005]GOTO113 <<<<<<<<<<<<<<
#900=[#539+[8-1]]
G91 G00 X0 G54 P[#900]
G90 G00 B90.
G2201B90.
G90 G00 X0 Y0 G59
G68 X0 Y0 R180.
M#173 P[#170+3]
GOTO113
END1

 

blah

blah

blah

N116 G69
WHILE[#[#539+600+[4-1]]EQ1]DO1 (SURFACE 6)
IF[#172EQ5002]GOTO213 <<<<<<<<<<<<<<<<<<<
IF[#172EQ5003]GOTO212<<<<<<<<<<<<<
IF[#172EQ5006]GOTO212<<<<<<<<<<<<<
#900=[#539+[4-1]]
G91 G00 X0 G54 P[#900]
G90 G00 B270.
G2201B270.
G90 G00 X0 Y0 G59
G68 X0 Y0 R180.
M#173 P[#170+1]
GOTO211
END1

Link to comment
Share on other sites

It sounds like to avoid this issue in the future, using decimals is the way to go. I just wish I knew why this was happening, as this program has a couple thousand of the "IF [#6 EQ 79] GOTO 41"   checking for different values, so adding decimals will become quite a task. I also only see this rounding issue with certain numbers, which is even more mystifying.

 

For  those asking, this is a Mori Seki with a MAPPS IV control.

 

Link to comment
Share on other sites

Is Parameter #1604.0 = 1?

At this stage, it is best to not change the decimal behavior by parameter as it may affect other things. Think "Law of Unintended Consequences". Using decimals will be your best bet.

Also, typically when I need to pass arguments I'll use #1-#33 just to grab the values then in my MACRO I store them off from #161-#193 to not lose track or have them change or reset.

Link to comment
Share on other sites
On 10/6/2022 at 11:41 AM, Leigh @ Kodiak said:

It sounds like to avoid this issue in the future, using decimals is the way to go. I just wish I knew why this was happening, as this program has a couple thousand of the "IF [#6 EQ 79] GOTO 41"   checking for different values, so adding decimals will become quite a task. I also only see this rounding issue with certain numbers, which is even more mystifying.

 

For  those asking, this is a Mori Seki with a MAPPS IV control.

 

For many controls, "79" = .0079 in inch mode, or .079 in metric mode.  "79." = 79.0000 or 79.000 respectively.

Link to comment
Share on other sites

I am very limited on my knowledge of Macros, but have found some success over the years. Nothing for nothing in order for my macros to be able to use Goto lines and things that make them jump around they have to be saved on the machines Memory. Thats on Our Mori's with a Fanuc Control. I wasted alot of time testing in MDI and trying to write into programs that ran on DNC just to finally cave and call the Mori apps guy, He told me that I needed to save the macro into the memory and then call them from the program. Kind of how the renshaw macros work. So I tried it and now I seem to have better luck with my macros functioning as expected. This might not apply to you or anyone else but works for me. 

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