585,762 active members*
4,129 visitors online*
Register for free
Login
Results 1 to 9 of 9
  1. #1
    Join Date
    Jun 2014
    Posts
    8

    Custom Macro for Mach3

    I would appreciate some help I want to 'reset' x & y values and Regenerate the toolpath via a macro (I have moved the cutter to a new position ready to cut the next block but I need to reset x &y and regenerate the toolpath before I can continue.
    I have created 3 macros and called them M126 M127 M160
    for instance:-
    M126 macro held in the macros folder of Mach3 (as all three are)
    'Define OEM Codes for Reset X
    Const OEMButtonResetX=1008
    DoOEMButton(OEMButtonResetx)
    Sleep(1000)
    End Sub

    All 3 follow the same situation ie. nothing changes, I have checked both M126 and M127 using VB Editor and the code does for instance reset x and y but when the M126 etc are added to the gcode nothing happens can anyone throw some light on this situation please. When I step through the gcode for my cutting program which includes M126 M127 M16 nothing happens i.e x&Y do not reset just remain containing the value displayed.
    Thanks again

  2. #2
    Join Date
    Mar 2003
    Posts
    35538

    Re: Custom Macro for Mach3

    Are the macros in the Mach3\macros\ folder as you say?
    They need to be in Mach3\macros\yourprofile\
    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
    Jun 2014
    Posts
    8

    Re: Custom Macro for Mach3

    Hi, thanks for your help...I am sure you are on the right track, as i have never set up a profile for mach3. I have now set up a profile name, but I am unsure whether I need to start Mach3 again and remake all my additional files.

  4. #4
    Join Date
    Mar 2003
    Posts
    35538

    Re: Custom Macro for Mach3

    The default profile is Mach3Mill, so your macros should have gone in Mach3\macros\Mach3Mill\
    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
    Jun 2014
    Posts
    8

    Re: Custom Macro for Mach3

    Hi, to be sure I have completely re-loaded Mach3 and input all params etc.
    Have set up a profile which is now in:-
    Mach3\macros\NewCNC\all macros including M126/M127/M128. (My profle is NewCNC) I have re-checcked through Vb Editor and all three macros work via the editor. BUT do not work with simple Gcode program...still at a loss!
    Simple Gcode to Test Only
    N1 (File Name+ Position Check On Switch On)
    N10 G21
    N15 G90
    N20 G0 Z11.0000
    N25 G53 X50.0000 Y100.0000 F900
    N26 M0
    N28 G91.1
    N31 m126
    N32 M0
    N33 M127
    N34 M0
    N35 M160
    N36 M0
    N40 M30
    n45 m30
    This program is just a test of M126/M127/M160 I have added M0 to slow it down and to ensure each Mxxx is executed properly(just in case there is some other reason why the reset is not occuring). The G53 is jto set the absolute position of x & y then switching to Incremental before I reset both x&y and then regenerate toolpath before starting new position cut.

    I hope this makes sense and would appreciate some more help please...Pete

  6. #6
    Join Date
    Mar 2003
    Posts
    35538

    Re: Custom Macro for Mach3

    Are they named M126.m1s? M127.m1s? .....
    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)

  7. #7
    Join Date
    Jun 2014
    Posts
    8

    Re: Custom Macro for Mach3

    Hi, thanks for your mail, You were right they were .mls files instead of .m1s files!!
    Well the code works on one run through, but unless I reload Mach3 it does not work the second time! Any ideas please?
    Pete.
    PS. Thanks to all who replied for all your help, at least I can see the light at the end of the tunnel!
    Would appreciate why it only works through once without reload.

  8. #8
    Join Date
    Mar 2003
    Posts
    35538

    Re: Custom Macro for Mach3

    Post the complete macro(s).
    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)

  9. #9
    Join Date
    Jun 2014
    Posts
    8

    Re: Custom Macro for Mach3

    Hi, Sorted out the other problem there was a bad character in the M160.m1s code.
    All now works great, thank you for all your help.
    Pete

Similar Threads

  1. Replies: 2
    Last Post: 12-19-2012, 01:28 PM
  2. Replies: 3
    Last Post: 02-13-2012, 07:20 PM
  3. Custom Macro B
    By rlgx4 in forum Parametric Programing
    Replies: 7
    Last Post: 08-02-2010, 10:05 PM
  4. "difference between Custom Macro A and Custom Macro B"
    By arulthambi in forum Parametric Programing
    Replies: 4
    Last Post: 10-05-2009, 09:34 PM
  5. Custom Macro B On A 18t.
    By JIMMYZ in forum Fanuc
    Replies: 3
    Last Post: 10-19-2006, 04:08 AM

Tags for this Thread

Posting Permissions

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