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 Help


GoetzInd
 Share

Recommended Posts

Hey Guys,

I am writing a backup tool macro for our machines that don't have built in tool management. What I am trying to do is ad an H variable that will re-run a certain part of a program (Defined line number) after a tool has been checked broken and replaced. My question is, how can I loop back into the main program using a GOTOn command in the macro? Is it possible? Thanks,

for any suggestions.

 

Mike

Link to comment
Share on other sites

You can't use a GOTO with a destination outside of the program the GOTO is in. What you can do is set a variable that indicates a broken tool, was detected and then use that variable back in your main program do make a decision. IE

 

Inside broken tool detection macro at the end

[iF **** NE $] GOTO1000 (**** NE $ = the system variable for broken tool, this will vary by MTB)
#100=1
N1000 
M99

 

 

Inside main part program where you call your broken tool detection macro

G65 P98**  (BROKEN TOOL CHECK MACRO)
[iF #100 EQ 1] GOTO[#****] (GOTO ****  = variable of tool in spindle to go to tool change line so it changes to replacement tool)

Link to comment
Share on other sites
You can't use a GOTO with a destination outside of the program the GOTO is in. What you can do is set a variable that indicates a broken tool, was detected and then use that variable back in your main program do make a decision. IE

 

That's already the direction I figured I'd have to go. I was trying to avoid any change to existing programs but it's not a big deal. Thanks guys.

 

Mike

Link to comment
Share on other sites

Hey Guys,

I am writing a backup tool macro for our machines that don't have built in tool management. What I am trying to do is ad an H variable that will re-run a certain part of a program (Defined line number) after a tool has been checked broken and replaced. My question is, how can I loop back into the main program using a GOTOn command in the macro? Is it possible? Thanks,

for any suggestions.

 

Mike

 

 

If you are just trying to jump to a specific location, try M99 P###, where ### is the "N" number to jump to.

 

I re-read you post, what I described above would only work from the same program. What you could do, in your subprogram if an error is detected, set a flag in a local variable, then test the flag in your main program and jump accordingly

Link to comment
Share on other sites

here is what I have done in the past, at the end of each tool, before I do a broken tool check, I write to a macro number:

Example:

 

N100T1 M6

CODE

'

'

'

'

'

'

#600=100

(BROKEN TOOL CHECK)

 

At the beginning of the sub have a goto statement: goto#600

that way when a tool is broken it will go to the tool that just ran.

At the end of the sub write #600=1 so that when it goes into the sub it will start at the top of the program.

 

If a tool comes up mulitple times this can be benificial because you can specify which instance of the tool broke.

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