0% found this document useful (0 votes)
108 views

CNC Programming 1

CNC programming involves writing instructions for computer numerical control machines. CNC programmers use G-codes and M-codes to control machine movements and functions. G-codes define motions like rapid movement, linear and circular interpolation, as well as tool and coordinate system settings. M-codes control functions like spindle start/stop and coolant on/off. Canned cycles automate repetitive motions like drilling and allow programmers to define hole locations without specifying each individual movement. Postprocessors translate toolpath calculations into the specific language of the machine controller.

Uploaded by

mohamed alsalhy
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
108 views

CNC Programming 1

CNC programming involves writing instructions for computer numerical control machines. CNC programmers use G-codes and M-codes to control machine movements and functions. G-codes define motions like rapid movement, linear and circular interpolation, as well as tool and coordinate system settings. M-codes control functions like spindle start/stop and coolant on/off. Canned cycles automate repetitive motions like drilling and allow programmers to define hole locations without specifying each individual movement. Postprocessors translate toolpath calculations into the specific language of the machine controller.

Uploaded by

mohamed alsalhy
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 26

CNC programming

DR.ALI NASSER
CNC programming

 What is CNC programming?


• CNC programming (Computer Numerical Control Programming) is
utilized by manufacturers to create program instructions for computers
to control a machine tool. CNC is highly involved in the manufacturing
process and improves automation as well as flexibility

 CNC programmers write instructions for CNC machines, where a


computer is connected to the mill, along with electrical drives and
sensors for a complete system. This computer controls the movement
of the machine axis.
Content of the presentation

1. What Is the word address “G-kode”


2. Basic motion code
3. Program structure
4. Canned cycle
5. Motion code example
G-code

G-code is a language in which people tell computerized machine tools how to make something.


The "how" is defined by g-code instructions provided to a machine controller (industrial
computer) that tells the motors where to move, how fast to move, and what path to follow.
 G-codes, also called preparatory codes, are any word in a CNC program that begins with the
letter G. Generally it is a code telling the machine tool what type of action to perform, such
as:
1. Rapid movement (transport the tool as quickly as possible in between cuts)
2. Controlled feed in a straight line or arc
3. Series of controlled feed movements that would result in a hole being bored, a workpiece
cut (routed) to a specific dimension, or a profile (contour) shape added to the edge of a
workpiece
4. Set tool information such as offset
5. Switch coordinate systems
Table of Important G codes

G00 Rapid Transverse


G01 Linear Interpolation
G02 Circular Interpolation, CW
G03 Circular Interpolation, CCW
G17 XY Plane,G18 XZ Plane,G19 YZ Plane
G20/G70 Inch units
G21/G71 Metric Units
G40 Cutter compensation cancel
G41 Cutter compensation left
G42 Cutter compensation right
G43 Tool length compensation (plus)
G43 Tool length compensation (plus)
Table of Important G codes

G44 Tool length compensation (minus)


G49 Tool length compensation cancel
G80 Cancel canned cycles
G81 Drilling cycle
G82 Counter boring cycle
G83 Deep hole drilling cycle
G90 Absolute positioning
G91 Incremental positioning
M-CODE

 M-code :
 (for 'miscellaneous function') is an auxiliary command; descriptions
vary. Many M-codes call for machine functions like 'open workstation
door,' miscellaneous codes are used general for switches. Spindle
start /off coolant on/off
Table of Important M codes

 M00 Program stop


 M01 Optional program stop
 M02 Program end
 M03 Spindle on clockwise
 M04 Spindle on counterclockwise
 M05 Spindle stop
 M06 Tool change
 M08 Coolant on
 M09 Coolant off
 M10 Clamps on
 M11 Clamps off
 M30 Program stop, reset to start
Core concepts of codes and motion
Machines codes :
G,M, t, F and S are words use for programming
G is the motion code which motion can be linear or circular in Rapid or feed.
M (for 'miscellaneous function') is an auxiliary command ; miscellaneous codes are used general for switches. Spindle start /off coolant
on/off
T for tool
F for feed
S for Spindle speed


Writing code

 N## G## X## Y## Z## F## S## T## M##


 N: Line number
G: Motion
X: Horizontal position
Y: Vertical position
Z: Depth
F: Feed rate
S: Spindle speed
T: Tool selection
M: Miscellaneous functions
I and J: Incremental center of an arc
R: Radius of an arc
Common G code for machine motion

G00 or G0 = Rapid linear motion


G01 or G1 = Feed linear motion
G02 or G2 = Circular clock wise
G03 or G3 = Circular counter Clock wise (ccw)
Ex :
No1 G02 X1. 0 Y1. 0 I.5 J. 5
 oR
No1 G03 X1.0 Y1. 0 R. 5
 i&j are the icremental center of the irc
 R is the raduis of the arc
 M-code (
For Ex : M06 perform the tool change
 N01 T1 M06 (t= number of tool To be Selected)
 Alpha numeric codes are used for programming as they are a simple way to:
 Define motion and function (G##)
 Declare a position (X## Y## Z##)
 Set a value (F## and/or S##)
 Select an item (T##)
 Switch something on and off (M##), such as coolant, spindles, indexing motion, axes locks, etc.
 For example,
 G01 X1 Y1 F20 T01 M03 S500
 would generally indicate a linear feed move (G01) to the given XY position at feed rate of 20. It
is using Tool 1, and the spindle speed is 500. Miscellaneous functions will vary from machine to
machine, so in order to know what the m-code means, the machine’s instruction manual will
need to be referenced.
A G-CODE USUALLY CONSISTS OF THE FOLLOWING ELEMENTS:

MACHINE INITIALZATION %O100


TOOL CHANGE CODE N07. T1 M06 S300
MOVEMENTS AND POSITIONING N08 G00 Z. 1
N08 G01 Z-. 25 F200
N09. G00 X2. 5 Y2. 5
N10. G01 X5. 0 Y5. 0
N11. G00 Z. 1
PROGRAM END CODE N12 G28 X0. 0 Y0. 0
N09. M02
N10. M30
SAFTEY CODE G00 G40 G49 G20 G99
N02 M09
N03. M05
N04 G91 G28
N06. G90
Canned cycle

 Canned Cycles
isa way of conveniently performing repetitive CNC machine operations ,Canned
cycles automate certain machining functions such as drilling, boring, threading,
pocketing ,A canned cycle is usually permanently stored as a pre-program in the
machine's controller and cannot be altered by the user.
 For example, oftentimes G81 is code for a basic drilling function. In the case of
basic drilling, the tool would have to be 1) moved to the starting point of the hole’s
location, 2) rapid to the clearance plane, 3) fed to the depth, and 4) rapid out. That
would be four lines of code in the program that would have to be repeated for
every new drill position! With the canned cycle G81, only the hole locations need to
be specified after activation. Canned cycles like G81 significantly reduce the
amount of code by incorporating multiple motions into one code.
Postprocessors

 Postprocessors
 A postprocessor is a translator that translates the calculated image of
a toolpath on your computer screen into the language for a machine
control. You can create a post processor by searching for a sample
program that aligns closely with your machine, and then amending the
program to precisely fit your machine
Thank
THE
s END
🎤🎬

You might also like