View Full Version : G2/G3 Coding


jrobson
08-02-2006, 08:51 AM
Can someone point me to some documentation that properly explains G2/G3 coding on 5T/6T Fanuc controllers with tool nose radius compensation?

tobyaxis
08-02-2006, 09:52 AM
This book will help you and it's not cheezy. It will explain things so you can understand.

http://www.amazon.com/gp/product/0131560840/sr=1-1/qid=1154526221/ref=sr_1_1/002-8696645-0818463?ie=UTF8&s=books

It also goes over the tool tip selections for using TNRC (Tool Nose Radius Compensation)
Example: is a Fanuc 10T
%
O0086
(TURBINE SPLINE 27SPL)
(GM 200 TH200R4)
(MATERIAL=4140)
(PILOT=1.375D)
(ID=.814D)
(DRWNG=SPLINEA.CAD)
(OP#1)
(DATE 8/1/03 PGMR TJD)
(DATE REV 1/27/04 TJD)
(T1=CNMG432 VALINITE SV330 T3)
(T3=DNMG431 SECO FF1 CM T3)
(T5=DRILL 3/4 135SPT COB STUB)
(T7=B-BAR 1/2 CCMT21.51F2 TP1000 T2)
(SECO CARBOLOY)
(JAWS=400 PRESS=20)
(CYCLE TIME=MS)

G0 G40 G97 G99 T0 M5
G28 U0 W0 M9
G50 S2000 M41
M1

N1(REMOVE SKIN/R-FACE/TURN)
G28 U0 W0 T0
T101 M8
G96 S475 M4
G0 G42 X3.99 Z.3
G1 Z-1.3 F.01
X4.05 F.015
G0 G40 X4.1 Z.2
G72 P10 Q15 W.005 D400 F.008
N10 G0 G41 Z0
N15 G1 X0 F.004

G0 G40 X4.0 Z.1
G71 P20 Q25 U.02 W.002 D850 F.01
N20 G0 G42 X1.0
G1 Z0 F.0025
X1.325 F.003
G3 X1.375 Z-.025 R.025 F.0025
G1 Z-.75 F.004
X2.75 F.0035
X3.975 Z-.9141 F.0025
G1 Z-1.08 F.004
N25 X4.1 F.0035

G0 G40 Z.1 M9
G28 U0 W0
G97
T0
M1

N2(F-FACE/TURN/U-CUT)
G28 U0 W0 T0
T303 M8
G96 S650 M4
G0 G41 X1.5 Z0
G1 X0 F.004

G0 G40 X4.1 Z.1
G70 P20 Q25
G0 G40 Z.1

(U-CUT)
G1 X1.3755 Z-.725 F.05
Z-.755 F.004
G4 U1.0
G1 Z-.75 F.006
X2.8 F.003

G0 G40 Z.1 M9
G28 U0 W0 M5
G97
T0
M1

N3(DRILL)
G28 U0 W0 T0
T505 M8
G97 S400 M3
G0 X0 Z.25
G1 Z-2.25 F.0072
Z.05 F.2

G0 G40 Z.1 M9
G28 U0 W0
G97
T0
M1

N4(R-BORE )
G28 U0 W0 T0
T707 M8
G96 S400 M3
G0 G40 X.75 Z.1
G71 P40 Q45 U-.02 W.002 D320 F.0075
N40 G0 G41 X1.214
G1 X.814 Z-.1 F.003
Z-1.3 F.005
N45 X.75

G0 G40 Z.1 M9
G28 U0 W0
G97
T0
M1

N5(F-BORE)
G28 U0 W0 T0
T707 M8
G96 S550 M3
G0 G40 X.75 Z.1
G70 P40 Q45

G0 G40 Z.1 M9
G28 U0 W0
G97
T0

M30

If your Control sets tools with a G50 I'll post an example for that one as well.
:cheers:

jrobson
08-02-2006, 10:14 AM
Hi

Thank you!

Yes our control sets with G50.

Regards,
Jonathan.

tobyaxis
08-02-2006, 10:32 AM
Here is a simple example of a program with G50. Do you know how to set your tools with G50 yet? If not I'll post instructions too.

%
O1154
(IKEGAI FANUC 6T)
(ANTI-BALLOONING PLATE)
(DRWNG=ABPLC1.CAD)
(MATERIAL=SAE 1018)
(5.0D 1.075L)
(OP1)
(DATE 1/15/04 PGMR TJD)
(DATE REV 1/15/04)
(LAST RUN)
(T1=CNMG432 VALENITE SV330 T3)
(T2=DRILL 1.0D INDEX)
(T3=DNMG431 SECO FF1 CM T3)
(T4=B-BAR .5D CCMT21.51-F2 TP1000 T2)
(T5=B-BAR 1.0 D .0312R T2)
(JAWS=400 PRESS=18)
(CYCLE TIME= MS)

G0 G40 G97 G99 M5
G28 U0 W0 M9
G50 S2000 M39
M1

N1(R-FACE/TURN)
G28 U0 W0
T0100
G50 X(RP) Z(RP) M8
G96 S525 M3
G0 X5.2 Z.2 T0101
G72 P10 Q11 W.005 D400 F.008
N10 G0 G41 Z0
N15 G1 X0 F.004

G0 G40 X5.2 Z.1
G71 P20 Q25 U.02 W.005 D750 F.01
N20 G0 G42 X4.765
G1 X4.985 Z-.01 F.0025
Z-.75 F.004
N25 X5.2 F.0035

G0 G40 Z.1 M9
G0 X(RP) Z(RP) T0100
G28 U0 W0
G97
M1


N2(DRILL)
G28 U0 W0
T0200
G50 X(RP) Z(RP) M8
G97 S2400 M3
G0 X0 Z.2 T0202
G1 Z-1.125 F.0025
Z.05 F.2

G0 G40 Z.1 M9
G50 X(RP) Z(RP) T0200
G28 U0 W0
G97
M1

N3(F-FACE/TURN)
G28 U0 W0
T0300
G50 X(RP) Z(RP) M8
G96 S650 M3
G0 X5.2 Z.2 T0303
G70 P10 Q15

G0 G40 X5.2 Z.1
G70 P20 Q25

G0 G40 Z.1 M9
G0 X(RP)Z(RP) T0300
G28 U0 W0
G97
M1

N4(R-BORE)
G28 U0 W0
T0400
G50 X(RP) Z(RP) M8
G96 S400 M3
G0 X1.0 Z.1 T0404
G71 P40 Q45 U.02 W.02 D320 F.0075
N40 G0 G41 X4.6628
G3 X1.975 Z-.3 R2.5 F.0035
G1 X1.875 Z-.35 F.0025
Z-.43 F.004
X1.518 F.0035
X1.483 Z-.455 F.0025
Z-.9 F.004
N45 X1.0 F.0035

G0 G40 Z.1 M9
G0 X(RP) Z(RP) T0400
G28 U0 W0
G97
M1

N5(F-BORE)
G28 U0 W0
T0500
G50 X(RP)Z(RP) M8
G96 S550 M3
G0 X1.0 Z.1 T0505
G70 P40 Q45

G0 G40 Z.1 M9
G0 X(RP)Z(RP) T0500
G28 U0 W0
G97

M30
%

jrobson
08-02-2006, 10:36 AM
Hi there

Yes I have no programming problems, simply that with G2/G3 I can't calculate I and K properly...

jrobson
08-02-2006, 10:37 AM
On the 6t it is usually okay, but on the 5t very difficult. In the past someone did the G2/G3 for me via mastercam or edgecam or something however this is no longer a option.

tobyaxis
08-02-2006, 10:38 AM
You don't need I and K for that control. Use "R" letter address, it will work.

tobyaxis
08-02-2006, 10:40 AM
On the 6t it is usually okay, but on the 5t very difficult. In the past someone did the G2/G3 for me via mastercam or edgecam or something however this is no longer a option.

I have some free time and could help you with this if you would like.

jrobson
08-02-2006, 10:45 AM
Hi

On the 5T there is no R only I/K...
If you can help I would really appreciate it as I have no idea how to calculate it properly...

tobyaxis
08-02-2006, 10:50 AM
Ok that is an older control. I never use "I" and "K", but I'll figure it out. How does the machine read "I" and "K" Absolute or Incremental? This is very important to know when programming. What Machine Tool is It? Tsugami, Nokamora Tome, Ikegai, Mori Seiki, Hitachi Seiki, or Dainichi?

Before I forget go to www.ncplot.com this will help you to view your programs before sending them to the Lathe. It also will help you to learn to hand code.

jrobson
08-02-2006, 11:18 AM
Hi

Thanks I will look at the link, I and K are absolute, machines are Ikegai and Mori Seiki, Hitashi Seiki and Wasino are both 6t.

tobyaxis
08-02-2006, 11:26 AM
Ok I will post a simple drawing and G-Code using "I" and "K"

jrobson
08-02-2006, 11:39 AM
Thanks!

tobyaxis
08-02-2006, 11:51 AM
This should be what you need.
O0000
(IKEGAI FANUC 6T)
G0 G40 G97 G99 M5
G28 U0 W0 M9
G50 S2000 M39
M1

N3(F-F/T)
G28 U0 W0
T0300
G50 X(RP) Z(RP) M8
G96 S650 M3
G0 X4.2 Z.1 T0303
G42G1X0.F.025
G1Z0.F.006
X0.5
G3X1.Z-0.25I0.K-0.25
G1Z-0.75
G2X1.5Z-1.I0.25K0.
G1X3.5
X4.Z-1.25
Z-4.
X4.1F.025


G40 G0 Z.1 M9
G0 X(RP) Z(RP) T0300
G28 U0 W0
G97
M1

Sorry it took so long a Client called. Follow the program from X0 Z.1

tobyaxis
08-02-2006, 12:15 PM
I just sent you my email address if you need additional help with this.
:cheers:

jrobson
08-03-2006, 02:30 AM
Hi

Yes that is logically correct the way I see it and the way I calculate it as well, however if you take that same drawing, run it through something like edgecam and compensate for the tool radi it looks completely different(ex:G3 X1.004 Z-0.291 I0.081 K-0.211) , what sometimes happens with a code like yours is that the circular bit isn't 100% smooth, it usually has a ridge, once the code is changed to the figures from the computer it is smooth.

tobyaxis
08-03-2006, 01:58 PM
Hi

Yes that is logically correct the way I see it and the way I calculate it as well, however if you take that same drawing, run it through something like edgecam and compensate for the tool radi it looks completely different(ex:G3 X1.004 Z-0.291 I0.081 K-0.211) , what sometimes happens with a code like yours is that the circular bit isn't 100% smooth, it usually has a ridge, once the code is changed to the figures from the computer it is smooth.

What do you mean smooth? Are there flat spots at the largest points in the diameter. I recieved your email and Iges file. The arc segments are 90 degree and 180. I hope this works for you.
:cheers:

%
90 DEGREE ARC SEGMENTS
NOTICE THE G3 HAS TW0 LINES OF
G-CODE

****NOTE****
TO USE TOOL NOSE RADIUS
COMPENSATION YOU MUST CHANGE
TOOL TIP REGISTER TO T8

SET THE RADIUS "R" TO THE TOOL NOSE
RADIUS YOU ARE USING EX. VNMG431 HAS
A .0156 TNR R=.0156

G3 IS MODAL UNTIL CHANGED

N3(F-F/T VNMG431 SECO FF1 TIP 8)
G28U0W0T0
T303M8
G96S650M3
G50X(RP)Z(RP)
G0X12.7Z2.54
G42G1X2.54Z0.F.015
Z-1.6829F.008
G3X9.Z-6.I-1.27K-4.3171
X2.54Z-10.3171I-4.5K0.
G1Z-10.73
X12.7F.015

G0G40Z25.40M9
G50X(RP)Z(RP)
G28U0W0
G97
T0
M1
_____________________________

180 DEGREE SEGMENT

N3(F-F/T VNMG431 SECO FF1 T8)
G28U0W0T0
T303M8
G96S650M3
G50X(RP)Z(RP)
G0X12.7Z2.54
G42G1X2.54Z0.F.015
Z-1.6829F.008
G3Z-10.3171I-1.27K-4.3171
G1Z-10.73
X12.7

G0G40Z25.4M9
G50X(RP)Z(RP)
G28U0W0
G97
T0
M1
%

lakeside
08-03-2006, 02:05 PM
what the ridges jrobson is refeering to, is the end point of the r value the tool is stopping for a milla-second before completing move (look a head) with I and J the move is a full motion-a full block of code

tobyaxis
08-03-2006, 02:20 PM
what the ridges jrobson is refeering to, is the end point of the r value the tool is stopping for a milla-second before completing move (look a head) with I and J the move is a full motion-a full block of code

Some Lathes do not accept a full 180 degree radius move, at least probibly not his. It's pretty old. The 1984 Ikegai Fanuc 6T might, but I never got a part with this type of geometry to try it. Here is the drawing Mike.
Seems it won't post here. Sending to your email.

Navigator
08-28-2006, 06:48 PM
To count I and J (in turning applications K) you just need to calculate each axis movement,that's all... related to the quadrant and direction... I know how to calculate it but still have a problem with right signs definitions :) ...accordingly to the direction :) does anyone knows about it? thank you in advance...

tobyaxis
08-28-2006, 07:09 PM
To count I and J (in turning applications K) you just need to calculate each axis movement,that's all... related to the quadrant and direction... I know how to calculate it but still have a problem with right signs definitions :) ...accordingly to the direction :) does anyone knows about it? thank you in advance...


Navigator,

You could have started a new thread but that's ok. The Signs (- +) are relative to what your machine control will accept. Some actually take the (+) sign where some don't.

What Control Year and Model are you working with? Also if you could post a (dxf, dwg, iges, step, sldprt) CAD drawing this will help too.


Here is a basic Drawing.
X+ is the distance positive in the X axis usually without a (+) Sign
Z+ is the distance postive in the Z axis usually without a (+) Sign
BTW: Welcome to the Zone. :cheers:

Navigator
08-29-2006, 05:51 PM
Thank you,I'll try to worked it out practisi :wave: ng . Now I have another problem. In our workshop we have a deal with the parts which have bolt hole circles. Sometimes we have to locate up to five six such a parts on one jig and the biggest problem is to write program for it.( I didn't mean calculations ,I meant length) For example: 6 bolt hole circles,in each up to 20 holes,three operations should be done (drilling,spot drilling and tapping) how many lines I need? 120 coordinate lines for one operation!. I know little bit how to work with subprogramms,but only with grids and other straight patterns. I know also that it's available with macros I even have a Peter Smid book about it,but don't know how to start it... So I think I found decision but not sure I'm right.(By the way,it's very easy with datum shift on Heidenhain)
FAnuc GE 0M series: O2677;(pgm number)
T1;
MO6;
G21G54;
G90G00X...Y...M08; (FIRST HOLE LOCATION)
G43Z50.0H1S1000M03;
G98G81Z-10.0R5.0F100;
M98P5999; (SUB CALLING)
G90G10L2P1X...Y...;
M98P5999;
G90G10L2P1X-...Y... (RESTORE DATUM,NOT SURE I HAVE TO DO IT AFTER EACH SUBPROGRAM?)

O5999; (SUBPROGRAM)
G91 X... Y...; LISTING OF ALL HOLES IN ONE CIRCLE.ALL MOVEMENTS CALCULATED IN INCREMENTAL MODE ALONG EACH AXIS SEPARATELY,JUST A DISTANCE BETWEEN THE HOLES.
X... Y...;
AIM IS TO SHORTEN PROGRAMM. EVERY STARTING HOLE IN A NEW CIRCLE SHOULD BE IN ABSOLUTE MODE AND THEN I THINK I CAN SWITCH IT TO THE INCR. IT'S JUST SUGGESTIONS... :)
(SORRY FOR MY POOR ENGLISH) :)

IT'LL BE VERY HELPFULL FOR OUR WORKSHOP CAUSE WE WASTE A LOT OF TIME JUST FOR WRITING PROGRAMMS IN AND CHECK THEM... THANK YOU FOR ANY HELP ON THIS MATTER :) :wave:

tobyaxis
08-30-2006, 06:30 AM
It looks good. I'm going to assume that this machine is a Horizontal with a Pallet changer due to the (G90G10L2P1X...Y...) or it's some work coordinate system I have not used yet. One thing to remember when Sub-Programming in Incremental G91

Common Practice is to change an Incremental G91 back to Absolute G90 at the end of a Sub-Program. This is to avoid any unwanted geometry that could scrap a part or break a tool.

I know this is a Drilling Location Sub but here is another tip. If you are doing an outside profile in steps(Pockets too) with a Sub-PGM always call your Cutter Compensation in the Main Program before entering the Sub-PGM. Then Cancel at the end of the Sub-PGM before going back to the Main Program. This is so restarts are a little less complicated.

Also since you are most likely using a Sub-PGM to shorten the overall size of a Program I like to call my X/Y positions at the begining and the end in Absolute G90 when pocketing/profiling. It doesn't hurt to add a little safety.

One last note****You can only Nest a Sub-Program 6 times in a Fanuc Control. In other words Jumping from Sub #1 to #2 to #3, #4, #5, #6 >>>Return to the Main Program. After 6 nests you will have to return to the main program. If you don't the control will alarm.

These will save tools and parts alike ;)

Well Done BTW. It looks like you have it.
:cheers:

uav
08-30-2006, 10:29 AM
Navigator

It is example macro program circular drilling.

%

( drill 5.0 mm)
G17G0G90G54X60.Y60.
G43H8Z50.
M13S1500
G81G99Z2.R11.F200
G65P8507X60.Y60.R40.D20.H9.A45.
G80Z200.M5M9
M2

:8507
/ #24 = X CENTER
/ #25 = Y CENTER
/ #18 = R RADIUS CIRCLE
/ #7 = D ANGLE BETWIN HOLES
/ #11 = H NAMBER HOLES
/ #1 = A START ANGLE
#30=#4003
G90
IF[#24 EQ #0]GOTO 30
IF[#25 EQ #0]GOTO 30
IF[#18 EQ #0]GOTO 30
IF[#7 EQ #0]GOTO 30
IF[#7 EQ 0]GOTO 30
IF[#11 EQ #0]GOTO 30
IF[#11 EQ 0]GOTO 30
GOTO 50
N30#3000=175(OSCHIBKA V PARAMETRAH)
N50IF[#1 NE #0] GOTO 60
#1=0
N60#31=0
#32=0
WHILE[#32LT ABS[#11]]DO1
#33=#31+#1
X[#24+#18*COS[#33]]Y[#25+#18*SIN[#33]]
#32=#32+1
#31=#31+#7
END1
/G#30M99




run video drilling- http://www.ncmanager.com/NCManagerVerifyReg.exe

Navigator
09-02-2006, 01:54 PM
thanks a lot. I didn't try it yet but will definitely. I work with an old GE Fanuc 0M very old model :)