585,719 active members*
4,162 visitors online*
Register for free
Login
Results 1 to 8 of 8
  1. #1
    Join Date
    Dec 2003
    Posts
    218

    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
    Join Date
    Mar 2003
    Posts
    35538
    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

    UCCNC 2017 Screenset
    http://www.thecncwoodworker.com/2017.html

    Mach3 2010 Screenset
    http://www.thecncwoodworker.com/2010.html

    JointCAM - CNC Dovetails & Box Joints
    http://www.g-forcecnc.com/jointcam.html

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

  3. #3
    Join Date
    Dec 2003
    Posts
    218
    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
    Join Date
    Mar 2003
    Posts
    35538
    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

    UCCNC 2017 Screenset
    http://www.thecncwoodworker.com/2017.html

    Mach3 2010 Screenset
    http://www.thecncwoodworker.com/2010.html

    JointCAM - CNC Dovetails & Box Joints
    http://www.g-forcecnc.com/jointcam.html

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

  5. #5
    Join Date
    Mar 2003
    Posts
    35538
    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

    UCCNC 2017 Screenset
    http://www.thecncwoodworker.com/2017.html

    Mach3 2010 Screenset
    http://www.thecncwoodworker.com/2010.html

    JointCAM - CNC Dovetails & Box Joints
    http://www.g-forcecnc.com/jointcam.html

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

  6. #6
    Join Date
    Dec 2003
    Posts
    218
    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. #7
    Join Date
    Feb 2005
    Posts
    487
    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. #8
    Join Date
    Dec 2003
    Posts
    218
    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, 12:04 PM
  2. Need Help with Basics of Macros
    By johnpiero in forum G-Code Programing
    Replies: 6
    Last Post: 06-25-2008, 12:36 AM
  3. Scripting reference...
    By kiwichris in forum NCPlot G-Code editor / backplotter
    Replies: 5
    Last Post: 11-15-2007, 10:36 PM
  4. modify drill macros
    By Karl_T in forum CamSoft Products
    Replies: 2
    Last Post: 11-18-2005, 05:10 PM
  5. Scripting
    By Klox in forum BobCad-Cam
    Replies: 29
    Last Post: 10-03-2003, 04:11 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •