Hello Guest it is March 28, 2024, 10:15:14 PM

Author Topic: Macros For Dummies  (Read 7416 times)

0 Members and 1 Guest are viewing this topic.

Macros For Dummies
« on: October 11, 2008, 11:10:42 AM »
How do I create a macro?  I currently use (well, used to use....) brains for the I/F to my crappy pendant.  Since that is no longer working right with SmoothStepper, I want to translate it to a macro instead.  Writing the code is, I think, trivial, but where do I then put it/what else do I have to do to "integrate" it into Mach?

Regards,
Ray L.
Regards,
Ray L.

Online Graham Waterworth

*
  • *
  •  2,668 2,668
  • Yorkshire Dales, England
    • View Profile
Re: Macros For Dummies
« Reply #1 on: October 11, 2008, 12:21:34 PM »
If you want the functions to be live all the time then the macropump is where you will have to add the code.  Open up the vb editor and load it from there.  Make sure the macropump is turned on in config.

Graham
Without engineers the world stops
Re: Macros For Dummies
« Reply #2 on: October 11, 2008, 02:24:23 PM »
Graham,

  Do I save the Macro to a specific place, like the macros/Mach3Mill directory?

Regards,
Ray L.
Regards,
Ray L.

Online Graham Waterworth

*
  • *
  •  2,668 2,668
  • Yorkshire Dales, England
    • View Profile
Re: Macros For Dummies
« Reply #3 on: October 11, 2008, 02:26:36 PM »
If you load it by the VB script editor within Mill or Turn you can just save it back in the same place

Graham
Without engineers the world stops
Re: Macros For Dummies
« Reply #4 on: October 11, 2008, 02:37:15 PM »
Graham,
  Will macros be auto-loaded on start-up, or do they have to be explicitly loaded?
  Also, am I correct in thinking macros run in a separate thread, so we need to be "thread-friendly"?  What I want to do is poll some inputs that correspond to pendant buttons, so I assume the correct way to do that is to request the state of those inputs, take any required action, then do a sleep(100)?  Is there a better way to do this?  Is there any event notrification mechanism (i.e. - when this event (input signal changes state), call this macro function).

Regards,
Ray L.
Regards,
Ray L.

Online Graham Waterworth

*
  • *
  •  2,668 2,668
  • Yorkshire Dales, England
    • View Profile
Re: Macros For Dummies
« Reply #5 on: October 11, 2008, 02:45:28 PM »
If you use the macropump it is run constantly from start up, it is polled about 40 times per second, all calls need to execute and exit as soon as possible to avoid slowing things down.  eg. no counter/delay loops, set pointers and move on, check on the next call.

Remember the macropump will allow silly things to happen if you do not interlock them out with your code.

Graham
Without engineers the world stops
Re: Macros For Dummies
« Reply #6 on: October 11, 2008, 03:42:00 PM »
Graham,

    I seem to be missing something here....  I have the Macro Pump enabled.  I wrote a script that does something inane when the "Machine Coords" LED is lit.  It works fine if I execute from the script editor, but nothing otherwise.  So, I then edited the "Ref All Home" button script.  I made my changes, saved it.  But it never seems to execute - clicking the button seems to do nothing.
    How do I make a macro function that is invoked when and on-screen button is pressed?  How about when a PP input signal changes state?

Regards,
Ray L.
Regards,
Ray L.

Offline Hood

*
  •  25,835 25,835
  • Carnoustie, Scotland
    • View Profile
Re: Macros For Dummies
« Reply #7 on: October 11, 2008, 03:49:54 PM »
Do you have the macropump enabled from General Config page and did you restart Mach when you enabled it as it is loaded on Mach startup only. Also make sure you have the macropump stored in the correct Macro folder (the one for your profile) and lastly I presume you have it named correctly as macropump.m1s
 If none of that helps attach it or  post the VB you have in it.

Hood

Offline poppabear

*
  • *
  •  2,235 2,235
  • Briceville, TN, USA
    • View Profile
Re: Macros For Dummies
« Reply #8 on: October 11, 2008, 08:54:51 PM »
Hate to say this, but I run a smooth stepper also, and my "Brians" work with it............
Perhaps you need to upgrade to the latest Dev version of Mach, and the latest Plugin for the SS??

Scott
fun times
Re: Macros For Dummies
« Reply #9 on: October 11, 2008, 10:02:49 PM »
Hate to say this, but I run a smooth stepper also, and my "Brians" work with it............
Perhaps you need to upgrade to the latest Dev version of Mach, and the latest Plugin for the SS??

Scott


Scott,

   Brains work with SS, but don't like the (stupid) way I implemented my pendant.  Macros give me a better way to do what I wanted to do anyway, and couidn't do with brains alone.

Regards,
Ray L.
Regards,
Ray L.