0% found this document useful (0 votes)
67 views23 pages

ISO G Code Basics for CNC Milling

This document is a preliminary guide for programming CNC milling operations using ISO G code. It covers defining contours through linear and circular interpolation, header information for tool setup, and cutter radius compensation. The document also emphasizes the importance of modal commands and provides examples of G code syntax for effective CNC programming.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
67 views23 pages

ISO G Code Basics for CNC Milling

This document is a preliminary guide for programming CNC milling operations using ISO G code. It covers defining contours through linear and circular interpolation, header information for tool setup, and cutter radius compensation. The document also emphasizes the importance of modal commands and provides examples of G code syntax for effective CNC programming.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Basic ISO Programming Exercise 1

Milling

This document is made available as a preliminary version (draft).


Questions and feedback should be sent to support@[Link]
Table of Contents

1 Introduction ................................................................................................................................. 3
2 Defining the contour .................................................................................................................... 5
2.1 Linear interpolation ..................................................................................................................... 5
2.2 Circular interpolation ................................................................................................................... 6
2.3 Header information ..................................................................................................................... 9
2.4 Cutter radius compensation ...................................................................................................... 12

2 / 23

CIMCO A/S Tel: +45 45 85 60 50 [Link]


Copenhagen, Denmark Fax: +45 45 85 60 53 info@[Link]
1 Introduction

See below a drawing of a plate with 8 mm holes. We will work through the programming using ISO G
code to prepare a program to machine the outside profile and drill the holes.

ISO G code is used by many CNC control manufactures and the main groups of G codes for move
commands, units designation, orientation of axis, spindle speeds, rates of feed are generally the same.
Some other G codes may differ from one CNC control to another. The G codes and programming
principles used here will be generally in line with Fanuc, Siemens, Haas, Fagor and other CNC controls.

We will consider profile milling first. When programming the part, we will use the drawing dimensions to
describe the tool path. The program will be made up of line by line (block by block is the term used)
information that will comprise straight lines and arcs. The basic move commands that make up Group 1,
ISO programming instructions are modal commands. This means that after a block with one of these
commands, following blocks with X, Y, coordinates positioning moves will be carried out in the same
mode. The commands are as follows:

1. G00 – Straight line moves at rapid speed (On some machines this move is made in a vector line
and on others a 45-degree move is followed by a single axis move to achieve the final
programmed position). This is a modal command.

2. G01 – Linear interpolation blocks will be carried out in linear vectored moves at the feed rate
programmed. This is a modal command.

3. G02 – Circular interpolation clockwise moves at the feed rate programmed. This is a modal
command.
3 / 23

CIMCO A/S Tel: +45 45 85 60 50 [Link]


Copenhagen, Denmark Fax: +45 45 85 60 53 info@[Link]
4. G03 - Circular interpolation counterclockwise moves at the feed rate programmed. This is a
modal command.

See the drawing below that has the profile broken down to represent the points on the profile where
elements start and finish. The programming X and Y zero point is shown by the checkered circle so all
dimensions will fall in the X plus, Y plus, quadrant.

4 / 23

CIMCO A/S Tel: +45 45 85 60 50 [Link]


Copenhagen, Denmark Fax: +45 45 85 60 53 info@[Link]
2 Defining the contour

So let us begin entering points on this profile directly into the Editor.

2.1 Linear interpolation


The linear interpolation points are very easy to enter. If we have only one axis command X or Y on a line,
then a move in a straight line in that axis will take place. If we have and X and a Y on the same line with a
G1 or G01 prefix, then a linear interpolation will take place with both axis moving in a direct accurate
vector to finish together at the commanded positions at a feed rate as designated in the block or in an
earlier block as feed is also modal.

Select Editor and New to open a new text


edit page for programming. Commence
entering the points on the profile using X, NOTE: Comments in brackets are
Y, Cartesian coordinates. ignored by the CNC control.

5 / 23

CIMCO A/S Tel: +45 45 85 60 50 [Link]


Copenhagen, Denmark Fax: +45 45 85 60 53 info@[Link]
2.2 Circular interpolation
After point 3 comes a circular interpolation move and more information is required for the CNC control to
carry out this move.

We have already entered the start point 3 and we are going to point 4 in a clockwise direction the block
will start

G02 X20. Y85.


The CNC control must have the arc centre fixed to be able to interpolate this move. The arc centre is
fixed generally by its coordinates from the start point. The arc centre coordinates have the designation I
for X and J for Y. So, from the start point the I and J are entered as incremental coordinates as below.

G02 X20. Y85. I20. J0


The CNC Control now has all the information to make this circular move. See that the I arc centre is a
positive dimension. Had we been going in the G03 direction then the I are centre would have been I-20.
Notice that the J arc centre is 0 (zero) as J is the coordinate for the arc center from the start point on the
Y axis.

Note!! With signed plus or minus I & J arc centre designation it is possible to program a full 360-degree
circle. It is also possible to use radius designation instead of I & J but then the maximin arc possible is
180 degrees. Some CNC controls prefer to use only I & J arc centre designations. Some CNC controls
permit the use of arc centre designation from the absolute zero position rather than incrementally from the
start point but here we will use I & J from start point. When programming a specific CNC machine, the
CNC control programming manual may need to be referred to.

When the profile entries are complete then test using Backplot. This test will show up any inaccuracies in
the profile entries. Add a feed rate on the first G01 line. Feed rate is modal, as stated before and all other
interpolated blocks will be move at the feed rate last designated.

Do not forget to change from circular to linear from element to element as the profile changes. All group
1, move commands are modal e.g., after a G02 block if you were to enter X Y coordinate the CNC control
will still try to move circular unless you place a G01 at the start of the block to define that this move is now
linear.

6 / 23

CIMCO A/S Tel: +45 45 85 60 50 [Link]


Copenhagen, Denmark Fax: +45 45 85 60 53 info@[Link]
Programming good practice is to layout a block in order. This will help you see the problems when
snagging a program for bugs. e.g.

N155 G01 X150. Y210.25 F200 M03 S1000

If you use block numbers put them first, G code command next in X,Y,Z, coordinates
in order, Feed rate commands next then M,S,T commands.
It is possible to have all these commands in one block or as few as a single command
in a block and some machine tool builders permit more than one M code in a block,
some others do not.

When you have finished the block entry test with the Backplot facility in the Editor and you should have a
good toolpath plot as below when the all the blocks are correct.

7 / 23

CIMCO A/S Tel: +45 45 85 60 50 [Link]


Copenhagen, Denmark Fax: +45 45 85 60 53 info@[Link]
See the correct profile syntax below to check your profile.

G00 X-20. Y42.5 (POINT 1)


G01 X0 F100 (POINT 2)
Y65. (POINT 3)
G02 X20. Y85. I20. J0 (POINT 4)
G01 X90. (POINT 5)
G02 X110. Y65. I0 J-20. (POINT 6)
G01 Y55. (POINT 7)
G03 X120. Y45. I10. J0 (POINT 8)
G01 X140. (POINT 9)
G02 X150. Y35. I0 J-10. (POINT 10)
G01 Y10. (POINT 11)
G02 X140. Y0 I-10. J0 (POINT 12)
G01 X20. (POINT 13)
G02 X0Y20. I0 J20. (POINT 14)
G01 Y42.5 (POINT 15)
G01 X-20. (POINT 16)

8 / 23

CIMCO A/S Tel: +45 45 85 60 50 [Link]


Copenhagen, Denmark Fax: +45 45 85 60 53 info@[Link]
2.3 Header information
Now, we must introduce a tool and enter blocks that will put the tool in the spindle and position the tool to
commence the machining operation. Every time we start with a new tool, we need to create the header
blocks prior to the machining blocks. See suggested general header below

G00 G90 G49 G98 Safety blocks to set start conditions of modal commands
G00 set rapid traverse
G90 set absolute coordinates
G49 cancel tool length offsets
G98 set feed in mm/mim (Haas)

G28 W0 Send Z axis up to home. W is the incremental command for Z


G28 return to home position
W0 incremental move in Z direction (XYZ Absolute, UVW
Incremental) Fanuc, Haas

G54 X0 Y0 move to programming X0, Y0, as set in G54 work offset table
G54 call the work offset that has been set up to establish the
programming zero of the part on the machine table.

(16 MM CARBIDE END MILL) Tool description comment

T1 M6 Select tool number 1 with T1, put the tool in the spindle with M6
T1 or T01 selects the tool
M6 or M06 put the tool in the spindle

S1000 M03 Start the spindle to 1000 rpm in the forward direction with M3
S1000 is commanding 1000 rpm, M3 or M03 is starting the
spindle forward direction

G43 H1 Z50. Take up the tool length H1 from tool offset table with G43,
position the tool 50 mm above Z0

G43 is activating the tool length offset, H1 or H01 is the tool


length seat in the table, Z50. Move the tool to 50 mm above the
Z0 position.

G00 X-30. Y42.5 Position the tool over the 1st hole coordinated.

G00 is repeating the rapid traverse command as it is already


modal from the 1st block.
X-30. Y42.5 move to the safe start position before traveling
down in the Z axis to avoid collisions.

(PROFILE) Comment to mark the commencement of the profile

9 / 23

CIMCO A/S Tel: +45 45 85 60 50 [Link]


Copenhagen, Denmark Fax: +45 45 85 60 53 info@[Link]
Header blocks

The tool is at 50 mm above the Z0


surface, and the tool now needs to be
positioned to make the profile cut

10 / 23

CIMCO A/S Tel: +45 45 85 60 50 [Link]


Copenhagen, Denmark Fax: +45 45 85 60 53 info@[Link]
We choose to position the X, Y axes before going
down in Z so that we do not collide with the work
stock.
Move down in Z to 3 mm above the surface in rapid
traverse and finally to Z-16. in G01 at a high feed
rate. This positioning in a cautious manner is
recommended.

11 / 23

CIMCO A/S Tel: +45 45 85 60 50 [Link]


Copenhagen, Denmark Fax: +45 45 85 60 53 info@[Link]
2.4 Cutter radius compensation
From the drawing it can be seen that the tool path must be offset to make the finished part to the correct
size.

Offset Path

There are G command that will activate an offset path as follows:

G40 - Cancel Radius Offset Compensation

G41 - Activate a Radius Offset path (Radius Compensation is the term used) to the left in the direction of
travel.

G42 - Activate a Radius Offset path to the right in the direction of travel.

We now need to apply these G codes, but the CNC control needs more information about the size of
offset path. In the Tool Offset table, the cutter Radius is entered. On the block where the G code is
entered, we must add the D radius offset. When the G code and D radius are read by the CNC control the
offset path will be activated within the move.

From the drawing we can see the direction of travel around the periphery of the part is counterclockwise.
Therefore, we will offset the path to the left in the direction of travel by using G41

See below:

12 / 23

CIMCO A/S Tel: +45 45 85 60 50 [Link]


Copenhagen, Denmark Fax: +45 45 85 60 53 info@[Link]
See inserted G41 to apply Tool Radius
Compensation and D1 to apply the radius
from the CNC table.
We have selected G41 as we are to the left
of the profiles in the direction of travel.
These commands should be on the block
where the tool is approaching the profile and
the move will be a greater distance than the
cutter radius. Generally, on CNC controls this
will be a G01 linear move

See inserted G40 to cancel Tool Radius


Compensation.
This command should be on the block where
the tool is leaves the profile and returns the
start position.

Test with Backplot and see below:

Backplot has tracked the profile as programmed and used a random tool as no tool has been setup then
we have a basic tool centre path Backplot.

13 / 23

CIMCO A/S Tel: +45 45 85 60 50 [Link]


Copenhagen, Denmark Fax: +45 45 85 60 53 info@[Link]
We must now setup a tool to enable the editor to give us a true finished profile. There is separate tutorial
to explain in detail how to use the Tool Setup within the Backplot facility. However, there is a basic set of
tools that can be configured within NC-Assistant. See below how to find and set up a tool.

Go to the NC-Assistant tab in ISO Milling

14 / 23

CIMCO A/S Tel: +45 45 85 60 50 [Link]


Copenhagen, Denmark Fax: +45 45 85 60 53 info@[Link]
Pull down the System menu and select Basic
Milling Tools

Place the cursor in a position before the


operation to insert the tool details

A set of basic tools will appear in the


NC-Assistant area for selection

15 / 23

CIMCO A/S Tel: +45 45 85 60 50 [Link]


Copenhagen, Denmark Fax: +45 45 85 60 53 info@[Link]
We need a 16 mm End Mill

We need a 16 mm End Mill to carry out this


operation so double click End Mill in NC-Assistant
and fill in the details

The resulting insertion will create the tool data required


by the editor to carry out a Backplot with tool length
and radius taken into consideration. The CNC control
will ignore this line as it will be seen as a comment
only.

16 / 23

CIMCO A/S Tel: +45 45 85 60 50 [Link]


Copenhagen, Denmark Fax: +45 45 85 60 53 info@[Link]
Test with Backplot and see below:

Backplot has tracked the profile by using the Tool Data provided and the Tool Path is now showing the
corrections. This will become more evident when we apply the stock sizes from NC-Assistant.

Compare this to the original Backplot and it


shows that the radius’s are different as the
Backplot is now showing compensated tool
path.

17 / 23

CIMCO A/S Tel: +45 45 85 60 50 [Link]


Copenhagen, Denmark Fax: +45 45 85 60 53 info@[Link]
IMPORTANT NOTE: Make sure that the Radius compensartion in the Similation settings is set to
Enabled.

Select Simulation on bottom right-


hand tabs and set Radius
Compensation to Enabled

Let’s now apply the stock sizes to the program. This again will be in the form of comments so the CNC
control will ignore these blocks, but the Editor will use the sizes to create a stock block when Backploting.

Double click the Stock Size and Position and


complete the details of max and min sizes.
Position the cursor at the top of the program

18 / 23

CIMCO A/S Tel: +45 45 85 60 50 [Link]


Copenhagen, Denmark Fax: +45 45 85 60 53 info@[Link]
See Stock sizes used by the
Editor to create a stock block
image when Backploting.

With the Stock Size we now have an accurate Backplot of the part as it would be profiles on the CNC
Machine.

19 / 23

CIMCO A/S Tel: +45 45 85 60 50 [Link]


Copenhagen, Denmark Fax: +45 45 85 60 53 info@[Link]
Now we can proceed with the drilling operation by first writing the hole coordinates in the Editor.

Now we will apply the drilling canned cycle G81 that will be used by the CNC control to set up a modal
drilling cycle at the end of every coordinate move until the code G80 is read to stop the drilling operation.

Select G81 from NC-Assistant and


complete the details

20 / 23

CIMCO A/S Tel: +45 45 85 60 50 [Link]


Copenhagen, Denmark Fax: +45 45 85 60 53 info@[Link]
We have incorporated the first hole into the cycle, so we do
not need the next X20. Y20. line and can delete it.
Notice Z is the final depth and R is the position the tool rapids
down to before drilling the hole at Feedrate F.
On completion of the drilling operation enter the line G80.
This will cancel further drilling of a hole after the next
positioning move.

We have inserted a header and a


trailer by copying for the first tool
header and making the simple
edits to suit the drilling operation.

21 / 23

CIMCO A/S Tel: +45 45 85 60 50 [Link]


Copenhagen, Denmark Fax: +45 45 85 60 53 info@[Link]
We now have to setup the Tool for this operation so we will visit the Basic Milling Tool list see below.

NC-Assistant Tab, ISO Milling, Basic Milling Tools

Position the
cursor here
under the first

Basic Milling Tools appears here. Double click Drill


and fill in the details. Press OK

Tool 2 is inserted, at this point you can get rid


of the empty lines

22 / 23

CIMCO A/S Tel: +45 45 85 60 50 [Link]


Copenhagen, Denmark Fax: +45 45 85 60 53 info@[Link]
Now complete with a full Backplot to see the program complete with Radius and Length Compensation

23 / 23

CIMCO A/S Tel: +45 45 85 60 50 [Link]


Copenhagen, Denmark Fax: +45 45 85 60 53 info@[Link]

Common questions

Powered by AI

The potential challenges of using different CNC machines for the same G code program arise from the variations in how different CNC controls interpret certain G codes. Although many G codes like those for linear and circular interpolation are standardized, specific machine commands may vary between manufacturers or models such as Fanuc, Siemens, or Haas . Some machines might have additional proprietary codes, differing modal command interpretations, or varying handling of arc centre definitions (incremental versus absolute). These differences necessitate adjustments tailored to each machine's specifications to ensure compatibility and prevent errors in machining operations.

The use of modal commands in ISO programming is significant because it reduces redundancy in code by allowing certain commands to remain active until they are explicitly changed. This feature enhances machining efficiency by minimizing the amount of necessary code, thus streamlining programming and focusing on essential commands for smoother transitions and clearer instruction sets . For instance, once a modal command like G01 is set, all subsequent coordinate moves execute as linear interpolations without re-specifying the command, which reduces the potential for human error and optimizes the command processing by the CNC control .

The programming technique to switch from circular back to linear interpolation involves explicitly specifying a G01 command at the start of the block where the transition is needed. After a G02 or G03 block, the CNC control expects subsequent commands to continue the circular motion until instructed otherwise . Therefore, inserting a G01 command breaks this expectation and redefines the move as linear, ensuring that the paths execute correctly as per the design requirements. Modal commands must be explicitly changed to modify the control's current operational mode .

The G01 command in ISO G code programming is used for linear interpolation, where both axes move in a direct and accurate vector to finish together at the commanded positions at a designated feed rate . In contrast, G00 is used for straight line moves at rapid speed, primarily for positioning purposes. G00 is a vector line move on some machines and a 45-degree move followed by a single axis move on others to achieve the final position . Both commands are modal, meaning if unspecified, subsequent blocks will continue the last specified command.

Verifying CNC program entries using a Backplot test is crucial as it visually simulates the tool path generated from the programming code. This verification step is essential to identify any inaccuracies or errors in the movement paths before actual machining, thus preventing costly damage to the workpiece or tool. The Backplot test enables programmers to check if their tool paths adhere to design specifications by highlighting deviations and ensuring that modal commands are correctly executed throughout the program . By using simulated feedback, Backplot serves as a diagnostic tool that can improve overall machining precision and reliability .

The inclusion of header information in a CNC program establishes initial conditions necessary for the machining operation, effectively setting up the environment the CNC machine operates within. Headers may include tool data, coordinate system settings (e.g., G90 for absolute positioning), and preparatory commands that are essential for the successful execution of subsequent machining blocks . This structured approach reduces setup errors, enhances the consistency of execution, and ensures the safe operation of machines by preemptively defining critical attributes before machining begins .

The use of NC-Assistant and Backplot in CNC programming aids the development and simulation process significantly by providing tools for creating, editing, and verifying CNC programs. NC-Assistant allows for the integration of basic tooling details directly into the code, facilitating streamlined program creation with accurate tool data . Backplot provides a visual preview of the tool path based on the programmed instructions, which is essential for verifying the accuracy and feasibility of the code before commencing actual machining . These tools enhance the efficiency and reliability of program development through accessible, real-time feedback and debugging capabilities .

Careful management of feed rates in a CNC program is crucial as different types of interpolation or machining processes require varying mechanical demands. Different feed rates directly influence the quality of the final product, tooling wear, and machining speed. Specific transitions, such as moving from rapid G00 moves to precise G01, G02, or G03 interpolations require feed rates that are consistent with the demands of the operation to maintain surface finish quality and prevent mechanical stresses . Additionally, since feed rates are modal, failure to update them accordingly can lead to unanticipated machining results or damage if inappropriate speeds are inadvertently applied across different operations .

In CNC programming, the I and J parameters are used to define the arc center during circular interpolation. I is the X coordinate of the arc center relative to the starting point, while J is the Y coordinate. These incremental coordinates help the CNC control interpolate a circular path by providing the necessary geometric constraints for the G02 or G03 command, which directs the machine for clockwise or counter-clockwise circular moves respectively . This enables precise arc formation and can facilitate programming a full 360-degree circle .

Cutter radius compensation is used in CNC machining to account for the physical size of the cutting tool, ensuring that the tool path produces a workpiece of accurate dimensions. The compensation allows the programmer to offset the tool path from the specified geometry by utilizing commands such as G41 for offsetting to the left and G42 for offsetting to the right relative to the direction of travel . This adjustment is crucial when contouring parts, as the cutter radius affects the outcome of the machined profile. The CNC control reads the cutter's radius from the tool offset table and adjusts the path accordingly to maintain precision .

You might also like