Touch plate retract direction wrong


When I run the Auto Z Touch Plate operation in Mach4 using Avid’s Touch Plate, the probe moves down and touches the plate as normal, then instead of retracting the set distance, it travels further downward that amount. Does anyone know what file and parameter I need to change to have it retract upward instead of down?


Welcome to the forum!

A simple restart might fix this issue.

Check your tool table for non-zero values. The touch plate script applies a tool length offset before retract, and this can be a downward motion for certain offsets. (This might be fixed in the latest Mach 4 release?) Avid support recommends the T1 length offset stay zero.

Otherwise, try restoring the Mach 4 profile, which might have become corrupted. Follow the steps here.

Do you have offsets in your tool table? If you use offsets in your toll table you cannot use the AvidCNC scripts because they are hard coded to use G43 H1.

This should be fixed soon, but the fix isn’t in the current release.

1 Like

Thanks for the reply’s! I’m using Corbin’s (Corbin Workshop) screenset. He did a really great job on it and this is the only issue I’m having with it. He did mention Avid’s plate and this issue in his ATC setup video but also mentioned that he got it to work in his script. I was hoping to get enough to go on with this post that I could “simply :crazy_face:” find and edit a script parameter in a lua or mcs file such as changing a G43 to G44 that would flip that retract direction. There’s apparently a bit more to it than that?

Also, I don’t have any tool heights or offsets set yet so everything is zero.

Thanks, I appreciate the help!

Yeah, the “work around” I do is to disable heights, allow the code to process, and then re-enable them after I “see” the dialog is closed.

If you have a zero-height bit in the tool, then it shouldn’t happen at all. Do you get the same problem with the normal Avid CNC screen script? If you do…then something else is wrong. If you only get the problem with my screen script…then something I did is wrong. But that will help narrow it down.


Hi Corbin!

Apologies Sir, definitely not your script! I made WAY too many changes without testing each one before making another! I upgraded Mach version, made seemingly unrelated lua changes, and switched to your screenset.

The actual problem was created by this change: I wanted the start of my work coordinates at the start of my spoilboard so I added code to have my machine home, travel to the start of my spoilboard, then zero XYZ work coordinates of which it did. Unfortunately, it caused this particular issue. I removed that change and your screen/scripts work perfectly.

I added this code to the ScreenScript.lua:

–Move to work bed then zero XYZ work coordinates--------
GCode = “”
GCode = GCode … string.format(“G0 G53 X12.4129 Y433.9433\n”)
GCode = GCode … string.format(“G92 X0 Y0 Z0\n”)
mc.mcCntlGcodeExecuteWait(inst, GCode)

This does what I want but also causes my problem. I’m going to remove the zero Z aspect and see if that fixes it.

Corbin, on a separate matter, I go by “lordlazerwolf” on YouTube. I made a comment on your video with changes that are necessary for those of us that have the S30C spindle as it won’t work right with the settings needed for your spindle. I got it all dialed in and wanted to share those changes with the community but my comments were removed for some reason and I’m not sure if YT didn’t like them or if you didn’t want that posted. No worries if you removed it but if it was YT and you want those changes then let me know and I’ll send them your way. Thanks again for your work and responding here so fast, much appreciated!

Removing Z0 from the G92 instruction fixed the problem and all is well.

I prefer Z to zero as well but I can live without that unless anyone knows a way for me to have my cake and eat it too?

Oh bummer! I don’t have any comment restrictions and I don’t ever delete stuff…so I’m not sure what happened. I’d be super interested to know what you added to make it work better with the S30C - I know a few people are using it there. Shoot me an email or let me know here. corbin at corbinstreehouse dot com.

Glad you figured out the zero’ing/plate issue! Sounds like it just might be at the wrong spot. Another idea would be to toss in a button that does the GCode, or does it after the homing completes.


I don’t think YT liked the word “fork” for some odd reason haha! I’ll gather up those changes and email them to you.

I actually did have a button but I wanted it automated. My script tweak was added at the end of the refallhome function. After homing it moves right where it’s supposed to and zero’s but for some unknown reason zero’ing Z sends the spindle down instead of up for that retract after touching the plate. I’d like it to work because having everything at zero at my work area is nice and neat but oh well, having the X and Y zero there is more important to me so I’ll be happy with that.