587,997 active members*
2,709 visitors online*
Register for free
Login
IndustryArena Forum > MetalWorking Machines > Uncategorised MetalWorking Machines > Conditional and Loop Statements in Mach3
Results 1 to 6 of 6

Hybrid View

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

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

    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
    Feb 2010
    Posts
    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. #6
    Join Date
    Mar 2006
    Posts
    474
    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 News Announcements
    Replies: 1
    Last Post: 05-28-2010, 11:59 PM
  2. Conditional gcode execution in Mach3
    By bobeson in forum Tormach Personal CNC Mill
    Replies: 5
    Last Post: 12-14-2009, 03:39 AM
  3. 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, 05:44 PM
  4. Conditional loop problem
    By eagle73 in forum Controller & Computer Solutions
    Replies: 0
    Last Post: 12-19-2008, 11:14 PM
  5. If / Then Statements
    By Nanker in forum G-Code Programing
    Replies: 6
    Last Post: 10-23-2004, 06: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
  •