Results 1 to 8 of 8

Thread: VBA Scripting Basics 102 (How to modify M3/m4 Macros?)

  1. #1
    Registered
    Join Date
    Dec 2003
    Location
    UK
    Posts
    218
    Downloads
    0
    Uploads
    0

    VBA Scripting Basics 102 (How to modify M3/m4 Macros?)

    I want my oil pump to come on when my spindle does (but for now wish to retain independant control so i can run the oilpump without the spindle should I chose)

    I thought I could to this quite easily by adding 'enableoutout whatever' to the M3 and M4 macros however this stops them working at all, presumably because they are making a function call rather than running code directly.

    So my question is , how can my make my lube pump output enable when the spindle is enabled in either direction and disable when the spindle is disabled without hardwiring it to the same physical output pin?
    Dom
    http://www.ukrobotics.com/projects


  2. #2
    Community Moderator ger21's Avatar
    Join Date
    Mar 2003
    Location
    Shelby Twp, MI....USA
    Posts
    22,306
    Downloads
    0
    Uploads
    0
    Use the macropump. Just check when the spindle outputs are active, and turn on your pump.

    I just checked, and I can get coolant to come on by modifying the M3macro to

    DoSpinCW()
    Code"M7"

    Maybe if you create a new macro to turn on your oil and call that macro. Use, say, M777 and change M3 to:

    DoSpinCW()
    Code"M777"

    It should work.

    What does your code look like?
    Gerry

    Mach3 2010 Screenset
    http://home.comcast.net/~cncwoodworker/2010.html

    (Note: The opinions expressed in this post are my own and are not necessarily those of CNCzone and its management)


  3. #3
    Registered
    Join Date
    Dec 2003
    Location
    UK
    Posts
    218
    Downloads
    0
    Uploads
    0
    I added ActivateSignal(OUTPUT2) to my M3 macro file which didnt work.

    I'll try your Code"M7" approach instead.
    Dom
    http://www.ukrobotics.com/projects


  4. #4
    Community Moderator ger21's Avatar
    Join Date
    Mar 2003
    Location
    Shelby Twp, MI....USA
    Posts
    22,306
    Downloads
    0
    Uploads
    0
    Did you hit "Enter" after that line?

    DoSpinCW()
    ActivateSignal(Output3)

    worked for me??


    If you don't type "Enter" after the last line, Mach won't read it.
    Gerry

    Mach3 2010 Screenset
    http://home.comcast.net/~cncwoodworker/2010.html

    (Note: The opinions expressed in this post are my own and are not necessarily those of CNCzone and its management)


  • #5
    Community Moderator ger21's Avatar
    Join Date
    Mar 2003
    Location
    Shelby Twp, MI....USA
    Posts
    22,306
    Downloads
    0
    Uploads
    0
    You are using M3 to turn on the spindle, and not just clicking on a "spindle on" button?

    Because it'll only work when an actual M3 is called.
    Gerry

    Mach3 2010 Screenset
    http://home.comcast.net/~cncwoodworker/2010.html

    (Note: The opinions expressed in this post are my own and are not necessarily those of CNCzone and its management)


  • #6
    Registered
    Join Date
    Dec 2003
    Location
    UK
    Posts
    218
    Downloads
    0
    Uploads
    0
    Yes I was.

    I actually got an error message saying something about an invalid command or something. So it was running my code just not liking it.

    I had each instruction on a separate line but whether I explicitly pressed enter I cant remember. I'll have anohter play tomorrow and see what I find.
    Dom
    http://www.ukrobotics.com/projects


  • #7
    Registered PoppaBear10's Avatar
    Join Date
    Feb 2005
    Location
    usa
    Posts
    488
    Downloads
    0
    Uploads
    0
    Do this, it will make your life easier........

    you can do it in Brians, or Macropump, example for each listed.

    Brian:
    Open up "Brain Editor"

    put this in your brain:
    OemLED(11)->NoOp->OUTPUT(2)
    Save as, pumpbrain, goto brain control, reload all brians, find yournew one, enable it, and your up.

    MacroPump:

    if GetOEMLED(11) then 'this LED is on anytime the spindle is running Cw/ccw.
    ActivateSignal(OUTPUT2)
    else
    DeActivateSignal(OUTPUT2)
    end if

    ///////// in both of the above examples you dont have to modify your M3 or M4 or M5 at all.

    scott
    Commercial Mach3: Screens, Wizards, Plugins, Brains,PLCs, Macros, ATC's, machine design/build, retrofit, EMC2, Prototyping. http://sites.google.com/site/volunteerfablab/


  • #8
    Registered
    Join Date
    Dec 2003
    Location
    UK
    Posts
    218
    Downloads
    0
    Uploads
    0
    Thanks for all the different suggestions. I think ger21 hit the nail on the head with the pressing enter comment.

    I tried editing m3/m4/m5 again and made sure I pressed enter after each line and all of a sudden it worked.

    Amazing how so often its the simplest things which cause the biggest fustrations.
    Dom
    http://www.ukrobotics.com/projects


  • Similar Threads

    1. VB Scripting 101
      By UKRobotics in forum Screen Layouts, Post Processors & Misc
      Replies: 12
      Last Post: 05-18-2009, 07:04 AM
    2. Need Help with Basics of Macros
      By johnpiero in forum G-Code Programing
      Replies: 6
      Last Post: 06-24-2008, 07:36 PM
    3. Scripting reference...
      By kiwichris in forum NCPlot G-Code editor / backplotter
      Replies: 5
      Last Post: 11-15-2007, 04:36 PM
    4. modify drill macros
      By Karl_T in forum CamSoft Products
      Replies: 2
      Last Post: 11-18-2005, 11:10 AM
    5. Scripting
      By Klox in forum BobCad-Cam
      Replies: 29
      Last Post: 10-02-2003, 11:11 PM

    Posting Permissions


     


    About CNCzone.com

      We are the largest and most active discussion forum from DIY CNC Machines to the Cad/Cam software to run them. The site is 100% free to join and use, so join today!

    Follow us on

    Facebook Dribbble RSS Feed


    Search Engine Friendly URLs by vBSEO ©2011, Crawlability, Inc.