586,131 active members*
2,936 visitors online*
Register for free
Login
Results 1 to 7 of 7
  1. #1
    Join Date
    Apr 2011
    Posts
    11

    Unhappy Auto zero for z code issue Mach3

    Hi All

    I am having a small issue with some code I added to this script.
    The code works fine, slowly lowers the Z till it touches my probe and retracts back up. But my probe is fairly thick 0.6875". So after it retractes I wanted to pause for a couple of seconds so I can remove the probe and then move Z down to 0.2" above the work surface.
    The code I added is
    Code "G4 P5"
    Code "G0 Z0.2"
    But the program ignores the G4 P5 line and just drives the bit into my probe.

    Here is the rest of the code, the code I added is in red. Not sure if I put it in the wrong place or need to add/modify it?

    PlateThickness = GetUserDRO(.6875) 'Z-plate thickness DRO

    If GetOemLed (825)=0 Then 'Check to see if the probe is already grounded or faulty
    DoOEMButton (1010) 'zero the Z axis so the probe move will start from here
    Code "G4 P5" ' this delay gives me time to get from computer to hold probe in place
    Code "G31Z-40 F10" 'probing move, can set the feed rate here as well as how far to move
    While IsMoving() 'wait while it happens
    Wend
    ZProbePos = GetVar(2002) 'get the exact point the probe was hit
    Code "G0 Z" &ZProbePos 'go back to that point, always a very small amount of overrun
    While IsMoving ()
    Wend
    Call SetDro (2, PlateThickness) 'set the Z axis DRO to whatever is set as plate thickness
    Code "G4 P0.25" 'Pause for Dro to update.
    Code "G0 Z.8875" 'put the Z retract height you want here
    Code "G4 P5"
    Code "G0 Z0.2"
    Code "(Z axis is now zeroed)" 'puts this message in the status bar
    Else
    Code "(Z-Plate is grounded, check connection and try again)" 'this goes in the status bar if applicable
    Exit Sub
    End If

  2. #2
    Join Date
    Nov 2009
    Posts
    4415

    Re: Auto zero for z code issue Mach3

    A lazy man does it twice.

  3. #3
    Join Date
    Feb 2008
    Posts
    521

    Re: Auto zero for z code issue Mach3

    Pinched from Wikipedia - may possibly explain the 'non delay'?

    G04 Dwell M T Takes an address for dwell period (may be X, U, or P). The dwell period is specified by a control parameter, typically set to milliseconds. Some machines can accept either X1.0 (s) or P1000 (ms), which are equivalent. Choosing dwell duration: Often the dwell needs only to last one or two full spindle rotations. This is typically much less than one second. Be aware when choosing a duration value that a long dwell is a waste of cycle time. In some situations it won't matter, but for high-volume repetitive production (over thousands of cycles), it is worth calculating that perhaps you only need 100 ms, and you can call it 200 to be safe, but 1000 is just a waste (too long).

  4. #4
    Join Date
    Mar 2003
    Posts
    35538

    Re: Auto zero for z code issue Mach3

    Try adding:

    While IsMoving()
    Wend

    after the G04 line.

    Or use:
    Sleep(5000)
    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
    Apr 2011
    Posts
    11

    Re: Auto zero for z code issue Mach3

    Thanks Ger21 this worked!!
    :cheers:

  6. #6
    Join Date
    Nov 2009
    Posts
    4415

    Re: Auto zero for z code issue Mach3

    Is the link I posted accessible to you? I just tried checking vis my phone and it says invalid permission.
    A lazy man does it twice.

  7. #7
    Join Date
    Apr 2011
    Posts
    11

    Re: Auto zero for z code issue Mach3

    Quote Originally Posted by Fastest1 View Post
    Is the link I posted accessible to you? I just tried checking vis my phone and it says invalid permission.
    Yes I can access the link no problem,

    Thanks.

Similar Threads

  1. Replies: 0
    Last Post: 03-17-2014, 03:48 AM
  2. A430s Man to Auto Issue
    By Taz55 in forum CNC Machining Centers
    Replies: 1
    Last Post: 07-03-2013, 07:42 PM
  3. Issue homing auto-zero 3-axis SuperSlant error 1003
    By rkdygert in forum Hardinge Lathes
    Replies: 0
    Last Post: 05-12-2013, 03:57 AM
  4. Auto cad 3d draw to g-code
    By jorgeneo560 in forum Autodesk
    Replies: 5
    Last Post: 08-03-2008, 06:27 AM

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
  •