What's new
What's new

G13 programming attempt, need help

Olokio

Plastic
Joined
Apr 9, 2014
Location
United States
Ok guys so, my first post on here was about an issue I was having on an operation my shop is taking on. The programming for the part was over 55 pages in NC. So in an effort to reduce the program size and increase the ease of minor cutting changes someone recommended that I use a G13 code which on my Haas tm2 is ccw Circular milling and pocketing. With a lack of Cam software I am doing this manually so I would appreciate if anyone who knows the G13 programming technique to give me pointers with my example.

Work piece: 1018crs round slug: 5"od 4" long
Goal: pocket a cavity 2" deep by 4-1/2" diameter
Assume: tool length is 2.04 out of collet, and using a 1/2" 4 flute coated carbide endmill. XYZ0 is center top of the part, and there is a 3/4 hole drilled in the center through the part.

Code example:
G90 G54 G17 G20;
T1 MO6 D1;
S2400 M03;
G43 H01;
G00 X0Y0;
G00 Z0.01 M08;
G13 G91 Z-0.5 I0.375 K2.25 Q0.03 F30 L4;

I understand this is an incomplete program no beginning and end etc. my question is to understand the mechanics of using a g13 code. Will this segment dictate to the machine to cut my cavity in 4 levels each a half inch? Is this all that is need to create the desired pocket? and am I missing anything or is this an ok start. I'm still new and learning trying to blaze my own trail in the machining world, any help would be appreciated.

-Chris
 
yes you have the g13 part right. mine would look like this
G90 G54 G17 G20;
T1 MO6 D1;
S2400 M03;
G00 X0Y0;
G43 Z.1 H01;
G01 Z0 F20.; (MUST BE ZERO, OTHERWISE YOU WOULD LEAVE .01 ON FLOOR OF POCKET THE WAY YOU HAD IT)
G13 G91 Z-0.5 I0.375 K2.25 Q0.03 F30 L4;
G90 G0 Z1. M9(DON'T FORGET TO SWITCH BACK TO G90)
i typically edit some programs i do in mastercam with g13 to shorten program and make it easier to modify if needed
 
In your G13 line, don't forget to use a D word to activate cutter compensation for the cycle. If not using comp, then D0 (D-zero) should be used.
 
In your G13 line, don't forget to use a D word to activate cutter compensation for the cycle. If not using comp, then D0 (D-zero) should be used.

heard....but in the beginning program step i put d1 call up is that not enough? or should my g13 line specify d1 ?
 
I used to use that code a million times when I worked down South on a Matsurra Yasnac Control VMC(Over 12 years ago) and I loved it. Problem is I don't remember all the code.
If I recall correctly
G12/G13 dictates conventional/climb mill
G91 Incremental move
Z depth of pocket or hole
I is radius of pilot hole
K is the diameter of the finished hole
D compensation number (Does the cycle use wear comp or is it half the cutter? I recall half cutter diameter from before)
Q is width of cut? (Cycle will hold this until final dia is reached?
F is feed
L I can't remember what this is.

Thanks for posting this. I truly forgot all about it when I started using software to program. My old job of 8 years was Mazak Fusion control so that Fanuc code was never relevant. I have a Fanuc controller now at the new job so if its enabled, this will certainly come in handy.
 
D must be called in the G13 line.

Not on a HAAS!

The control uses the last active D-word automatically, so the code the OP is showing is just fine.
As a matter of fact, one must explicitly code in a D0 on the G13 line if the intent is to NOT USE cutter comp!

To the OP:

The code looks ok, but I would prefer NOT using a G91.
Instead, write your G13 codes explicitly for each depth, perhaps even retract in-between depths so chips can get evacuated better.
Remember, that 2" deep pocket of 4 1/2" dia is one big bowl to collect all kinds of nasty chips.
 
.....on a Matsurra Yasnac Control VMC...
D compensation number (Does the cycle use wear comp or is it half the cutter? I recall half cutter diameter from before)
Q is width of cut? (Cycle will hold this until final dia is reached?
F is feed
L I can't remember what this is.

......I have a Fanuc controller now at the new job so if its enabled, this will certainly come in handy.

D is just the comp address. If you program part profile, then your d register will have the tool radius. If you program tool center then you reduce I by the radius of the tool and your D register will only be the radial difference between your tool and the radius you used when defining the cycle.

Q is valid on G12/G13 for Yasnac controls but not G12/G13 on Mitsubishi controls (though I wish it was).

L is number of repeats. Very useful for deep pockets. Designate Z in incremental and then repeat the cycle L times to get to desired depth in one line of code.

Unless you or someone else has entered a macro for circle milling, you will not have G12/G13 on your Fanuc control. That is a pretty common macro though.
 
Last edited:
Not on a HAAS!

The control uses the last active D-word automatically, so the code the OP is showing is just fine.
As a matter of fact, one must explicitly code in a D0 on the G13 line if the intent is to NOT USE cutter comp!

To the OP:

The code looks ok, but I would prefer NOT using a G91.
Instead, write your G13 codes explicitly for each depth, perhaps even retract in-between depths so chips can get evacuated better.
Remember, that 2" deep pocket of 4 1/2" dia is one big bowl to collect all kinds of nasty chips.

This...

Here's what my code would look like given these parameters...

Cutter: 1/2" Hanita Varimill 2.125 LOC (though I'd use a 1" at least to minimize chatter) 1/2 depth of endmill diameter with 3/4 diameter steps...
Machine: Haas Vertical Mill
Material: 1018 CRS (350SFM/.0018 Chipload)
Previous Operations: Bore drilled out to 7/8
Objective: 4 1/2" G13 bore down 2"

T1 M6
M01
(1/2" VARIMILL)
(ROUGH/FINISH BORE)
G90 G54 X0 Y0 S2650 M3
G43 H1 Z1. M8
G1 Z-.25 F30.
G13 D1 I.625 F18.
G13 I.8125
G13 I1.
G13 I1.1875
G13 I1.375
G13 I1.5625
G13 I1.75
G13 I1.9375
G13 I2.125
G13 I2.245
G0 Z1.
G1 Z-.5 F30.
G13 D1 I.625 F18.
G13 I.8125
G13 I1.
G13 I1.1875
G13 I1.375
G13 I1.5625
G13 I1.75
G13 I1.9375
G13 I2.125
G13 I2.245
G0 Z1.
G1 Z-.75 F30.
G13 D1 I.625 F18.
G13 I.8125
G13 I1.
G13 I1.1875
G13 I1.375
G13 I1.5625
G13 I1.75
G13 I1.9375
G13 I2.125
G13 I2.245
G0 Z1.
G1 Z-1. F30.
G13 D1 I.625 F18.
G13 I.8125
G13 I1.
G13 I1.1875
G13 I1.375
G13 I1.5625
G13 I1.75
G13 I1.9375
G13 I2.125
G13 I2.245
G0 Z1.
G1 Z-1.25 F30.
G13 D1 I.625 F18.
G13 I.8125
G13 I1.
G13 I1.1875
G13 I1.375
G13 I1.5625
G13 I1.75
G13 I1.9375
G13 I2.125
G13 I2.245
G0 Z1.
G1 Z-1.5 F30.
G13 D1 I.625 F18.
G13 I.8125
G13 I1.
G13 I1.1875
G13 I1.375
G13 I1.5625
G13 I1.75
G13 I1.9375
G13 I2.125
G13 I2.245
G0 Z1.
G1 Z-1.75 F30.
G13 D1 I.625 F18.
G13 I.8125
G13 I1.
G13 I1.1875
G13 I1.375
G13 I1.5625
G13 I1.75
G13 I1.9375
G13 I2.125
G13 I2.245
G0 Z1.
G1 Z-2.05 F30.
G13 D1 I.625 F18.
G13 I.8125
G13 I1.
G13 I1.1875
G13 I1.375
G13 I1.5625
G13 I1.75
G13 I1.9375
G13 I2.125
G13 I2.245
G13 I2.25 L2
G0 Z1. M9
Z10.
G111 Y0.
M30

I don't think the D in the subsequent depths is necessary, but I've always written it in just in case... there's probably a way to can the cycle for depth but this is easy and works...

D=diameter of tool...
I=radius of cut...
F=feed rate...
L=number of passes (on the finish cut)
 
Here's what my code would look like given these parameters...

And here is your very same code, but perhaps a little prettier:


%
T1 M6
(1/2" VARIMILL)
(ROUGH/FINISH BORE)
G54
G00 G43 H01 D01
G00 G54 X0 Y0 Z1.
S2650 M3
M08
G01 Z-.5 F50.
G97 P1000
G01 Z-.75
M97 P1000
G01 Z-1.
G97 P1000
G01 Z-1.25
G97 P1000
G01 Z-1.5
G97 P1000
G01 Z-1.75
G97 P1000
G01 Z-2.
G97 P2000
M09
M05
G00 G49 G53 Y0 Z0
M30
N1000
G13 I.625 F18.
G13 I.8125
G13 I1.
G13 I1.1875
G13 I1.375
G13 I1.5625
G13 I1.75
G13 I1.9375
G13 I2.125
G13 I2.245
G01 Z1. F50.
M99
N2000
G13 I.625 F18.
G13 I.8125
G13 I1.
G13 I1.1875
G13 I1.375
G13 I1.5625
G13 I1.75
G13 I1.9375
G13 I2.125
G13 I2.245
G13 I2.25 L2
G01 Z1. F50.
M99
%
 
This...

Here's what my code would look like given these parameters...

Cutter: 1/2" Hanita Varimill 2.125 LOC (though I'd use a 1" at least to minimize chatter) 1/2 depth of endmill diameter with 3/4 diameter steps...
Machine: Haas Vertical Mill
Material: 1018 CRS (350SFM/.0018 Chipload)
Previous Operations: Bore drilled out to 7/8
Objective: 4 1/2" G13 bore down 2"

T1 M6
M01
(1/2" VARIMILL)
(ROUGH/FINISH BORE)
G90 G54 X0 Y0 S2650 M3
G43 H1 Z1. M8
G1 Z-.25 F30.
G13 D1 I.625 F18.
G13 I.8125
G13 I1.
G13 I1.1875
G13 I1.375
G13 I1.5625
G13 I1.75
G13 I1.9375
G13 I2.125
G13 I2.245
G0 Z1.
G1 Z-.5 F30.
G13 D1 I.625 F18.
G13 I.8125
G13 I1.
G13 I1.1875
G13 I1.375
G13 I1.5625
G13 I1.75
G13 I1.9375
G13 I2.125
G13 I2.245
G0 Z1.
G1 Z-.75 F30.
G13 D1 I.625 F18.
G13 I.8125
G13 I1.
G13 I1.1875
G13 I1.375
G13 I1.5625
G13 I1.75
G13 I1.9375
G13 I2.125
G13 I2.245
G0 Z1.
G1 Z-1. F30.
G13 D1 I.625 F18.
G13 I.8125
G13 I1.
G13 I1.1875
G13 I1.375
G13 I1.5625
G13 I1.75
G13 I1.9375
G13 I2.125
G13 I2.245
G0 Z1.
G1 Z-1.25 F30.
G13 D1 I.625 F18.
G13 I.8125
G13 I1.
G13 I1.1875
G13 I1.375
G13 I1.5625
G13 I1.75
G13 I1.9375
G13 I2.125
G13 I2.245
G0 Z1.
G1 Z-1.5 F30.
G13 D1 I.625 F18.
G13 I.8125
G13 I1.
G13 I1.1875
G13 I1.375
G13 I1.5625
G13 I1.75
G13 I1.9375
G13 I2.125
G13 I2.245
G0 Z1.
G1 Z-1.75 F30.
G13 D1 I.625 F18.
G13 I.8125
G13 I1.
G13 I1.1875
G13 I1.375
G13 I1.5625
G13 I1.75
G13 I1.9375
G13 I2.125
G13 I2.245
G0 Z1.
G1 Z-2.05 F30.
G13 D1 I.625 F18.
G13 I.8125
G13 I1.
G13 I1.1875
G13 I1.375
G13 I1.5625
G13 I1.75
G13 I1.9375
G13 I2.125
G13 I2.245
G13 I2.25 L2
G0 Z1. M9
Z10.
G111 Y0.
M30

I don't think the D in the subsequent depths is necessary, but I've always written it in just in case... there's probably a way to can the cycle for depth but this is easy and works...

D=diameter of tool...
I=radius of cut...
F=feed rate...
L=number of passes (on the finish cut)

Hi Charlie,
Following is the code using G13 that replaces all of your above program. Perhaps even prettier than Seymour's

SeymourDumore is absolutely correct with the use of the "D" address. If "D" is omitted from the G12/G13 block, the last commanded "D" value will be used. The "D" address is Modal. Some program by defining the "D" address early on in the program for use further on with Cutter Rad Comp G41/G42, rather than the Block in which Cutter Radius Comp is applied. Accordingly, if tool centre line is programmed, D0 must be included in the G12/G13 block.

Regards,

Bill

T1 M6
M01
(1/2" VARIMILL)
(ROUGH/FINISH BORE)
G90 G54 X0 Y0 S2650 M3
G43 H1 Z1. M8
G01 Z-0.050 F30. (POSITION IN Z SO THAT 0.25 x 8 WILL RESULT IN Z-2.05 FULL DEPTH)
G13 G91 Z-0.25 I0.4375 K2.245 Q0.1875 D01 F18 L8 (ROUGH IN Z STEPS OF 0.25 x 8 TIMES)
G13 I2.250 L2 (DIAMETER FINISH PASS x 2)
G90 G00 Z1. M9
Z10.0
G111 Y0.0
M30
 
Last edited:
Hi Charlie,
Following is the code using G13 that replaces all of your above program. Perhaps even prettier than Seymour's

SeymourDumore is absolutely correct with the use of the "D" address. If "D" is omitted from the G12/G13 block, the last commanded "D" value will be used. The "D" address is Modal. Some program by defining the "D" address early on in the program for use further on with Cutter Rad Comp G41/G42, rather than the Block in which Cutter Radius Comp is applied. Accordingly, if tool centre line is programmed, D0 must be included in the G12/G13 block.

Regards,

Bill

T1 M6
M01
(1/2" VARIMILL)
(ROUGH/FINISH BORE)
G90 G54 X0 Y0 S2650 M3
G43 H1 Z1. M8
G01 Z-0.050 F30. (POSITION IN Z SO THAT 0.25 x 8 WILL RESULT IN Z-2.05 FULL DEPTH)
G13 G91 Z-0.25 I0.4375 K2.245 Q0.1875 D01 F18 L8 (ROUGH IN Z STEPS OF 0.25 x 8 TIMES)
G13 I2.250 L2 (DIAMETER FINISH PASS x 2)
G90 G00 Z1. M9
Z10.0
G111 Y0.0
M30
Hi Bill,
What is k, and q? I been reading a lot of this and i think this is the one that I may understand.
Thank you
 
Hi Bill,
What is k, and q? I been reading a lot of this and i think this is the one that I may understand.
Thank you

Hello ramires,

K = Radius of finished circle (if specified)
Q = Radius increment, or step-over (must be used with K)

To cut just a finished circle, use an I value set to the radius and no K or Q value.


Regards,

Bill
 
Hi Bill,
Thank you for you reply, it is fascinating to read all this nice discussion that you and Paul have over here I am looking forward to learning all this from you guys, it really help as a lot,

To use I & J example I am making a hole 2.00 inch on diameter and I am using 1.00 inch mill, the code should look like this
G0 G90 G54 G41 X1.00 Y0 I-1.0
G02 X1.00 I-100
and this will make a full circle,
Thank you.
 
Hi Bill,

To use I & J example I am making a hole 2.00 inch on diameter and I am using 1.00 inch mill, the code should look like this
G0 G90 G54 G41 X1.00 Y0 I-1.0
G02 X1.00 I-100
and this will make a full circle,
Thank you.

Hello ramires,
I understand that your above code may only be to demonstrate what you think the code for the circular interpolation move would be, but the following observations can be made:

1. The first block is in Rapid Mode and given the hole you intend to machine is 2.00" in diameter, the cutter must be above the workpiece in fresh air.

2. Given that 1 above is correct, there is no Z move to engage the material.

3. In the first block you have initiated Tool Rad Comp Left (G41), yet the G02 used in Circular Interpolation would put the cutter to the Right of the Tool Path when machining a bore. Accordingly, the resulting bore size would be 4.00" in diameter if a 1.00" cutter is used with the corresponding correct Tool Radius Comp used.

4. Probably a typo, but the value of the I address in the G02 Block should be I-1.0 not I-100

The correct for code for a 2.00" Diameter Circular Interpolation Move at Z-0.25" will be as follows:

G00 G90 G54 X0.0 Y0.0
G01 Z-0.25 F_ _
G01 G41 X1.00 D_ _ F_ _
G03 X1.00 Y0.0 I-1.0

Because the above is for a full circle, the following Circular Interpolation Block will also suffice

G03 I-1.0

Regards,

Bill
 








 
Back
Top