CNC Manual
CNC Manual
CNC
LABORATORY MANUAL
ASTC 1
MECHANICAL ENGINEERING
CNC stands for computer numerical control. The evolution towards the current state
began with NC, or numerical control only.
The first NC machines were built in the 40s and 50s. These machines based on existing
tools but with some modifications.
Motors moved based on the informational input given to them via punched tape. The
code was manually punched into data cards.
In the 50s, the first steps towards CNC machining were done. At first, MIT’s computers
were ready to produce the punched tape according to the inputs. In one instance, this
reduced the time spent on producing the card from 8 hours to 15 minutes for a milling
job.
Such time-saving capabilities resulted in more R&D work in the field. Soon the first
programming languages for CNC machining became available. Over time, largely
because of decreasing computer prices, CNC took over the reigns from NC
How Do CNC Machines Work?
Contemporary CNC machines are fully automated. All they need is digital files with the
instructions about cutting trajectories and tooling.
Design or machining processes require many tools to produce a certain part.
Machinists can build digital tool libraries that interface with the physical machine. Such
machinery can automatically switch tooling based on the digital instructions, making
them manufacturing workhorses.
The CNC machining process starts with designing the parts in CAD software. The 3D
model determines the necessary dimensions and properties of the final part.
Some of these programs come in CAD-CAM packages, so the flow can continue in the
same programs. Otherwise, CAD models are fed into designated CAM software. If both
CAD and CAM are from the same product family, no translation of files is necessary.
Otherwise, the CAD files need to be imported.
CAM (computer-aided manufacturing) software prepares the model for the whole
fabrication process. First, it checks the model for errors. Then it creates a CNC program
to fabricate the physical part.
The program is, in essence, a set of coordinates that guides the cutting head during the
manufacturing process.
ASTC 2
MECHANICAL ENGINEERING
The third step is choosing the right parameters. These include cutting speed, voltage,
RPMs, etc. The configuration depends on the geometry of the part as well as the
available machinery and tooling.
Lastly, the software determines the nesting. Nesting means the orientation and
placement of parts relative to raw material. The purpose is to maximise the material
usage.
All this information is then translated into codes that the machinery can understand –
M-code and G-code.
G-Code vs M-Code
A common misconception is that G-code is all you need for running machining
operations. However, this is not true, as the code can be separated into the two codes
mentioned above.
G-code refers to a language that is used to tell a machine how to move. Basically, it is
the geometric code. G-code determines the movement and speed of cutting heads.
The instructions are fed to a machine controller which is just an industrial computer.
This, in turn, dictates how the motors should move. And the motors, of course,
determine the path to be followed.
The M-code, on the other hand, gives all the info that the G-code overlooks. That’s
why it is called either machine code or miscellaneous code.
M-code’s instructions include information about the use of coolant, tool change,
program stops, etc.
So both are equally important but not the same.
What Is CNC Machining?
So, we now know how CNC machines work. But not all these machines are used for
CNC machining.
We will take a closer look at all the different types of CNC machines that are available
a little later. But in a traditional sense, CNC machining refers to only a few of these
automated processes. Namely milling, turning, grinding, routing, drilling, etc.
ASTC 3
MECHANICAL ENGINEERING
Milling:
ASTC 4
MECHANICAL ENGINEERING
It is an operation where the cutting tool rotates. When the milling tool comes into
contact with the workpiece, it removes chips from it.
Milling operations include:
End milling
Chamfer milling
Face milling
Drilling, boring, tapping, etc.
Turning:
ASTC 5
MECHANICAL ENGINEERING
While the two are often called just CNC machining, turning and milling have distinct
differences. Turning is pretty much the opposite of milling. This means that instead of
the cutting tool, the workpiece is rotating.
CNC turning is commonly used for producing shafts, for example. The tool is brought
against the rotating workpiece to cut off bits of metal, known as chips or swarf.
Achieving high accuracy for a suitable type of limits and fits system is possible.
Turning is usable on the outside of a cylinder or on the inside. The latter operation is
called boring.
ASTC 6
MECHANICAL ENGINEERING
Grinding:
CNC grinding machines use a rotating grinding wheel to remove material. The
objective is to give a high precision finish to a metal part.
The achievable surface quality is very high. Therefore, it is used as a finishing operation
rather than creating the final piece from raw materials.
Routing:
CNC routers are seemingly similar to CNC milling machines. Here also the rotating
piece is the cutting head. The main difference lies with the materials suitable for
cutting.
Routers are a perfect fit for cutting softer materials (not metals) that do not require
very high accuracy. The reason for that is its lesser output power.
At the same time, routers are quicker. Therefore, they are able to produce the parts in
less time.
Drilling:
While milling equipment can also produce holes, drills are meant for only that job.
The difference? While milling tools use cutting edges around the cutting head’s
periphery, drills use the tip of the tool to produce a hole.
CNC drilling machines are commonly used to automate this job, provide better
accuracy and a more cost-effective solution.
Types of CNC Machines:
As said before, CNC machines are not limited to the traditional sense of CNC
machining equipment.
CNC is widely used to automate a variety of different fabrication methods. These
include:
Laser cutters
Plasma cutters
Waterjet cutters
ASTC 7
MECHANICAL ENGINEERING
Flame cutters
Press brakes
Milling machines
Turning machines
Routers
Electrical discharge machines, etc.
All these operations greatly benefit from the automation factor. This reduces the
human element in the final quality, enhances repeatability of processes and accuracy.
The description above about the workings of CNC machines apply to all these
methods. When turning to a laser cutting service for example, the same logic applies –
the cutting path is automatically generated.
This process like many others, however, does not need some of the extra information
like the change of tooling. Because the same cutting head is suitable for the whole
duration of the process.
ASTC 8
MECHANICAL ENGINEERING
For example, a 5-axis CNC milling centre can help out. While the more common 3-axis
one has 3 linear axes of movement, 5-axis machines can also rotate the cutting head
and the machine bed.
This significantly improves the flexibility but also increases the cost. Even though CNC
is a lot quicker, manual machining still has its place in the industry. Especially for low-
volume rapid prototyping.
ASTC 9
MECHANICAL ENGINEERING
But CNC machining still prevails in the sector when high accuracy is necessary. This is
the reason why so many industries take advantage of it, including:
Aerospace
Electrical
Defence
Mining
Industrial machinery
Food & beverage
Clothing
Automotive
Product design, etc.
All in all, CNC machining has cemented its place in the manufacturing sector as a
reliable and useful way of producing parts. At the same time, CNC machining cost may
often be a little bit higher compared to other fabrication methods.
The machinery itself comes with a high price and is difficult to operate, posing some
dangers. Thus, the best you to get machined parts is turning to a company who has
the necessary expertise to assure top-notch quality.
ASTC 10
MECHANICAL ENGINEERING
ASTC 13
MECHANICAL ENGINEERING
G98 Return to initial point in canned cycle
ASTC 14
MECHANICAL ENGINEERING
G code Description
G04 Dwell
G21 Input in mm
ASTC 15
MECHANICAL ENGINEERING
ASTC 16
MECHANICAL ENGINEERING
DESCRIPTION OF G-CODES
G00 is used for positioning the tool rapidly at the desired point. In
rapid traverse, the machine moves at a prespecified, rapid rate. It is used
when cutting tool is not cutting the material, but is being positioned with
respect to the work piece. G00 helps in saving machining, time as rapid
traverse rate is much higher compared to feed rate. For the machine
manufacturer sets rapid traverse, feed rate, user has no control over it.
Hence it can be different for different machine tools. For example,
G01 is used to move the cutting tool with the feed rate. Hence, it is
used when material has to be actually removed from the work piece.
Feed rate has to be specified by the programmer in the part program.
For example, the command
ASTC 17
MECHANICAL ENGINEERING
ASTC 18
MECHANICAL ENGINEERING
G04 (Dwell)
G04 X(t)
G04 X5.0
ASTC 19
MECHANICAL ENGINEERING
G20 and G21 is used to enter input data in inches and millimeter
respectively.
G28
G32, G78
It is used for cutting straight or tapered threads, but since it does not
allow automatic return to the start point, G78 i.e. multiple threading
cycle is used. G78 is
ASTC 20
MECHANICAL ENGINEERING
canned cycle unlike G32. The format of this cycle comprises of two blocks.
For example,
G78 P021O56 Q180 RO.18
An amount equal to its radius uses G41 and G42 to offset the cutter
from its predesigned path. For example, consider end milling of the
rectangular plate as shown in figure 3.1. Usually, the edges of the plate
are defined as the trajectory of the cutter, while in fact, the axis of the
tool should get offset from the edges by an amount equal to radius of the
cutter and move along dotted path shown in the figure. In order to offset
the tool from I
ASTC 22
MECHANICAL ENGINEERING
G43 TO2 HO2
The CNC software, has a table which has tool information such as tool
number, code number and offset value. Refer the following table.
(assumes)
For positive offset value, G43 is used while for negative offset value,
G44 is used.
G49 is used at the end of the program to cancel tool-length offset value.
G90 X 45 Y 50
ASTC 23
MECHANICAL ENGINEERING
G9l X 35 Y 40
G92
It is used to define coordinate system setting. It is used to specify the
location of system origin, relative to starting point of the cutting tool in
milling, drilling and some lathe machines.
ASTC 24
MECHANICAL ENGINEERING
M code Description
ASTC 25
MECHANICAL ENGINEERING
M09 Coolant OFF
M code Description
ASTC 26
MECHANICAL ENGINEERING
M08 Coolant on
ASTC 27
MECHANICAL ENGINEERING
DESCRIPTION OF M COMMANDS
M01 also works like M00, but only if "Programmed Stop Yes" is
switched on by soft key in the menu PROGRAM CONTROL.
It works like M30. It halts program execution, spindle is turned off and tool moves
to
ASTC 28
MECHANICAL ENGINEERING
It is used to stop the spindle motion. In turning operation, MO5 can be used to
stop spindle for inspection of workpiece or change of cutting tool. It can be used
at the end of program, however at the program end, the main spindle is also
automatically switched off.
M00 (Tool Change)
If the NC machine has tool magazine or tool drum with multiple tool capacity. M06
is used to change the tool. It is used with T word, which specifies the tool number.
M07, M08 and M09
M07 is used to switch the coolant on in flood mode while M08 is used to switch
coolant on in must mode. M09 is used to switch coolant off.
M10, M11
M10 is used to clamping the fixture while M11 is used to unclamp it.
M13 turns the coolant on and starts the spindle motion in clockwise direction.
M14 also switches the coolant on but starts spindle motion in counterclockwise
direction. M17 switches off both coolant and spindle.
M30
With M30, all machine drives are switched off and control returns to start of
program.
M60
ASTC 29
MECHANICAL ENGINEERING
In case NC/CNC machine makes use of multiple pallets for loading-unloading of
workpiece from the machine, M60 can be used for changing pallets.
M98, M99
M98 is used to call a subprogram or function. In this command, the subprogram
number and the number of repetitions have to be specified. M99 is used to jump
back to the start of the program or the specified block number
Experiment No.-1
ASTC 30
MECHANICAL ENGINEERING
Object: To prepare part program for turning operation.
Procedure:-
Part Program:-
ASTC 31
MECHANICAL ENGINEERING
%
O0011
T0101
G50 S3500
G96 S240 M4
G00 X82 Z0.
G01 X-2 F0.15 M7
G00 Z2.
G00 X71.
G01 Z-47 F0.3
G01 X74 Z-49.8
G01 X81 Z-53
G00 Z2.
G00 X60
G01 Z-19.8
G01 X65
G01 X72 Z-24
G00 Z2.
G00 X51.
G01 Z-16.8
G01 X57 Z-19.8
G01 X65
G00 Z2.
G00 X37.
G01 X52 Z-6
G00 X150 Z100
M5
M9
M30
Result: - Part program of the given dimension has been prepared and also run on
the software successfully
ASTC 32
MECHANICAL ENGINEERING
Experiment No.-2
Object:
Procedure:-
Part Program:-
ASTC 33
MECHANICAL ENGINEERING
O2222
%
T0101
G50 S3000
G96 S139 M04
X105 Z4 M08
X104
G72 W3 R0.5
G72 P25 Q40 U0 W0.2 F0.3
N25 G0 Z0
N30 G01 X100 Z0
N35 X-1
N40 Z2
G0 X105
Z2.2
X104
G71 U3 R0.5
G71 P45 Q120 U0 W0 F0.3
N45 G00 X20
N50 G01 X20 Z0.2
N55 Z0
N60 G03 X30 Z-5 I0 K-5
ASTC 34
MECHANICAL ENGINEERING
N65 G01 Z-26
N70 G02 X38 Z-30 I4 K0
N75 G01 X44
N80 X50 Z-33
N85 Z-47
N90 G02 X56 Z-50 I3 K0
N95 G01 X60 Z-52
N100 Z-67
N105 G02 X66 Z-70 I3 K0
N110 G01 X88
N115 X100 Z-76
N120X104Z-76
G0 X105
M09
M05
X200 Z100
M30
Result: - Part program of the given dimension has been prepared and also run on
the software successfully
Experiment No.-3
ASTC 35
MECHANICAL ENGINEERING
Object:
Procedure:-
%
O0003
G54
ASTC 36
MECHANICAL ENGINEERING
N020 T0101
N030 M03 S1500
N040 G00 X30 Z2
N050 G71 U1 R1
N060 G71 P70 Q100 U0.1 W0.1 F0.2
N070 G01 X0 Z0
N080 G01 X20 Z-10
N090 G01 X20 Z-30
N100 G01 X30 Z-40
N110 G70 P70 Q100
N120 G00 X30 Z100
N130 M05
N140 M30
N150
Result: - Part program of the given dimension has been prepared and also run
on the software successfully.
ASTC 37
MECHANICAL ENGINEERING
Experiment No.-4
Object:
Procedure:-
ASTC 38
MECHANICAL ENGINEERING
O0006
G0X40Z5
M03S200
G01X0Z0F900
G03U24W-24R15
G02X26Z-31R5
G01Z-40
X40Z5
M30
Result: - Part program of the given dimension has been prepared and also run on
the software successfully.
ASTC 39
MECHANICAL ENGINEERING
Experiment No. – 3
Object:
Procedure:-
Part Program:-
ASTC 40
MECHANICAL ENGINEERING
O0033
G21G40G99G90
G28U0.00W0.00
T0101
G97M03S1000
G00X44.00Z2.00
G76P020060Q100R0
G76X37.44Z-30.00R0P1280Q200F2
G28U0.00W0.00
M05
M30
ASTC 41
MECHANICAL ENGINEERING
Result:- Part program of the given dimension has been prepared and also run
on the software successfully.
ASTC 42
MECHANICAL ENGINEERING
Experiment No.-7
Object:
Part Program:-
ASTC 43
MECHANICAL ENGINEERING
%
O0001
G91 G28 Z0
G91 G28 X0 Z0
G54 G98 G40 G80 G94 G90
T1 M6
S1000 M3
G0 G43 Z50 H2
G0 X10 Y30
G0 Z2
G1 Z-15 F80 M7
G0 Z2
G0 X30 Y50
G1 Z-15
G0 Z2
G0 X50 Y70
G1 Z-15
G0 Z2
G0 X70 Y50
G1 Z-15
G0 Z2
G0 X90 Y30
G1 Z-15
G0 Z2
G0 Z100
M5
M9
G0 X150 Y150
M30
Result: - Part program of the given dimension has been prepared and also run
on the software successfully.
ASTC 44
MECHANICAL ENGINEERING
Experiment No.-8
Object:
Part Program:-
ASTC 45
MECHANICAL ENGINEERING
%
O0001
G91 G28 Z0
G91 G28 X0 Y0
G54 G98 G40 G80 G49 G90
T1 M6
S2000 M3
G0 G43 Z50 H1
G0 X120 Y90
G0 Z2
G1 Z-5 F200 M7
G41 G1 X110 Y80 D1
G1 X105 Y65
G1 Y17.5
G1 X80 Y5
G1 X67.5
G3 X42.5 I-12.5 J0
G1 X30
G1 X5 Y17.5
G1 Y52.5
ASTC 46
MECHANICAL ENGINEERING
G1 X30 Y65
G1 X42.5
G3 X67.5 I12.5 J0
G1 X80
G1 X105 Y52.5
G1 Y50
G3 X120 Y25 I24.916 J-2.051
G40
G0 Z100
G0 X124.363 Y35.098
M5
M9
G0 X150 Y100
M30
Result: - Part program of the given dimension has been prepared and also run
on the software successfully.
Experiment No.-9
Object:
ASTC 47
MECHANICAL ENGINEERING
Make part drawing (Taking suitable dimension).
Prepare part program using G and M codes in cut viewer turn software.
Run the program in simulation mode on PC.
Observe the satisfactory machining of job on PC as per drawing/Sketch
Part Program:-
%
O0003
N5 G00 G54 G64 G90 G17 X-20 Y-20 Z50
N10 S450 M03 F250 D01
N15 C0
N20 Z5
N25 G01 Z0
N30 Z-5
N35 G42 X0 Y0 M08
ASTC 48
MECHANICAL ENGINEERING
N40 X60 Y0
N45 X85 Y30
N50 X85 Y50
N55 G03 X70 Y65 U15
N60 G01 X45 Y65
N65 G02 X30 Y50 U15
N70 G01 X10 Y50
N75 X0 Y0
N80 G40 X-20 Y-20
N85 G00 Z50 M09
N90 Y100
N95 M30
Result: - Part program of the given dimension has been prepared and also run
on the software successfully.
Experiment No.-10
Object:
ASTC 49
MECHANICAL ENGINEERING
Run the program in simulation mode on PC.
Observe the satisfactory machining of job on PC as per drawing/Sketch
Part Program:-
%
O0001
G00G90X70Y25Z1S800M3
Z-5
G01X20F150
G00Z100
X-25Y50
M30
Result: - Part program of the given dimension has been prepared and also run on
the software successfully.
ASTC 50
MECHANICAL ENGINEERING
ASTC 51
MECHANICAL ENGINEERING
Experiment No.-10
Object:
Procedure:-
Part Program:-
ASTC 52
MECHANICAL ENGINEERING
%
O0001
G00X10Y25Z1S1250M3
G01Z-5F100
G02X10Y25I20J0F125
G00Z100M5
X-20
M30
Result: - Part program of the given dimension has been prepared and also run on
the software successfully.
ASTC 53