[Home][News} [CADCAM] [Contents] [Search] RadialSoft

ISO NC Code

 

Next

  Web 
Eventually CAM packages produces some sort of code for Numerical Command. Many of these machines follow the so called G code principle. Unfortunately all machines have a different dialect. Even if new ones are more tolerant, old machines are still in action and cannot be changed before years. Our aim here is to collate various forms of codes.

See also our RSCAM product.

General syntax of NC files is

A set of lines separated by <CR> or <CR><LF> or <LF>
On each lines a set of letters follow by numbers with or without decimal point. We say address
G codes and M codes are followed by parameters given by address X, Y etc..
Some codes are exclusive from others : G40 will not be revoked by a G1, but a G0 is revoked by a G1
Values of register stay until a new value is given.

example

N10 G0 X0 Y0
N20 G1 X100
N30 Y100
etc..

On line N20 Y is still G0, on line N30 move code is still G1, X stay at 100

To describe the various dialect you will have to recognize sequence corresponding to elementary operations.

G Codes

Moves

Exclusion group G0, G1, G2, G3

Fast move

usually G0 followed by the coordinates that changes : G0 X100 Y0

Machining move

usually G1 followed by the coordinates that changes : G1 X0 Y00

Circular Interpolation

usually G2 or G3 depending on the orientation ( G2 is clockwise) followed by the coordinates of the end point and either the radius or the coordinates of the center point given by I and J : G2 X0 Y0 R75 or G2 X0 Y0 I50 J50. Of course if you use the radius you can't define arcs more than 180° in on step.

Filleting

For lathes. G33

Stop

G4. The delay will be given by another address

Tool correction

Toolpath may be centered or corrected on left or on right of the defined contour. usually

G40 will indicate a centered toolpath
G41 will indicate tool is on left of the programmed toolpath
G42 will indicate tool is on right of the programmed toolpath
Some NC machine support G43 completed by another address to give tool correction

Exclusion group G40, G41, G42, G43

Call of sub program

This feature is not supported by many old controls. G77 is sometime used for that with line number of macro in H

Coordinates offset

This is used when a piece of program has to be executed in multiple places.

G90 followed by X, Y and Z will give a new origin related to absolute origin. Thus G90 XYZ will reset origin to absolute origin.

G91 followed by X, Y and Z will give a new origin related to current origin

Cycles

Simple Drilling: G81
Roughing for lathes G84

Complementary address will be

For depth: P or R
For slice size

M Codes

Program run

M0 Stop the whole thing. Imply M5

M1 Optional stop. Usually for debug time.

M2 End of program

Spindle rotation

M3 Spindle rotates clockwise

M4 Spindle rotates counterclockwise

M5 Stop spindle

M3, M4 and M5 exclusive each other

Tool

M6 change tool

Coolant

M7 Maximum coolant

M8 Normal coolant

M9 Stop coolant

Other address

They are usually following G and M codes to give parameters

Tool change, Tool offset

Tool number is very often indicated by the address T like T01 means tool number 1. Sometimes the decimal position after indicates the offset index in the tool correction table.

Feed rate

Feed rate is often indicated by F

Speed rate

Speed rate is often indicated by S

Angles

Angles may be used for rotating axis A, B, C

Coordinates

Cartesian coordinates are usually X, Y and Z. Lathes are programmed in the XZ plane.

Program header

This may be various. Some controls will expect a % sign.

Some controls accept or refuse

Space between address letter and value X 0 instead of X0
Space between address X0Y0 instead of X0 Y0
Unspecified coordinates means they are stable
Tool correction can be changed anywhere
+ sign before positive numbers
G02 same as G2, G same as G0
Lines must all be numbered
Some NC machines will allow multiple moves on one line: G1 X0 G1 Y100 etc..
Other File format  Web
Note this Icon : External Link means that the link you will follow is external to this site.

           
Contact webmaster@radialsoft.com for comments about this website.
Copyright © 2000-2003 RadialSoft Corp - Last modified: December 1, 2003 - Disclaimer