AutoZero Scripts

This page contains links and information on the new Auto Zero tool setting Scripts and Macros for both Mach3 and UCCNC.

This Auto tool Zero feature is unique in that it allows the cutter to be set anywhere on the table referenced to either the stock surface or the table top using the nominal thickness of the material as a reference. Lets face it the material you buy at your local store is never the thickness they advertise it at. It is either thicker or thinner but never the advertised thickness. Now you can either spend your time measuring the material thickness for each job or you can do the smart thing and by changing how you zero your machine you can get perfect depth pockets and cut right through your material without cutting into your spoil board.

How does it work?
Put simply the Macro askes for the material thickness when you zero your cutter and uses that to work out the Z height. If you sit the plate on the surface of the material then the offset is zero and the cutter will sit perfectly on the material surface . If sit the plate on the tabletop and enter a material offset of 12mm (1/2") then the cutter will be zeroed 12mm above the table top just as it would had you zeroed to the surface of a piece of 12mm stock. 

What's the difference?
By using the material offset and putting the plate on the table top the cutter will be zeroed 12mm above the table top. My putting the plate on top of the stock and zeroing there the cutter will be what ever the material thickness is from the table top. Since we know that 12mm is only the nominal thickness of the stock and it will be either thicker or thinner than that you will either not cut all the way through your stock or you will cut all the way through and into the spoil board.

If you learn how to use this you will never need to measure the stock thickness again.

The video below highlights the problem with Stock thickness.

Scripts available here


Installation instructions here for both Mach3 and UCCNC 

Final words
I want to thank the following people for their contributions to this project.

Mach3 Script
Big TEX who created the original Script that this is based on.
Glen Higgs for the Pre Touch Test addition
My only contribution was to add the material offset thickness and a beep.
John Revill for creating this Macro and sharing it with the Community
My only contribution to this project was to make suggestions and let John do all the hard work. 


  1. Hi Peter,I am currently building a cnc router and I want to than you for your informative videos,been very helpful.

    1. Thanks, glad it helps

    2. hai I have 5 axi cnc bought from amazon , I have question so please this cell phone 2817505717 `

  2. Hi
    This will work for manual tool change auto lenth for multi tools

  3. This comment has been removed by a blog administrator.

  4. I have a issue with ypur script. I just changed the height of the sensor but sometimes it plunges down into the probe after probing?

  5. Peter,
    How do I program an external push button to run a Z height auto tool zero?
    I tried to use OEM code 1010, which I wanted to run my auto tool zero macro for touching off for Z.
    I have buttons for the following:
    start ( code 1000 )
    toggle MPG ( code 103 )

  6. Peter,
    I looked into screen4 for a way to set-up a button on my pedant to auto tool zero....
    Thanks for any help.
    Kentucky USA

  7. Hi Peter, I'm trying your auto zero script today, it works very fine most of the time, but I find a dangerous situation, if you set mach3 in 'machine coordinates' mode by accident, The z axis will plunge down into the probe in the second pass. Please confirm this issue and maybe you can find a solution for this problem. Thank you very much.

  8. Peter,
    Have you used any of the UCCNC versions 2.108 & above? they put in a set of probing routines that look promising but confusing, as well as a complete change to the UI...

    1. I have seen it but am not a fan of the new look though I like the addition of dimensions.
      Cheers Peter

  9. HI Peter
    just watched your video on setting up my probe in UCCNC for a router. I am running screen set 1.2112 for the 400ETH module.
    I have copied the .TXT file into the router profile folder, and when I click on the probe button I get an script error: M31 has error cannot execute. Attached is the M31.TXT file and the ZIP folder I downloaded from your site.
    could you look it over to see where I went wrong.
    Thanks Tom

    1. Hi Tom
      You cannot attach files to this page and I cannot reply as you are anonymous

  10. Very thanks for this. I'm writing from Portugal and have been folow your videos since one year a go. I finally finish my 2200x3200mm CNC with UCCNC Software and i'm amazing. I did folow the CNC Router Parts Model and reproduce one here in Portugal. Very Thanks for your shares. Congratulations.


  11. Blockt link

    Warning: This URL has been blocked by Bitly's systems as potentially harmful.

    We recommend you close your browser window and notify the person who sent you the link.

    1. Thank you. There seems have been a change made at Bitly and some of my previous links no longer work.
      I have updated them so you should now be able to download the file you want.
      Cheers Peter