586,103 active members*
3,268 visitors online*
Register for free
Login
Results 1 to 8 of 8
  1. #1
    Join Date
    Dec 2007
    Posts
    93

    Stopping g31 in VB

    Hi,

    I'm trying to make a fast raster probing macro, but am really struggling to get the main logic loop working.

    What I want to do is stop the G31 command running, i.e. stop the machine moving when a certain distance is reached. On its own, the G31 command will keep the machine moving in a straight line until the probe is triggered.

    My VB script looks something like this:

    code "G31 X10"
    While GetParam(XMachine)>10
    Sleep 100
    Wend



    Which isn't doing anything useful

    If anybody can see how to stop the machine moving if X position equals or exceeds 10, please let me know!

  2. #2
    Join Date
    Mar 2003
    Posts
    35538
    code "G31 X10"
    If you are in Incremental mode, the above command should move 10" and stop. In Absolute mode is should move to X=10 and stop. It shouldn't keep moving past 10.
    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 2007
    Posts
    93
    Strange, mine keeps moving indefinately.

    This is also true if I use "G31 X10" in standard Gcode, outside of VB macros.

    I'm using Version R3.043.066 . Do you see different behaviour in another version?

  4. #4
    Join Date
    Mar 2003
    Posts
    35538
    3.43.062, if I use MDI and type G31 X10, it will go to X=10 in absolute, or move X10 in the + direction in Incremental mode.
    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
    Dec 2007
    Posts
    93
    Mine overruns, even in MDI.

    I guess this is a problem for mach support.

    Thanks

  6. #6
    Join Date
    Mar 2003
    Posts
    35538
    I'd try with a new profile, or re-install Mach3.
    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
    Dec 2007
    Posts
    93
    Thanks for your help so far.


    I've actually been testing the code on my desktop, since the cnc is actually at my parent's house.

    I went over there today, and G31 works fine on that computer.

    Could it be that you need a parallel port connected to the machine to run properly? Seems odd to me. The computer at my house has no hardware connected at all.


    Anyway, I just tried a creating a new "default" profile but code still over runs, whether I set the probe input as active high or low.

    Is there a way to restore default settings other than a reinstall?

  8. #8
    Join Date
    Mar 2003
    Posts
    35538
    Could it be that you need a parallel port connected to the machine to run properly?
    No, but you need to install the parallel port driver when installing Mach3. Some functions are handled by the driver, and don't work correctly if the driver isn't installed.

    I was testing on a PC with no machine connected, but the parallel port driver installed, and it works fine for me.
    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)

Similar Threads

  1. Spindle not stopping
    By adaptaflex in forum Fanuc
    Replies: 4
    Last Post: 08-17-2010, 09:03 PM
  2. spindel stopping mid job
    By jessec in forum SprutCAM
    Replies: 2
    Last Post: 12-07-2009, 06:04 PM
  3. stopping?
    By nelZ in forum CamSoft Products
    Replies: 2
    Last Post: 11-07-2009, 12:00 AM
  4. VF2 keeps stopping
    By donj1 in forum Haas Mills
    Replies: 16
    Last Post: 08-12-2005, 04:09 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
  •