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:

Macro B question


Recommended Posts

I haven't used Macro B to do this before and getting Format error.

Just want to take the 2 results of 2 z probe cycles and compare them. If the part is flat within .0015 we are good, if not restart prog.

At the moment I have:

#5223 - #5263 = #101

ABS [#101]

IF #101 LT 0.0015 

#3006 = 110 (CONFIRM LOAD)

IF #101 GE 0.0015 

#3006 = 111 (CHECK LOAD RESTART PROGRAM)

Am I allowed to use the parameters directly like this or do I need to assign them to variables first?

Link to comment
Share on other sites

also you need to put the ABS on the same line as your IF statement. IF ABS[#101] LT.0015 GOTO you need to tell it it what you want it to do if the statement if true or false. 

Should be something like this:

#101=#5223-#5263

IF ABS[#101] LT.0015 GOTO1

IF ABS[#101]GE.0015 GOTO2

N1#3006 = 110 (CONFIRM LOAD)

GOT3

N2#3006 = 111 (CHECK LOAD RESTART PROGRAM)

N3

 

#5223 - #5263 = #101

ABS [#101]

IF #101 LT 0.0015 

#3006 = 110 (CONFIRM LOAD)

IF #101 GE 0.0015 

#3006 = 111 (CHECK LOAD RESTART PROGRAM)

 

 

Link to comment
Share on other sites
2 hours ago, jlw™ said:

well he hasn't come back, maybe between the two of us we helped him

 

1 hour ago, Matthew Hajicek™ - Conventus said:

I'd do it as 

5 hours ago, specv said:

also you need to put the ABS on the same line as your IF statement

Don't worry guys, haven't forgotten you..... I'm just waiting for a "break in play" at the machine to try it out.  We are in "end of year hell" here so I don't want to disrupt production. At the moment we have our top machinist on it so he's just monitoring the offset page. Want to put the macro in for the "newbs".

And its a Fanuc (18 if my memory serves) based Mori 503 III control.

Will report back AM

Link to comment
Share on other sites

Morning Gentlemen,

Firstly thanks for the responses. I'm just about to get Productivity + in mastercam set up so I will be doing a lot of this. Mainly offset setting and testing to start, so I appreciate all the different approaches. Kinda like MC itself, always more than one way to skin the cat. Just need to figure out the "style" which suits our shop best.

Using specv's code I now get a :

"can't find address" alarm

Will try cncchipmakers version

Link to comment
Share on other sites
10 minutes ago, cncchipmaker said:

You have the right idea but  your syntax should be in this format:

I think you got a double paste? Maybe I'm wrong, should it be

 

IF[#101LT.0015]THEN#3006=111(CONFIRM LOAD)

IF #101 GE 0.0015

#3006 = 111 (CHECK LOAD RESTART PROGRAM)

or,

IF[#101GE.0015]THEN#3006=111(CHECK LOAD RESTART PROGRAM)

IF #101 LT 0.0015

#3006 = 111 (CONFIRM LOAD)

Link to comment
Share on other sites
21 hours ago, specv said:

#101=#5223-#5263

IF ABS[#101] LT.0015 GOTO1

IF ABS[#101]GE.0015 GOTO2

N1#3006 = 110 (CONFIRM LOAD)

GOT3

N2#3006 = 111 (CHECK LOAD RESTART PROGRAM)

N3

 

1 hour ago, cncchipmaker said:

IF[#101GE.0015]THEN#3006=111(CHECK LOAD RESTART PROGRAM)

 

IF #101 GE 0.0015

#3006 = 111 (CHECK LOAD RESTART PROGRAM)

So I am getting Can't Find Address on both of these.

I used :

#101 = #5223 - #5263

ABS[#101]

IF[#101GE.0015]THEN#3006=111(CHECK LOAD RESTART PROGRAM)

IIF[#101LT.0015]THEN#3006=110(CONFIRM LOAD)

version of cncchipmakers syntax. Still getting address alarm.

Link to comment
Share on other sites
52 minutes ago, jlw™ said:

I think when you call a specific message like =111 it has to be stored in a specific text file in a specific directory.  You can set #3006=1 and use any message you want in ().

That would definitely explain the Address Not found error. Will try at next opportunity, appreciate the help.

I have the Smit and Sinha books. I guess my Holiday reading is taken care of......

Link to comment
Share on other sites
10 minutes ago, nickbe10 said:

That would definitely explain the Address Not found error. Will try at next opportunity, appreciate the help.

I have the Smit and Sinha books. I guess my Holiday reading is taken care of......

#3000=1 should work for you too. This is what we use in the shop all of our programs.

Edited by cncchipmaker
not enough info
Link to comment
Share on other sites

#101 = #5223 - #5263

ABS[#101]

IF[#101GE.0015]THEN#3006=1(CHECK LOAD RESTART PROGRAM)

IIF[#101LT.0015]THEN#3006=1(CONFIRM LOAD)

Still gives address not found. Have I got the code right here? I can certainly see how this would work

 

 

#101 = #5223 - #5263

IF ABS[#101] LT.0015  GOTO1

IF ABS[#101] GE.0015  GOTO2

N1#3006 = 1 (CONFIRM LOAD)

GOTO2

N2#3006 = 1(CHECK LOAD RESTART PROGRAM)

N3

Now gone back to Format error. I can also see how this should work......

Link to comment
Share on other sites
28 minutes ago, nickbe10 said:

#101 = #5223 - #5263

ABS[#101]

IF[#101GE.0015]THEN#3006=1(CHECK LOAD RESTART PROGRAM)

IIF[#101LT.0015]THEN#3006=1(CONFIRM LOAD)

Still gives address not found. Have I got the code right here? I can certainly see how this would work

 

 

#101 = #5223 - #5263

IF ABS[#101] LT.0015  GOTO1

IF ABS[#101] GE.0015  GOTO2

N1#3006 = 1 (CONFIRM LOAD)

GOTO2

N2#3006 = 1(CHECK LOAD RESTART PROGRAM)

N3

Now gone back to Format error. I can also see how this should work......

I know what you are doing wrong now. The ABS[#101] needs to be #101=ABS[#101].  You have to assign a variable when you are using the absolute function in this way.

Link to comment
Share on other sites
15 minutes ago, specv said:

try this:

#101 = #5223 - #5263

IF [ABS[#101] LT.0015]  GOTO1

IF [ABS[#101] GE.0015]  GOTO2

N1#3006 = 1 (CONFIRM LOAD)

GOTO3

N2#3006 = 1(CHECK LOAD RESTART PROGRAM)

N3

Bingo. :cheers:     I get it , it was how it was jumping. I need to work on my flow chart skills too.........:coffee:

Now on to cncchipmakers version, I get that one too.......

Link to comment
Share on other sites
21 minutes ago, cncchipmaker said:

I think it was because you added brackets in the IF THEN statements.

I think on specvs it was a re arrangement of the GOTO lines.

However, made the change on yours and:

Double Bingo.:cheers: With one caveat, it gave a PLC alarm with no message on the PLC alarm page. This instantly cleared with an MDI M30.

Maybe it was just a hang up. I will try adding a GOTO2 line at the end to return it to the program, The next line in the program is N2 M6 T2.

Link to comment
Share on other sites

So:  result on left, calculation on right (jlw pointed this one out right from the get go), result on the left, calculation on the right......

Thanks to everyone for their input. ALL good stuff, what the forums all about.......

I will be printing out the whole thread for my studies:coffee:

And again:cheers:!!

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