G8x mill code question

This forum is dedicated to those Hobbyists Interested in CNC machining in their home shops. (Digital Read Outs are also topical, as is CAD/CAM as it relates to CNC)

Moderator: Harold_V

Post Reply
kvom
Posts: 1163
Joined: Thu May 08, 2008 11:38 am
Location: Cumming, GA

G8x mill code question

Post by kvom » Wed Aug 24, 2016 5:03 pm

This question came up when a friend sent me a g-code program where G8x and G98/99 weren't working together as he expected. If I issue a G81 and then on the next line just specify an X and or Y, am I specifying a single canned cycle or two separate cycles with the second inheriting modal values from the first?

The issue he has is with the retract values. With G98 in force the tool retracts to the higher of the start position or the R value, while with G99 the R value is obeyed. In both Mach3 and Mach4, if G99, then the original Z height of the cycle is forgotten and can't be recovered by a subsequent G98.

If each execution of the canned cycle is considered standalone, then this makes sense. if it's all one single cycle doing multiple holes then it's a bug.

Or it's just a matter of interpretation of g-code "standards", whatever they might be.

User avatar
GlennW
Posts: 6534
Joined: Sun Apr 15, 2007 9:23 am
Location: Florida

Re: G8x mill code question

Post by GlennW » Wed Aug 24, 2016 5:33 pm

I don't know the first thing about Mach3 or Mach4, so I have no idea what G98/99 represent, but this is what a simple drilling cycle looks like on my machine.

M3S1200
G81Z-0.042R.1F20
X4.043Y-0.861
X20.513Y-1.763
X22.000Y-7.125
6G80

First line starts the spindle at 1200 rpm
Second line defines the drilling events: Drill to .042" at 20 ipm then retract to .1.
X,X coordinates define the hole locations.
G80 cancels the drilling cycle.

Dunno if that helps or not!
Glenn

Operating machines is perfectly safe......until you forget how dangerous it really is!

kvom
Posts: 1163
Joined: Thu May 08, 2008 11:38 am
Location: Cumming, GA

Re: G8x mill code question

Post by kvom » Wed Aug 24, 2016 8:31 pm

G81Z-0.042R.1F20
X4.043Y-0.861

In simple language, is this sequence supposed to be 1 canned cycle or two?

And to clarify. If G98 is in effect before the G81, the retract will be the higher of the initial Z or .1. If G99, then .1.

The "problem" being posed is this example

G0 Z1
G98
G81Z-0.042R.1F20
G99
X4.043Y-0.861
G98
X5

The first retract is to Z1, not Z.1
The second is to Z.1
What should the 3rd be?
Last edited by kvom on Wed Aug 24, 2016 9:02 pm, edited 1 time in total.

User avatar
GlennW
Posts: 6534
Joined: Sun Apr 15, 2007 9:23 am
Location: Florida

Re: G8x mill code question

Post by GlennW » Wed Aug 24, 2016 8:51 pm

My example will drill in three locations to a depth of .042" with a .1" retraction above the part surface prior to moving to the next location.
Glenn

Operating machines is perfectly safe......until you forget how dangerous it really is!

Magicniner
Posts: 405
Joined: Thu May 30, 2013 4:40 am

Re: G8x mill code question

Post by Magicniner » Thu Aug 25, 2016 2:35 am

I don't know if this will help -

G0 Z1 ( G00:Rapid positioning )
G98 ( G98:Set Initial Plane default )
G81Z-0.042R.1F20 ( G81:Drilling to final depth canned cycle R:Arc radius:.1 F:Feedrate:20 )
G99 ( G99:Return to main program )
X4.043Y-0.861
G98 ( G98:Set Initial Plane default )
X5

My CAM is good enough that I'm just picking up bits & pieces of G-Code recognition as I go along but I find this site helps -

http://www.buildlog.net/cnc_laser/cnc/g ... mment.html

Regards,
Nick

User avatar
Bill Shields
Posts: 4897
Joined: Fri Dec 21, 2007 4:57 am
Location: Somewhere in the World
Contact:

Re: G8x mill code question

Post by Bill Shields » Sat Aug 27, 2016 4:11 pm

use of G98 / G99 is dependent on control configuration (if it is used at all)

as a general rule, I would not do what you are showing with changing G98 / G99 in the middle of the cycle.

many controls only 'read' G98/G98 at the time the initial cycle is defined...and will stay in effect until a something is called that cancels the G81 (be it G0 / G1 / G80 or with some controls must be G80 G0 combined)...

others MIGHT SWAP in the middle of the cycle, but in general I would have to look at the PLC logic of the individual control (from the machine builder not the control builder) to tell you exactly what the control will do.

Post Reply