Results 1 to 6 of 6

Thread: Conditional and Loop Statements in Mach3

  1. #1
    Registered
    Join Date
    Feb 2010
    Location
    USA
    Posts
    6
    Downloads
    0
    Uploads
    0

    Conditional and Loop Statements in Mach3

    Hi All,

    I am pretty new to CNC and I am actually learning this stuff to help my father.

    I have used EMC2 a little bit and like it much better than the Kcam he started with.

    With EMC2 I can use conditional statements and while loops in my gCode using "O" words. I tried this with Mach3 trial version to no avail. Does the paid version of Mach3 Support looping and conditions. I did find in the manual the use of macros as subroutines. But no mention of conditional or looping statements.

    Thanks for your response.


  2. #2
    Community Moderator ger21's Avatar
    Join Date
    Mar 2003
    Location
    Shelby Twp, MI....USA
    Posts
    22,291
    Downloads
    0
    Uploads
    0
    Not in the g-code. You can, though, create M code macros with if..then and while... loops and call them from the g-code. A bit more trouble, but it is doable.
    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
    Feb 2010
    Location
    USA
    Posts
    6
    Downloads
    0
    Uploads
    0
    Can you give me an example? I know how to use M98/99 for macros but how do I use a macro for conditional and looping statements in Mach3.

    We are looking into purchasing Mach 3 with the mill add-ons. I like the fact that I can write VB extensions for it much like I write extensions for EMC2 using Php, C++, and Python. However, much of what my Dad is doing is easier done with loops and once in a while I find conditional statements to be handy.

    I can already tell Mach 3 is much better than KCam. I like EMC2 and it seems very powerful. But Dad can't see the screen very well and I don't have time to write a new UI for it right now. So Mach 3 seems to be the easiest route right now. It looks comparable to EMC2 as far as I can tell. What is your take on Mach 3 For beginners?

    Thank you again for your help.


  4. #4
    Community Moderator ger21's Avatar
    Join Date
    Mar 2003
    Location
    Shelby Twp, MI....USA
    Posts
    22,291
    Downloads
    0
    Uploads
    0
    You can use VB script in the macro, and assign it to any M code, like M555. When you call the M555 in your g-code, it'll run your VB script.

    Here's a lot of samples.
    http://www.machsupport.com/forum/ind...oard,75.0.html

    Mach3 for beginners? The main problem is that there's too much stuff on the screens that most beginners don't need. I use a greatly simplified screen that I made.
    http://www.machsupport.com/forum/ind...c,11115.0.html

    Other than that, it's very easy to use.
    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
    Registered
    Join Date
    Feb 2010
    Location
    USA
    Posts
    6
    Downloads
    0
    Uploads
    0
    Ok, I get it. I have to do it in VB and pass in the arguments from the gcode. That's kind of an odd solution. I would have thought that a program that looks as advanced as Mach3 would have support for loops and conditionals.

    Thank you for the info. You have been a great help!


  • #6
    Registered vlmarshall's Avatar
    Join Date
    Mar 2006
    Location
    usa
    Posts
    474
    Downloads
    0
    Uploads
    0
    Quote Originally Posted by Monotoba View Post
    Ok, I get it. I have to do it in VB and pass in the arguments from the gcode. That's kind of an odd solution. I would have thought that a program that looks as advanced as Mach3 would have support for loops and conditionals.
    That's why I switched to EMC from Mach, every time I asked about a special G-code or function, the answer was always "do it yourself". With EMC, there are already a bunch of programmers doing just that... so I can stick to making parts.
    http://www.youtube.com/user/vlmarshall


  • Similar Threads

    1. MACH3 closed loop encoder interface
      By RomaxxCNC in forum Product and Manufacturer Announcements
      Replies: 1
      Last Post: 05-28-2010, 06:59 PM
    2. Conditional gcode execution in Mach3
      By bobeson in forum Tormach Personal CNC Mill
      Replies: 5
      Last Post: 12-13-2009, 09:39 PM
    3. Problem- Mach EMC Maximum Encoder Count Closed Loop Servo EMC/MACH3
      By bad bearings in forum Open Source Controller Boards
      Replies: 11
      Last Post: 05-28-2009, 12:44 PM
    4. Conditional loop problem
      By eagle73 in forum Controller & Computer Solutions
      Replies: 0
      Last Post: 12-19-2008, 05:14 PM
    5. If / Then Statements
      By Nanker in forum G-Code Programing
      Replies: 6
      Last Post: 10-23-2004, 01:11 AM

    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.