586,119 active members*
3,683 visitors online*
Register for free
Login
Results 1 to 11 of 11
  1. #1
    Join Date
    Nov 2010
    Posts
    520

    VB script no executing in sequence

    Still playing with the Ref All Home button script. I would like the Z axis to go up to work coordinate of 1, then the X,Y axis moves to the home position and then the Z axis go down to work coordinate 0. And in that order. What is happening is the Z axis will go up to 1 and then down to 0 and then the X, Y axis moves to the home position. Close but not quit there.

    Here is the script that I used:

    Code("G0 Z1.000")
    ' Wait for movement to complete
    While IsMoving()
    ' Sleep, so other threads can run while we’re waiting
    Sleep(100)
    Wend
    ' Done

    RefCombination(3)

    ' Wait for movement to complete
    While IsMoving()
    ' Sleep, so other threads can run while we’re waiting
    Sleep(100)
    Wend
    ' Done

    Code("G0 Z0.000")


    DoOEMButton(133)
    DoOEMButton(134)


    Thanks.
    Rick

  2. #2
    Join Date
    Mar 2003
    Posts
    35538
    Try this code, with the exact syntax:


    Code "G0 Z1.0"

    While IsMoving()
    Wend

    Sleep (200)

    RefCombination(3)

    While IsMoving()
    Wend

    Sleep (200)

    Code "G0 Z0.0"

    While IsMoving()
    Wend

    Sleep (200)
    DoOemButton(133)
    Sleep(200)
    DoOemButton(134)
    Sleep(200)



    If it works, remove all the Sleep commands and see if it still works. It should.
    Also, do you actually have encoder DRO's that you need to zero? If not, then get rif of the DoOemButton (134) and (135).
    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
    Mar 2003
    Posts
    35538
    Just want to add this. I don't know exactly what you're trying to do, but I hope you have zeroed your Z axis to an appropriate position before running this code, to make sure you don't crasj the Z axis into the table.
    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)

  4. #4
    Join Date
    Nov 2010
    Posts
    520
    Gerry, Thanks for taking time out of your holiday to answer this problem. I really appreciate it.

    Here is the code I typed in:
    Code "G0 Z1.0"

    While IsMoving()
    Wend

    Sleep(200)
    RefCombination(3)


    While IsMoving()
    Wend
    Sleep(200)

    Code "G0 Z0.0"

    While IsMoving()
    Wend
    Sleep(200)


    Good news , bad news... it works sometimes, the times it does not, it will move the X and Y axis to home then it will move all axis to 0. Seems a little possessed to me. I am using offsets of 2.5 on the X axis and 11.5 on the Y.

    My test is press Ref All Home and when it is at home (DRO (work coordinates) will read -2.5,-11.5,0) I press the Go to Zero and all axis move to 0, then I press Ref All Home and so on.


    So to add some more info: I move the X,Y axis with the mpg and then Ref All Home, sometimes it stays and on those that is does not it will move the X,Y,Z axis to the position that I was at prior to Ref All Home.


    Thanks again.
    Rick

  5. #5
    Join Date
    Nov 2010
    Posts
    520
    And the saga continues...

    I removed all the sleeps from the code. Good news is that it works very consistent, bad news it raises the Z axis to 1 then it lowers the Z axis to 0 and then it moves the X and Y axis to home.

    Rick

  6. #6
    Join Date
    Mar 2003
    Posts
    35538
    Is this code in your Ref All home button? Do you have Home switches?

    Are you using the parallel port, or a smoothstepper? Do you have Home switches?

    If the parallel port, can you upload your .xml file?

    So to add some more info: I move the X,Y axis with the mpg and then Ref All Home, sometimes it stays and on those that is does not it will move the X,Y,Z axis to the position that I was at prior to Ref All Home.
    Are you saying that when you Ref All home it does different things? It should be doing the exact same thing, every time.

    Please answer all the questions I asked, and zip and post your .xml file.
    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
    Nov 2010
    Posts
    520
    Quote Originally Posted by ger21 View Post
    Is this code in your Ref All home button? Do you have Home switches?

    Are you using the parallel port, or a smoothstepper? Do you have Home switches?

    If the parallel port, can you upload your .xml file?



    Are you saying that when you Ref All home it does different things? It should be doing the exact same thing, every time.

    Please answer all the questions I asked, and zip and post your .xml file.

    I'm using the parallel port. I have two home switches which are the hall effect type as described by Roman. Each one of these is connected to a separate input on the Gecko G540. I also have 5 limit switches (NC) wired in series to one input on the G540.

    That is exactly what I am saying; the Ref All Home will be very inconsistent (in that it will do one of two possible things) when the Sleep() function is used. Without the Sleep() function in the script, it does the same thing, everytime (although not in the correct sequence).

    I've attached a copy of the mach3mill xml file.

    Thanks for all your help.

    Rick

    PS. If I just put the RefCombination(3) in the script by itself, it works just as it should (both the x and y axis go to home, simultaneously).

  8. #8
    Join Date
    Mar 2003
    Posts
    35538
    OK, I can duplicate your results, so I'm guessing it's some kind of bug. There's no reason for the X and Y axis to be moving.

    I have found a workaround that seems to work 100% of the time (that I was testing it )

    The following code will move the X and Y axis 1/2" off the home switches before moving the Z axis, but they won't go back to their previous position like before.


    Code "G0 Z1.0"
    While IsMoving()
    Wend

    Sleep(200)

    RefCombination(3)
    While IsMoving()
    Wend

    Sleep(200)

    Code "G53 G0 X0.5 Y0.5"
    While IsMoving()
    Wend

    Code "G0 Z0"
    While IsMoving()
    Wend
    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
    Nov 2010
    Posts
    520
    Works great now. Thanks for all your effort Gerry.

    I did make a little change. I changed:
    Code "G53 G0 X0.5 Y0.5"

    to:
    Code "G53 G0 X0.0 Y0.0"


    I've run it a half dozen times. All times it does what it should.

    I definitely learned a bit with this exercise.

    Rick

  10. #10
    Join Date
    Mar 2003
    Posts
    35538
    What I do is use the Home Offsets on Config >Homing/Limits to make my home switch positions = -0.5, and then use Code "G53 G0 X0.0 Y0.0" To move to 0,0. This keeps my 0,0 position away from the Home switches.
    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)

  11. #11
    Join Date
    Nov 2010
    Posts
    520
    Quote Originally Posted by ger21 View Post
    What I do is use the Home Offsets on Config >Homing/Limits to make my home switch positions = -0.5, and then use Code "G53 G0 X0.0 Y0.0" To move to 0,0. This keeps my 0,0 position away from the Home switches.

    Thanks for the tip. That is a great idea that I will be using.

    Rick

Similar Threads

  1. sheetcam cut sequence
    By klinzmann in forum SheetCam
    Replies: 2
    Last Post: 07-22-2013, 10:41 PM
  2. executing a program with sub
    By pbarry in forum Milltronics
    Replies: 4
    Last Post: 01-28-2011, 03:25 AM
  3. Whhat would be the best process for executing knife designs?
    By pesky_human in forum MetalWork Discussion
    Replies: 14
    Last Post: 11-13-2008, 04:52 AM
  4. cut sequence
    By camtd in forum Surfcam
    Replies: 2
    Last Post: 06-13-2006, 05:26 PM
  5. Sequence #'s
    By Mountainwildman in forum Post Processors for MC
    Replies: 2
    Last Post: 04-02-2006, 05:25 PM

Posting Permissions

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