SlideShare a Scribd company logo
2
Most read
3
Most read
4
Most read
Title
Theory of CNC
Submitted to:
Sir Tayyab Quershi
Submitted by:
Roll no# 18-MT-21
Punjab Tianjin University Of Technology Lahore
G code
G stands for geometry, and it's the alphanumeric format the system uses to tell
the parts what to do. It indicates where to start, how to move and when to stop.
For machinists, the problem with using G codes is different machines use
variations on a standard set of alphanumeric numbers
M code
M-code (for “miscellaneous function”) is an auxiliary command; descriptions
vary. Many M-codes call for machine functions like “open workstation door,”
which is why some say “M” stands for “machine”, though it was not intended
to.
G-code is a type of function used in Numerical Control programming language
that contains the information to position a tool to do the actual work Since
G-codes are preparatory codes, in a CNC
program they begin with the letter G and direct the machine. Typical actions
G-code directs include: Changing a pallet.
Difference
1. GCodeisaGeometricCode,whichisusedformakeageometry/profileofa
component havingcylinder/barinCNCLatheorRectangularPlatesinCNC
Milling andCNCWEDM.
2. McodeisaMachineCodeorMiscellaneusCode,whichisusedformachinefunctions
inall CNCmachines.i.e.Coolanton/off,SpindleSpeedon/off,toolchange,
machinestop permanent/temporary etc.
M code G code
• M00: Program stop
• M01: Optional program
stop
• M02: End of program
• M03: Spindle on
clockwise
• M04: Spindle on
counterclockwise
• M05: Spindle stop
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 ar
Nevertheless, after reading all of this, now we are able to manually make a real,
actual code. Here’s an example:
1. %
2. G21 G17 G90 F100
3. M03 S1000
4. G00 X5 Y5 ; point B
5. G01 X5 Y5 Z-1 ; point B
6. G01 X5 Y15 Z-1 ; point C
7. G02 X9 Y19 Z-1 I4 J0 ; point D
8. G01 X23 Y19 Z-1 ; point E
9. G01 X32 Y5 Z-1 ; point F
10. G01 X21 Y5 Z-1 ; point G
11. G01 X21 Y8 Z-1 ; point H
12. G03 X19 Y10 Z-1 I-2 J0 ; point I
13. G01 X13 Y10 Z-1 ; point J
14. G03 X11 Y8 Z-1 I0 J-2 ; point K
15. G01 X11 Y5 Z-1 ; point L
16. G01 X5 Y5 Z-1 ; point B
17. G01 X5 Y5 Z0
18. G28 X0 Y0
19. M05
20. M30
21. %
Impotance
Application of M codes
• Other letter designations (or, “words”) are used to specify feed rate (F),
spindle speed (S), tool addresses (T), etc.
• A full CNC program will be peppered with these letters as well as the
G and M-codes. Several M-codes are used to reference the control
panel for operator input. M01, an optional program stop, temporarily
halts the program and awaits input from the operator if the Opt Stop
button on the control panel is on. Otherwise, the M01 command is
ignored.
• This function might be used to allow the operator to remove chips.
• Another panel button labeled Block Skip will make the programs
skip over any code blocks that are preceded by a forward slash. This
is useful for auto-feeding operations as it can be used to skip over
the program stop command.
Need of G code and M code
• Technically a machine operator doesn’t need to know G-code. If the
CAM software has already created a cutting program, it feeds that
information to the CNC machining center. The software has already
determined the “speed and feed”, the tool path and all the other
variables needed to make the part. The operator can simply press the
start button and watch the part being made, but there are many
problems to this approach
• CAM programs seldomproduce the optimal tool path for the fastest
and most efficient cutting of a part, especially for complex geometries.
This is because, as mentioned above, it is “thinking” point-by-point
and step-by-step, not thinking globally. Only a human machinist with
real-world experience is capable of determining the ideal function of
the machine tool to meet the expectations of the customer’s design
intent. CAM is also optimized for maximum safety and machine tool
life, which translates as slow. Sometimes very slow.
G code and M code

More Related Content

PPT
Cnc lathe
PPT
5 g-code
PPT
CNC MACHINE TOOLS Introduction Module 1.ppt
PPTX
nc and cnc dp
PDF
CNC PROGRAMMING.pdf
PDF
CNC programming: Principles and applications.pdf
PPTX
Computer numerical control (CNC)
Cnc lathe
5 g-code
CNC MACHINE TOOLS Introduction Module 1.ppt
nc and cnc dp
CNC PROGRAMMING.pdf
CNC programming: Principles and applications.pdf
Computer numerical control (CNC)

What's hot (20)

PPTX
CNC part programming
PPT
3 numerical control
PPTX
CNC Programming
PPTX
Canned cycle
PDF
Cnc lab manual
PPTX
Manual part programming
PPTX
NC, CNC & DNC Machine
PDF
Cnc, dnc & adaptive control
PDF
G and m codes
PPTX
Numerical control machines
PDF
GEOMETRIC MODELING
PPTX
ppt on cnc
PPTX
CNC Turning and Milling centres
PPTX
Numerical control machines tool
PPTX
cnc machining
PDF
Surfaces
PPT
Geometric modeling111431635 geometric-modeling-glad (1)
PPTX
CNC AND ITS COMPONENTS
PPTX
4 tooling in cnc
PPTX
COMPUTER AIDED PROCESS PLANNING
CNC part programming
3 numerical control
CNC Programming
Canned cycle
Cnc lab manual
Manual part programming
NC, CNC & DNC Machine
Cnc, dnc & adaptive control
G and m codes
Numerical control machines
GEOMETRIC MODELING
ppt on cnc
CNC Turning and Milling centres
Numerical control machines tool
cnc machining
Surfaces
Geometric modeling111431635 geometric-modeling-glad (1)
CNC AND ITS COMPONENTS
4 tooling in cnc
COMPUTER AIDED PROCESS PLANNING
Ad

Similar to G code and M code (20)

PPTX
AMT PPT.pptx
DOCX
G AND M
PPTX
COMPUTER NUMERICAL CONTROL MACHINE
PDF
Lecture 25.pdf
PPT
5 g-code
PPTX
Cnc pgrming seminar-
PPTX
LAB2_Gcode_Mcode.pptx
PDF
Cnc programming basics.doc
PDF
Mach4 mill-g code-manual
PPTX
PPTX
UNIT 3 CNC Part Programming fundamentals
PPTX
CNC PART PROGRAMMING.pptx
PPTX
CNC(COMPUTER NUMERICAL CONTROL MACHINE) By-Er. VED PRAKASH
PPT
PPT
CNC1.ppt
PPT
Cnc part programming 4 unit
PPT
CNC1.ppt
PPT
CNC Programmingmodifies1
PPT
CNC Machining part for engineering studenPart-1.ppt
AMT PPT.pptx
G AND M
COMPUTER NUMERICAL CONTROL MACHINE
Lecture 25.pdf
5 g-code
Cnc pgrming seminar-
LAB2_Gcode_Mcode.pptx
Cnc programming basics.doc
Mach4 mill-g code-manual
UNIT 3 CNC Part Programming fundamentals
CNC PART PROGRAMMING.pptx
CNC(COMPUTER NUMERICAL CONTROL MACHINE) By-Er. VED PRAKASH
CNC1.ppt
Cnc part programming 4 unit
CNC1.ppt
CNC Programmingmodifies1
CNC Machining part for engineering studenPart-1.ppt
Ad

Recently uploaded (20)

PPTX
Recipes for Real Time Voice AI WebRTC, SLMs and Open Source Software.pptx
PDF
Enhancing Cyber Defense Against Zero-Day Attacks using Ensemble Neural Networks
PPTX
KTU 2019 -S7-MCN 401 MODULE 2-VINAY.pptx
PDF
PPT on Performance Review to get promotions
PDF
Embodied AI: Ushering in the Next Era of Intelligent Systems
PDF
BMEC211 - INTRODUCTION TO MECHATRONICS-1.pdf
PPTX
CH1 Production IntroductoryConcepts.pptx
PPTX
Welding lecture in detail for understanding
PDF
Model Code of Practice - Construction Work - 21102022 .pdf
PPTX
Lecture Notes Electrical Wiring System Components
PPT
CRASH COURSE IN ALTERNATIVE PLUMBING CLASS
PDF
Mohammad Mahdi Farshadian CV - Prospective PhD Student 2026
PDF
TFEC-4-2020-Design-Guide-for-Timber-Roof-Trusses.pdf
PPTX
IOT PPTs Week 10 Lecture Material.pptx of NPTEL Smart Cities contd
DOCX
ASol_English-Language-Literature-Set-1-27-02-2023-converted.docx
PPTX
Sustainable Sites - Green Building Construction
PDF
Digital Logic Computer Design lecture notes
PPTX
M Tech Sem 1 Civil Engineering Environmental Sciences.pptx
PDF
The CXO Playbook 2025 – Future-Ready Strategies for C-Suite Leaders Cerebrai...
PPTX
OOP with Java - Java Introduction (Basics)
Recipes for Real Time Voice AI WebRTC, SLMs and Open Source Software.pptx
Enhancing Cyber Defense Against Zero-Day Attacks using Ensemble Neural Networks
KTU 2019 -S7-MCN 401 MODULE 2-VINAY.pptx
PPT on Performance Review to get promotions
Embodied AI: Ushering in the Next Era of Intelligent Systems
BMEC211 - INTRODUCTION TO MECHATRONICS-1.pdf
CH1 Production IntroductoryConcepts.pptx
Welding lecture in detail for understanding
Model Code of Practice - Construction Work - 21102022 .pdf
Lecture Notes Electrical Wiring System Components
CRASH COURSE IN ALTERNATIVE PLUMBING CLASS
Mohammad Mahdi Farshadian CV - Prospective PhD Student 2026
TFEC-4-2020-Design-Guide-for-Timber-Roof-Trusses.pdf
IOT PPTs Week 10 Lecture Material.pptx of NPTEL Smart Cities contd
ASol_English-Language-Literature-Set-1-27-02-2023-converted.docx
Sustainable Sites - Green Building Construction
Digital Logic Computer Design lecture notes
M Tech Sem 1 Civil Engineering Environmental Sciences.pptx
The CXO Playbook 2025 – Future-Ready Strategies for C-Suite Leaders Cerebrai...
OOP with Java - Java Introduction (Basics)

G code and M code

  • 1. Title Theory of CNC Submitted to: Sir Tayyab Quershi Submitted by: Roll no# 18-MT-21 Punjab Tianjin University Of Technology Lahore
  • 2. G code G stands for geometry, and it's the alphanumeric format the system uses to tell the parts what to do. It indicates where to start, how to move and when to stop. For machinists, the problem with using G codes is different machines use variations on a standard set of alphanumeric numbers M code M-code (for “miscellaneous function”) is an auxiliary command; descriptions vary. Many M-codes call for machine functions like “open workstation door,” which is why some say “M” stands for “machine”, though it was not intended to. G-code is a type of function used in Numerical Control programming language that contains the information to position a tool to do the actual work Since G-codes are preparatory codes, in a CNC program they begin with the letter G and direct the machine. Typical actions G-code directs include: Changing a pallet. Difference 1. GCodeisaGeometricCode,whichisusedformakeageometry/profileofa component havingcylinder/barinCNCLatheorRectangularPlatesinCNC Milling andCNCWEDM. 2. McodeisaMachineCodeorMiscellaneusCode,whichisusedformachinefunctions inall CNCmachines.i.e.Coolanton/off,SpindleSpeedon/off,toolchange, machinestop permanent/temporary etc. M code G code • M00: Program stop • M01: Optional program stop • M02: End of program • M03: Spindle on clockwise • M04: Spindle on counterclockwise • M05: Spindle stop N: Line number G: Motion X: Horizontal position Y: Vertical position Z: Depth
  • 3. F: Feed rate S: Spindle speed T: Tool selection M: Miscellaneous functions I and J: Incremental center of an arc R: Radius of an ar
  • 4. Nevertheless, after reading all of this, now we are able to manually make a real, actual code. Here’s an example: 1. % 2. G21 G17 G90 F100 3. M03 S1000 4. G00 X5 Y5 ; point B 5. G01 X5 Y5 Z-1 ; point B 6. G01 X5 Y15 Z-1 ; point C 7. G02 X9 Y19 Z-1 I4 J0 ; point D 8. G01 X23 Y19 Z-1 ; point E 9. G01 X32 Y5 Z-1 ; point F 10. G01 X21 Y5 Z-1 ; point G 11. G01 X21 Y8 Z-1 ; point H 12. G03 X19 Y10 Z-1 I-2 J0 ; point I 13. G01 X13 Y10 Z-1 ; point J 14. G03 X11 Y8 Z-1 I0 J-2 ; point K 15. G01 X11 Y5 Z-1 ; point L 16. G01 X5 Y5 Z-1 ; point B 17. G01 X5 Y5 Z0 18. G28 X0 Y0 19. M05 20. M30 21. %
  • 6. Application of M codes • Other letter designations (or, “words”) are used to specify feed rate (F), spindle speed (S), tool addresses (T), etc. • A full CNC program will be peppered with these letters as well as the G and M-codes. Several M-codes are used to reference the control panel for operator input. M01, an optional program stop, temporarily halts the program and awaits input from the operator if the Opt Stop button on the control panel is on. Otherwise, the M01 command is ignored. • This function might be used to allow the operator to remove chips. • Another panel button labeled Block Skip will make the programs skip over any code blocks that are preceded by a forward slash. This is useful for auto-feeding operations as it can be used to skip over the program stop command. Need of G code and M code • Technically a machine operator doesn’t need to know G-code. If the CAM software has already created a cutting program, it feeds that
  • 7. information to the CNC machining center. The software has already determined the “speed and feed”, the tool path and all the other variables needed to make the part. The operator can simply press the start button and watch the part being made, but there are many problems to this approach • CAM programs seldomproduce the optimal tool path for the fastest and most efficient cutting of a part, especially for complex geometries. This is because, as mentioned above, it is “thinking” point-by-point and step-by-step, not thinking globally. Only a human machinist with real-world experience is capable of determining the ideal function of the machine tool to meet the expectations of the customer’s design intent. CAM is also optimized for maximum safety and machine tool life, which translates as slow. Sometimes very slow.