Need Help .. VB Script Z Zero


Results 1 to 11 of 11

Thread: Need Help .. VB Script Z Zero

  1. #1
    Registered
    Join Date
    Feb 2017
    Location
    Thailand
    Posts
    8
    Downloads
    0
    Uploads
    0

    Default Need Help .. VB Script Z Zero

    Hi Everyone
    I use the script for z zero with my digitize probe.
    My problem is when i debug with step by setp this scrip is work then i save in to image button but when i click the button it work but z is incorrect position.
    When G31 Z-20 then probe hit work piece DRO is not set to Zero.
    This is the script
    Rem VBScript Edge FinderIf GetOemLed (825) <> 0 Then 'Check to see if the probe is already grounded or faulty
    Code "(Probe plate is grounded, check connection and try again)"
    Else
    FeedCurrent = GetOemDRO(818)
    Code "G4 P1"
    Code "G90 F200"
    Rem Z Zero
    DoOEMButton(1010)
    code "G31 Z-20 F100"
    While IsMoving()
    Wend
    DoOEMButton(1010)
    code "G4 P2"
    code "G1 Z1"
    Code "(Z axis is now Zeroed)"
    End If

    This pic i use step by step z is correct position


    This pic i run by click button


    And i tried to Change G4 P100 it not set z zero.
    Now i no have idea about that.....
    I'm a new baby for script....
    Thank you for help.

    Similar Threads:
    Attached Thumbnails Attached Thumbnails Need Help .. VB Script Z Zero-img_20171215_205420-jpg   Need Help .. VB Script Z Zero-img_20171215_205433-jpg   Need Help .. VB Script Z Zero-image-5517-png  


  2. #2
    Community Moderator ger21's Avatar
    Join Date
    Mar 2003
    Location
    United States
    Posts
    31708
    Downloads
    0
    Uploads
    0

    Default Re: Need Help .. VB Script Z Zero

    parallel port, or motion controller?
    Which version of 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)


  3. #3
    Registered
    Join Date
    Feb 2017
    Location
    Thailand
    Posts
    8
    Downloads
    0
    Uploads
    0

    Default Re: Need Help .. VB Script Z Zero

    I used
    Mach3Version D1.90.038
    And Parallel port



  4. #4
    Community Moderator ger21's Avatar
    Join Date
    Mar 2003
    Location
    United States
    Posts
    31708
    Downloads
    0
    Uploads
    0

    Default Re: Need Help .. VB Script Z Zero

    Try this:


    Rem VBScript Edge Finder

    If GetOemLed (825) <> 0 Then 'Check to see if the probe is already grounded or faulty
    Code "(Probe plate is grounded, check connection and try again)"
    Else
    FeedCurrent = GetOemDRO(818)
    Code "G4 P1"
    Code "G90 F200"
    Rem Z Zero
    DoOEMButton(1010)
    Sleep(200)
    code "G31 Z-20 F100"
    While IsMoving()
    Sleep(10)
    Wend
    DoOEMButton(1010)
    Sleep(200)
    code "G4 P2"
    code "G1 Z1"
    While IsMoving()
    Sleep(10)
    Wend
    Code "(Z axis is now Zeroed)"
    End If

    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
    Registered
    Join Date
    Feb 2017
    Location
    Thailand
    Posts
    8
    Downloads
    0
    Uploads
    0

    Default Re: Need Help .. VB Script Z Zero

    Thank you Gerry
    I'll try and get the result to you again.



  6. #6
    Registered
    Join Date
    Feb 2017
    Location
    Thailand
    Posts
    8
    Downloads
    0
    Uploads
    0

    Default

    Quote Originally Posted by ger21 View Post
    Try this:


    Rem VBScript Edge Finder

    If GetOemLed (825) <> 0 Then 'Check to see if the probe is already grounded or faulty
    Code "(Probe plate is grounded, check connection and try again)"
    Else
    FeedCurrent = GetOemDRO(818)
    Code "G4 P1"
    Code "G90 F200"
    Rem Z Zero
    DoOEMButton(1010)
    Sleep(200)
    code "G31 Z-20 F100"
    While IsMoving()
    Sleep(10)
    Wend
    DoOEMButton(1010)
    Sleep(200)
    code "G4 P2"
    code "G1 Z1"
    While IsMoving()
    Sleep(10)
    Wend
    Code "(Z axis is now Zeroed)"
    End If
    That work !!!!!!
    So thank you so much Gerry.
    Can you explain why my code not work.



  7. #7
    Community Moderator ger21's Avatar
    Join Date
    Mar 2003
    Location
    United States
    Posts
    31708
    Downloads
    0
    Uploads
    0

    Default Re: Need Help .. VB Script Z Zero

    I don't know for sure, but you are using a very old version of Mach3, which requires a Sleep(10) inside the While..IsMoving(). This is not required in later releases of Mach3.

    Also, I added a Sleep(200) after DoOEMButton(1010), to give the DRO's time to update before proceeding.

    And you were missing a While...IsMoving() after the last G1 move. These are required after all movement.

    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)


  8. #8
    Registered
    Join Date
    Feb 2017
    Location
    Thailand
    Posts
    8
    Downloads
    0
    Uploads
    0

    Default Re: Need Help .. VB Script Z Zero

    i have a other question..
    What is the type of input text?
    If i want to use text for calculation position.
    Rem VBScript Edge Finder
    If GetOemLed (825) <> 0 Then 'Check to see if the probe is already grounded or faulty
    Code "(Probe plate is grounded, check connection and try again)"
    Else
    FeedCurrent = GetOemDRO(818)
    XCurrent = GetDro(0)
    YCurrent = GetDro(1)
    ZCurrent = GetDro(2)
    Code "G4 P1"
    Code "G90 F200"


    Rem Z Zero
    DoOEMButton(1010)
    Sleep(200)
    code "G31 Z-20 F100"
    While IsMoving()
    Sleep(10)
    Wend
    DoOEMButton(1010)
    Sleep(200)
    code "G4 P2"
    code "G1 Z1"
    While IsMoving()
    Sleep(10)
    Wend
    Code "(Z axis is now Zeroed)"



    Rem Probe X CENTER
    PART_L = GetuserDRO(9000) <<<<<<<<<<<<< i don't know what is the type of this for get data from input
    PART_W = GetuserDRO(9001)
    PART_T = GetuserDRO(9002)
    DoOEMButton(1008)
    sleep(200)
    XMov1 = (PART_L * 0.5) + 10
    Code "G1 X" &XMov1
    While IsMoving()
    Sleep(10)
    Wend
    Code "G1 Z-4"
    While IsMoving()
    Sleep(10)
    Wend
    Code "G31 X-10"
    While IsMoving()
    Sleep(10)
    Wend
    XPos1 = GetDRO(0)
    Code "G1 X10"
    While IsMoving()
    Sleep(10)
    Wend
    Code "G1 Z1"
    While IsMoving()
    Sleep(10)
    Wend
    Code "G1 X0"
    While IsMoving()
    Sleep(10)
    Wend
    XMov2 = (PART_L * 0.5) - 10
    Code "G1 X" &XMov2
    While IsMoving()
    Sleep(10)
    Wend
    Code "G1 Z-4"
    While IsMoving()
    Sleep(10)
    Wend
    Code "G31 X10"
    While IsMoving()
    Sleep(10)
    Wend
    XPos2 = GetDRO(0)
    Code "G1 X-10"
    While IsMoving()
    Sleep(10)
    Wend
    Code "G1 Z1"
    While IsMoving()
    Sleep(10)
    Wend
    Code "G1 X0"
    While IsMoving()
    Sleep(10)
    Wend
    Code "(X DATA COMPLETED)"


    Rem Probe Y CENTER
    DoOEMButton(1009)
    YMov1 = (PART_W * 0.5) + 10
    Code "G1 Y" &YMov1
    While IsMoving()
    Sleep(10)
    Wend
    Code "G1 Z-4"
    While IsMoving()
    Sleep(10)
    Wend
    Code "G31 Y-10"
    While IsMoving()
    Sleep(10)
    Wend
    YPos1 = GetDro(1)
    code "G1 Y10"
    While IsMoving()
    Sleep(10)
    Wend
    Code "G1 Z1"
    While IsMoving()
    Sleep(10)
    Wend
    code "G1 Y0"
    While IsMoving()
    Sleep(10)
    Wend
    YMov2 = (PART_W * 0.5) - 10
    Code "G1 Y" &YMov2
    While IsMoving()
    Sleep(10)
    Wend
    Code "G1 Z-4"
    While IsMoving()
    Sleep(10)
    Wend
    Code "G31 Y10"
    While IsMoving()
    Sleep(10)
    Wend
    YPos1 = GetDro(1)
    code "G1 Y-10"
    While IsMoving()
    Sleep(10)
    Wend
    Code "G1 Z1"
    While IsMoving()
    Sleep(10)
    Wend
    Code "(Y DATA COMPLETED)"

    Rem MOVE To X0Y0
    XPos_Cen = (XMov1 + XMov2)/2
    YPos_Cen = (YMov1 + YMov2)/2
    Code "G1 X" &XPos_Cen
    While IsMoving()
    Sleep(10)
    Wend
    Code "G1 X" &XPos_Cen
    While IsMoving()
    Sleep(10)
    Wend
    Code "G1 Y" &YPos_Cen
    While IsMoving()
    Sleep(10)
    Wend
    Code "(X Y axis is now Zeroed)"
    DoOEMButton (1008)
    DoOEMButton (1009)
    Sleep (200)
    Code "(READY)"
    Code "F" &Feedcurrent
    End If


    Attached Thumbnails Attached Thumbnails Need Help .. VB Script Z Zero-image-5519-png  


  9. #9
    Community Moderator ger21's Avatar
    Join Date
    Mar 2003
    Location
    United States
    Posts
    31708
    Downloads
    0
    Uploads
    0

    Default Re: Need Help .. VB Script Z Zero

    GetUserDRO() will return a Variant I think, which can be used in calculations. If you want to use your calculated value as a string at any point, you'll need to convert it to a string first. But you can use the returned value as is.

    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)


  10. #10
    Registered
    Join Date
    Feb 2017
    Location
    Thailand
    Posts
    8
    Downloads
    0
    Uploads
    0

    Default Re: Need Help .. VB Script Z Zero

    Thank for fast reply..
    How can i convert it.
    And I try to input value when i press enter it not get my value in dro...it set to 0 .





    Thank you for help

    Attached Thumbnails Attached Thumbnails Need Help .. VB Script Z Zero-image-5522-png   Need Help .. VB Script Z Zero-image-5521-png  
    Last edited by BlackTeaCha; 12-16-2017 at 11:48 AM.


  11. #11
    Community Moderator ger21's Avatar
    Join Date
    Mar 2003
    Location
    United States
    Posts
    31708
    Downloads
    0
    Uploads
    0

    Default Re: Need Help .. VB Script Z Zero

    You're leading digits needs to be at least 2, to display 50.

    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)


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
  •  


About CNCzone.com

    We are the largest and most active discussion forum for manufacturing industry. The site is 100% free to join and use, so join today!

Follow us on


Our Brands

Need Help .. VB Script Z Zero

Need Help .. VB Script Z Zero