Hello Guest it is March 29, 2024, 02:50:18 AM

Author Topic: Macro within Macro?  (Read 4730 times)

0 Members and 1 Guest are viewing this topic.

Macro within Macro?
« on: June 28, 2007, 08:57:11 PM »
I suspect this has been covered before, but searching the forum for 'macro' pulls pretty much every thread and I couldn't find the answer; so please pardon my redundancy.  Is it possible to call a macro from within a macro?  Specifically, the problem I'm having is that if I run a macro or a button script, M3 & M4 commands won't work.  M5 does, oddly enough, but not M3 or M4.  Also, if I use LoadRun() to call a part program from the macro or button script, the M3 and M4 commands won't work within the part program either.  Am I doing something wrong or can I just not call a macro from within a VB script?  Is there a workaround for this?

Thanks,
Rachael :)

Offline poppabear

*
  • *
  •  2,235 2,235
  • Briceville, TN, USA
    • View Profile
Re: Macro within Macro?
« Reply #1 on: June 28, 2007, 11:20:19 PM »
Hey Rachael,

   It is NOT recommended that you call a macro from within a macro, (with perhaps the exception of the ones you mentioned).

In your button, or in your code call the M3 and M4 like this:

Code "M3"

or

Code "M4"

Poppa
fun times
Re: Macro within Macro?
« Reply #2 on: June 29, 2007, 07:35:40 AM »
Hi Poppa,

Thanks for the reply.  The problem I'm having is that the exact syntax you just listed does not work from within a VB button script or from within a macro.  It is simply ignored.  If my VB calls a part program, M3 is ignored in the part program as well.  The only way I've been able to make my VB script turn on the spindle is with DoOEMButton(169), which simulates a press of the spindle button.  That works for the VB script, but I need a way to do it from within the part program that is called by the VB.  Any ideas?

Thanks for the help,
Rachael :)

Offline Graham Waterworth

*
  • *
  •  2,668 2,668
  • Yorkshire Dales, England
    • View Profile
Re: Macro within Macro?
« Reply #3 on: June 29, 2007, 08:13:15 AM »
Try using M codes higher than 200, eg M201

Graham.
Without engineers the world stops
Re: Macro within Macro?
« Reply #4 on: June 29, 2007, 08:17:09 AM »
So basically, you're saying to make a new macro called M201.m1s or the like and make the contents

DoSpinCW()

Then call that from the part program with M201.  Interesting idea - I'll give it a try.  Thank you!

Offline poppabear

*
  • *
  •  2,235 2,235
  • Briceville, TN, USA
    • View Profile
Re: Macro within Macro?
« Reply #5 on: June 29, 2007, 11:48:28 AM »
The following code works perfect in mine from a button or a script:

code "M3 S2000"

code "M4 S500"

Perhaps redownload the latest release.......

I have used the above code, Mostly the M3, M4, and M5 in numerous screens and codes, for a very long time, with out issues.........

Scott

fun times
Re: Macro within Macro?
« Reply #6 on: June 29, 2007, 12:01:24 PM »
I've got the latest release, but maybe adding the S word makes a difference.  I think the problem was that my script was calling a part program, but not ending the script.  I had the script in a while loop waiting for the part to finish, so calling M3 became a situation of calling a macro from within a macro.  I modified the script so that it ends after starting the part program, so now the M3 inside the part program works fine.  This seems to be the best resolution, so I'm going to go with that solution for now.  Thanks for the help!