Machsupport Forum

Mach Discussion => Mach4 General Discussion => Topic started by: backlashphoenix on December 08, 2017, 11:24:08 AM

Title: Help! Error Message G81 Cycle, Z Value Unspecified Error
Post by: backlashphoenix on December 08, 2017, 11:24:08 AM
This sounds like a very simple issue, but I'm getting this error message on all of my drill cycles, and can't figure out what the problem is. My Gcode definitely has a Z value included. Attached are pics of my Gcode and the error message.
Title: Re: Help! Error Message G81 Cycle, Z Value Unspecified Error
Post by: Steve Stallings on December 08, 2017, 11:31:56 AM
The Z co-ordinate in the G81 command line is the hole depth.

Before you can execute a G81, the previous code must have
established the Z starting point.

https://www.cnccookbook.com/g81-g73-g83-drill-peck-canned-cycle/
Title: Re: Help! Error Message G81 Cycle, Z Value Unspecified Error
Post by: backlashphoenix on December 08, 2017, 12:02:00 PM
Ok, so what should the first lines of this Gcode look like? This code ran perfectly fine in Mach 3.
Title: Re: Help! Error Message G81 Cycle, Z Value Unspecified Error
Post by: Steve Stallings on December 08, 2017, 12:19:37 PM
I do not know your intent and cannot write the G code that you need to add.

It should precede the section that you posted and should establish the Z
plane that the G81 starts from. See the example that I linked.
Title: Re: Help! Error Message G81 Cycle, Z Value Unspecified Error
Post by: joeaverage on December 08, 2017, 12:27:39 PM
Hi,
I've encountered exactly this 'error' also. G83, in fact most of the canned cycles are modal, so the first G83 requires all the information to
drill the hole, Z depths, retracts...etc. Thereafter you only need put the X,Y co-ordinates and Mach assumes all the remaining info stays unchanged.
Your code will work if the first G83 line is left as is but each subsequent line LEAVE OUT the 'G83'

You might believe, as I did this is an error, its not. In fact this interpretation of a modal canned cycle is correct whereas Mach3's interpretation is/was
sloppy enough to get away with it.

Craig
Title: Re: Help! Error Message G81 Cycle, Z Value Unspecified Error
Post by: joeaverage on December 08, 2017, 12:30:37 PM
Hi,
sorry should be G81 not 83, same principle applies.

Craig
Title: Re: Help! Error Message G81 Cycle, Z Value Unspecified Error
Post by: backlashphoenix on December 08, 2017, 12:47:52 PM
Thank you! I left the first line the same but removed each subsequent G81 like you said and it runs perfectly. I don't know how long it would have taken me to realize that that was what needed to change, but I think you just saved me at least another hour of banging my head on the wall.

Now I'll need to update our Gcode generator program. It's a program that my coworker wrote years ago that lets you pick points and polylines in Rhino3D and it spits out a Gcode. Anyway, thanks again.
Title: Re: Help! Error Message G81 Cycle, Z Value Unspecified Error
Post by: joeaverage on December 08, 2017, 12:52:50 PM
Hi,
try this code:
Code: [Select]
n10 g20
n20 g81 x0.067 y2.121 z-0.223 r0.500 f6.0
n30 y3.496
n40 x2.844 y3.993
n50 y2.100
n60 g80

Couple of other interesting things that Mach4 does which can catch you out:
the G code interpreter changes all letters to lowercase, strips out leading zeros and spaces.

So:
G81 X0.067 Y2.121..... becomes
g81x.067y2.121.....etc

In the vast majority of cases it makes no difference but in some cases it does, I found out when Mach couldn't find a macro I had written and named
M03 or similar and Mach interpreted differently and continued using the built in macro because my substitute was incorrectly named. smuprh pointed
this behaviour out. While uppercase, leading zeros and spaces make Gcode more human readable the Gcode interpreter sees it differently, be aware of it!

Craig

Title: Re: Help! Error Message G81 Cycle, Z Value Unspecified Error
Post by: Steve Stallings on December 08, 2017, 12:57:20 PM
Gee, I missed the duplicated G81 on each line.

Seems you did already have Z plane defined.

Good catch Craig, Mach4 is much fussier about following G code standard.

Title: Re: Help! Error Message G81 Cycle, Z Value Unspecified Error
Post by: joeaverage on December 08, 2017, 01:01:34 PM
Hi,
I use a software utility that converts PCB artwork into Gcode and it puts a G81 on each line also and that's when I encountered the behaviour you noted.
I was tempted to call it an error, after all the same code ran under Mach3 just fine, it must be a Mach4 bug, but its not. The Mach4 behaviour is closer
to the correct, or at least 'Peter Smid' interpretation.

Craig