Issues with Z-Axis running away - Creating Macros in UGS

Hi all,

I have been busy setting up my new X-carve and have run into some issues with the Z axis. I am creating a macro for the touch top attachment in UGS. The code I have written is:

M30:G38.2 Z-2 F5: G92 Z.5; G0 Z.5

Switch the units to inches; perform touch top (-2 inches @ 5 in/min); Zero Z .5 below touch; Raise Z .5"

My issue comes when the machine is trying to raise the z at the end of the code. It doesnt just go .5" but totally runs away and crashes into the top switch. FML. I already have to replace a switch.

I really don’t understand what is going on. I created a macro specifically to test the G0 Z.5 command. It takes off every time and crashes. I attached a video showing the process.

I haven’t even been able to run a job yet. My concern is that this issue will permeate into any job I create in Aspire.

Any ideas would be much appreciated

Okay, looks like you are setting up Z Probing using UGS. I recommend you use the Double Tap Probe method that I use on my Xcarve with UGS. This method works great for me.

You can find the instructions to set this up at X-CARVE TIPS
Look for ​DOUBLE TAP PROBE MACRO FOR UGS section on the page.

Gcode probing double tap macro for UGS:

M5; G17; G20; G91 G38.2 z-.5 F2; G0 z.03; G38.2 z-.1 F1; G10 L20 P1 z.505; G0 z.1; G90

Paste it on one of the macro fields.

CHANGE Z.505 TO THE THICKNESS OF YOUR TOUCH PLATE

it should look like this:

an explanation of what it all does

M5 = turn spindle off
G17 = work plane coordinates
G20 = inches
G91 = coordinates in relative mode
G38.2 Z = Probe or look for contact for the Z axis
-.5 F2 = .50 inch max seek distance at a feed rate of 2 ipm
G0 Z.03 = in relative mode rapid up .03 inches
G38.2 Z = in relative mode Probe or look for contact for the Z axis
-.1 F1 = .10 inch max seek distance at a feed rate of 1 ipm
G10 L20 P1 Z.505 = sets the current Z axis position at .505 up (change .505 to your touch plate height)
G0 Z.1 = in relative mode rapid up .1 inches
G90 = coordinates in absolute mode

Good luck.

@MatthewJohnson The default motion mode in grbl is absolute (G90). That means that G0 Z.5 is not a retract of half an inch (assuming G20) but a move to your work position Z0.5 which could be above the limit switch.
What’s the M30 for?

Without knowing the Z location, your machine might be doing what you tell it.

Can you get a video of the macro with the touch plate?
Your macro, as written, will temporarily set zero at .5 below the probed surface, then move Z to the Z.5 (which is where it already is). If you had a G0Z0.25 after the probe, it makes sense that it would try to go TO Z0.25 which is .25 below the probe surface.
I don’t use UGS, but I like macros.