g code presentation
DESCRIPTION
This is slide show introduction to milling CNC with simple G code and M code sample programsTRANSCRIPT
![Page 1: G Code Presentation](https://reader034.vdocuments.net/reader034/viewer/2022042511/55cf9c10550346d033a8713c/html5/thumbnails/1.jpg)
Introduction to G-Code
Programming
Computer Integrated Manufacturing
Unit 2: CNC Machining
![Page 2: G Code Presentation](https://reader034.vdocuments.net/reader034/viewer/2022042511/55cf9c10550346d033a8713c/html5/thumbnails/2.jpg)
In this lesson:
Review Coordinate Geometry Basics
Identify common Terminology
Examine G and M - Code language
Provide opportunities for Review and Practice
![Page 3: G Code Presentation](https://reader034.vdocuments.net/reader034/viewer/2022042511/55cf9c10550346d033a8713c/html5/thumbnails/3.jpg)
Rectangular Coordinate System
X-axis
Y-axis
Origin
.125 inch spacing
A (X,Y)(1,.875)
![Page 4: G Code Presentation](https://reader034.vdocuments.net/reader034/viewer/2022042511/55cf9c10550346d033a8713c/html5/thumbnails/4.jpg)
(1.000,1.000
)(-1.125,.625)
(-.375,-.500)
(.750,-1.000)
Ordered PairsA
B
C
D
![Page 5: G Code Presentation](https://reader034.vdocuments.net/reader034/viewer/2022042511/55cf9c10550346d033a8713c/html5/thumbnails/5.jpg)
3D Coordinate System (X,Y,Z)
X-axis
Z-
axisY-axis
![Page 6: G Code Presentation](https://reader034.vdocuments.net/reader034/viewer/2022042511/55cf9c10550346d033a8713c/html5/thumbnails/6.jpg)
Basic Machine Axes: 3 axis
Milling Machines: 3 axis
X – axis (table left and right)
Y – axis (table in and out)
Z – axis (usually the spindle axis)
![Page 7: G Code Presentation](https://reader034.vdocuments.net/reader034/viewer/2022042511/55cf9c10550346d033a8713c/html5/thumbnails/7.jpg)
Additional Axes
A – axis (angular axis about X - axis)
B – axis (angular axis about Y – axis)
C – axis (angular axis about Z – axis)
U – axis (secondary axis parallel to X)
V – axis (secondary axis parallel to Y)
W – axis (secondary axis parallel to Z)
![Page 8: G Code Presentation](https://reader034.vdocuments.net/reader034/viewer/2022042511/55cf9c10550346d033a8713c/html5/thumbnails/8.jpg)
Milling Machines: 4 axis
![Page 9: G Code Presentation](https://reader034.vdocuments.net/reader034/viewer/2022042511/55cf9c10550346d033a8713c/html5/thumbnails/9.jpg)
Terminology
NC – Numerical Control
CNC – Computer Numerical Control
DNC – Direct Numerical Control
APT – Automatic Programmed Tool
CAD – Computer Aided Design
CAM – Computer Aided Manufacturing
CIM – Computer Integrated Manufacturing
![Page 10: G Code Presentation](https://reader034.vdocuments.net/reader034/viewer/2022042511/55cf9c10550346d033a8713c/html5/thumbnails/10.jpg)
Download Code Sheet
Click here to open Code Sheet
![Page 11: G Code Presentation](https://reader034.vdocuments.net/reader034/viewer/2022042511/55cf9c10550346d033a8713c/html5/thumbnails/11.jpg)
G - Code Programming
G – Code Programming
Originally called the “Word Address”
programming format.
Processed one line at a time sequentially.
![Page 12: G Code Presentation](https://reader034.vdocuments.net/reader034/viewer/2022042511/55cf9c10550346d033a8713c/html5/thumbnails/12.jpg)
Common Format of a Block
Sequence
#
Preparatory
Function
Dimension
Words
Feed
Rate
Spindle
Function
Tool
Function
Misc.
Function
N50 G90 G01 X1.40Y2.25 F10 S1500 T01 M03
Individual Words
![Page 13: G Code Presentation](https://reader034.vdocuments.net/reader034/viewer/2022042511/55cf9c10550346d033a8713c/html5/thumbnails/13.jpg)
Word Address 1
N – Sequence or line numberA tag that identifies the beginning of a block of code. It is used by operators to locate specific lines of a program when entering data or verifying the program operation.
G – Preparatory functionG words specify the mode in which the milling machine is to move along its programmed axes.
Reserved Code Words WorksheetN – Sequence or line number
G – Preparatory function
Dimension Words:X –
Y –
Z –
![Page 14: G Code Presentation](https://reader034.vdocuments.net/reader034/viewer/2022042511/55cf9c10550346d033a8713c/html5/thumbnails/14.jpg)
Word Address 2
Dimension WordsX – Distance or position in X direction
Y – Distance or position in Y direction
Z – Distance or position in Z direction
M – Miscellaneous functionsM words specify CNC machine functions not related to dimensions or axial movements.
![Page 15: G Code Presentation](https://reader034.vdocuments.net/reader034/viewer/2022042511/55cf9c10550346d033a8713c/html5/thumbnails/15.jpg)
F – Feed rate (inches per minute or millimeters per minute)
Rate at which cutting tool moves along an axis.
S – Spindle speed (rpm – revolutions per minute)
Controls spindle rotation speed.
T – Tool number
Specifies tool to be selected.
Word Address 3
![Page 16: G Code Presentation](https://reader034.vdocuments.net/reader034/viewer/2022042511/55cf9c10550346d033a8713c/html5/thumbnails/16.jpg)
I – Circular cutting reference for x axis
J – Circular cutting reference for y axis
K – Circular cutting reference for z axis
Word Address 4
![Page 17: G Code Presentation](https://reader034.vdocuments.net/reader034/viewer/2022042511/55cf9c10550346d033a8713c/html5/thumbnails/17.jpg)
G Word
G words or codes tell the machine to
perform certain functions. Most G
words are modal which means they
remain in effect until replaced by
another modal G code.
![Page 18: G Code Presentation](https://reader034.vdocuments.net/reader034/viewer/2022042511/55cf9c10550346d033a8713c/html5/thumbnails/18.jpg)
Common G Codes
G00 – Rapid positioning mode
Tool is moved along the shortest route to programmed X,Y,Z position. Usually NOT used for cutting.
G01 – Linear Interpolation mode
Tool is moved along a straight-line path at programmed rate of speed.
G02 – Circular motion clockwise (cw)
G03 – Circular motion counter clockwise (ccw)
![Page 19: G Code Presentation](https://reader034.vdocuments.net/reader034/viewer/2022042511/55cf9c10550346d033a8713c/html5/thumbnails/19.jpg)
Common G Codes, con.,
G17 – XY plane
G18 – XZ plane
G19 – YZ plane
G20 – Inch Mode
G21 – Metric Mode
G28 – Return to axis machine Zero
(Home)
![Page 20: G Code Presentation](https://reader034.vdocuments.net/reader034/viewer/2022042511/55cf9c10550346d033a8713c/html5/thumbnails/20.jpg)
G Codes: G90, G91
G90 – Absolute Coordinate ReferenceReferences the next position from an absolute zero point which is set once for the entire program.
G91 – Incremental Coordinate ReferenceReferences the next position from the previous position.
![Page 21: G Code Presentation](https://reader034.vdocuments.net/reader034/viewer/2022042511/55cf9c10550346d033a8713c/html5/thumbnails/21.jpg)
G Codes: Canned Cycles
G80 – Cancel canned cycle
G81 – Drilling cycle
G83 – Peck drilling cycle
G84 – Tapping cycle
G85 – Boring cycle
G86 – Boring cycle
NOTE: A canned cycle stays in effect until cancelled by a G80.
![Page 22: G Code Presentation](https://reader034.vdocuments.net/reader034/viewer/2022042511/55cf9c10550346d033a8713c/html5/thumbnails/22.jpg)
Canned Cycles: G81
G81 – Drilling CycleFeed to depth, rapid return
Example of program code:N35 G81 X.500Y.500Z-1.000 R.100 F1.50
N36 X1.000Y1.500
N37 X1.500Y2.000
N38 G80
![Page 23: G Code Presentation](https://reader034.vdocuments.net/reader034/viewer/2022042511/55cf9c10550346d033a8713c/html5/thumbnails/23.jpg)
Canned Cycles: G83, G84
G83 – Peck Drilling CycleFeed to an intermediate depth, rapid out, rapid back to just above previous depth, feed to next depth, rapid out, repeat until reaching full depth.
G84 – Tapping CycleThis cycle creates internal threads in an existing
hole.
NOTE: One cannot over-ride the feed rate.
![Page 24: G Code Presentation](https://reader034.vdocuments.net/reader034/viewer/2022042511/55cf9c10550346d033a8713c/html5/thumbnails/24.jpg)
Canned Cycles: G85, G86
G85 - Boring Cycle
Feed to depth, feed back out.
G86 – Boring Cycle
Feed to depth, rapid out.
![Page 25: G Code Presentation](https://reader034.vdocuments.net/reader034/viewer/2022042511/55cf9c10550346d033a8713c/html5/thumbnails/25.jpg)
G Codes: Cutter Compensation
G40 – Cancel cutter diameter
compensation.
G41 – Cutter compensation left.
G42 – Cutter compensation right.
![Page 26: G Code Presentation](https://reader034.vdocuments.net/reader034/viewer/2022042511/55cf9c10550346d033a8713c/html5/thumbnails/26.jpg)
M Word
M words tell the machine to perform
certain machine related functions,
such as: turn spindle on/off, coolant
on/off, or stop/end program.
Professional Development ID Code: 6006
![Page 27: G Code Presentation](https://reader034.vdocuments.net/reader034/viewer/2022042511/55cf9c10550346d033a8713c/html5/thumbnails/27.jpg)
Common M words
M00 – Programmed pause
Automatically stops machine until operator pushes a button to resume program.
M01 – Optional stop
A stop acted upon by the machine when operator has signaled this command by pushing a button.
M02 – End of program
Stops program when all lines of code are completed. Must be last command in program.
![Page 28: G Code Presentation](https://reader034.vdocuments.net/reader034/viewer/2022042511/55cf9c10550346d033a8713c/html5/thumbnails/28.jpg)
M03 – Turn spindle onIn clockwise direction
M04 – Turn spindle onIn counter clockwise direction
M05 – Stop spindle
Usually used prior to tool change or at end of program.
M06 – Tool changeStops program and calls for a tool change, either automatically or manually.
Common M words
![Page 29: G Code Presentation](https://reader034.vdocuments.net/reader034/viewer/2022042511/55cf9c10550346d033a8713c/html5/thumbnails/29.jpg)
M08 – Turns Accessory 1 on.
M09 – Turns Accessory 1 off.
M10 – Turns Accessory 2 on.
M11 – Turns Accessory 2 off.
M30 – End of program
Similar to M02 but M30 will also “rewind” the program.
Must be last statement in program. If used, DO NOT
use M02.
Common M words
![Page 30: G Code Presentation](https://reader034.vdocuments.net/reader034/viewer/2022042511/55cf9c10550346d033a8713c/html5/thumbnails/30.jpg)
Zero Points
Part Zero
– Used for absolute programming mode.
– Usually a position on the part that all absolute coordinates are referenced to.
– Changes with different parts and programs.
Machine Zero or Machine Home Position – Fixed for each machine from the manufacturer.
– Not changeable.
![Page 31: G Code Presentation](https://reader034.vdocuments.net/reader034/viewer/2022042511/55cf9c10550346d033a8713c/html5/thumbnails/31.jpg)
Cutter Path Generation
Cutter path is generated by moving the
tool from point to point. The points are
previously defined from the part
drawing dimensions.
Each line of code will show the
destination point of where the tool will
go to.
![Page 32: G Code Presentation](https://reader034.vdocuments.net/reader034/viewer/2022042511/55cf9c10550346d033a8713c/html5/thumbnails/32.jpg)
Interpolation
Method of determining intermediate
points along a cutting path.
Two methods:• Linear interpolation – cut a path along a
specified angle at a specified feed rate.
• Circular interpolation – cut a path along an arc or circle at a specified feed rate.
![Page 33: G Code Presentation](https://reader034.vdocuments.net/reader034/viewer/2022042511/55cf9c10550346d033a8713c/html5/thumbnails/33.jpg)
Axis movements: Caution!
Multiple axis movements are possible.
“Best Practice” is NOT to make a 3-axis
movement using one line of code.
Move to position using two axes, X,Y;
then move the Z with an additional
line of code.
![Page 34: G Code Presentation](https://reader034.vdocuments.net/reader034/viewer/2022042511/55cf9c10550346d033a8713c/html5/thumbnails/34.jpg)
Example 1: NC Block
![Page 35: G Code Presentation](https://reader034.vdocuments.net/reader034/viewer/2022042511/55cf9c10550346d033a8713c/html5/thumbnails/35.jpg)
Top View NC Block.125 GRID
SPACES
Origin
(0,0)
![Page 36: G Code Presentation](https://reader034.vdocuments.net/reader034/viewer/2022042511/55cf9c10550346d033a8713c/html5/thumbnails/36.jpg)
Download Worksheet
Click here to open Practice Exercises
![Page 37: G Code Presentation](https://reader034.vdocuments.net/reader034/viewer/2022042511/55cf9c10550346d033a8713c/html5/thumbnails/37.jpg)
Worksheet Problem 1.125 GRID
SPACES
Origin
(0,0)
E( , )
B( , )
C( , )
D( , )
A( , )
F( , )
G( , )H( , )
I( , ) J( , )K( , )
L( , )
![Page 38: G Code Presentation](https://reader034.vdocuments.net/reader034/viewer/2022042511/55cf9c10550346d033a8713c/html5/thumbnails/38.jpg)
Pause Lesson
![Page 39: G Code Presentation](https://reader034.vdocuments.net/reader034/viewer/2022042511/55cf9c10550346d033a8713c/html5/thumbnails/39.jpg)
Example 1: Program NC
N01 G90 G80 T00
N02 G00 X0 Y3.000 Z1.000
N03 M03 S1000
![Page 40: G Code Presentation](https://reader034.vdocuments.net/reader034/viewer/2022042511/55cf9c10550346d033a8713c/html5/thumbnails/40.jpg)
Example 1: Program NC
N01 G90 G80 T00
N02 G00 X0 Y3.000 Z1.000
N03 M03 S1000
N04 X.375 Y.250 Z1.000
N05 Z.100
N06 G01 Z-.100 F5.00
N07 Y1.750
![Page 41: G Code Presentation](https://reader034.vdocuments.net/reader034/viewer/2022042511/55cf9c10550346d033a8713c/html5/thumbnails/41.jpg)
Example 1: Program cont’d
N08 X1.250 Y.250
N09 Y1.750
N10 G00 Z.100
N11 X2.625 Y.500
N12 GO1 Z-.100
N13 X2.375 Y2.50
N14 X2.000
![Page 42: G Code Presentation](https://reader034.vdocuments.net/reader034/viewer/2022042511/55cf9c10550346d033a8713c/html5/thumbnails/42.jpg)
Example 1: Program cont’d
N15 X1.750 Y.500
N16 Y1.500
N17 X2.000 Y1.750
N18 X2.375
N19 X2.625 Y1.500
![Page 43: G Code Presentation](https://reader034.vdocuments.net/reader034/viewer/2022042511/55cf9c10550346d033a8713c/html5/thumbnails/43.jpg)
Example 1, con.,
N20 G00 Z1.000
N21 X0 Y3.000
N22 M05
N23 M30
![Page 44: G Code Presentation](https://reader034.vdocuments.net/reader034/viewer/2022042511/55cf9c10550346d033a8713c/html5/thumbnails/44.jpg)
Example 2: PLTW Block
![Page 45: G Code Presentation](https://reader034.vdocuments.net/reader034/viewer/2022042511/55cf9c10550346d033a8713c/html5/thumbnails/45.jpg)
Worksheet Problem 2
Origin
.250 GRID
SPACE
![Page 46: G Code Presentation](https://reader034.vdocuments.net/reader034/viewer/2022042511/55cf9c10550346d033a8713c/html5/thumbnails/46.jpg)
Example 2: Top View
Origin
A( ,
)
E( ,
)
D( ,
)
C( ,
)
B( ,
)
I( , )
H( ,
)
G( , )
F( ,
)
.250 Grid Space
L( ,
)
K( ,
)J( , )
P( ,
)
O( ,
)
N( ,
)
M( ,
)
Q( ,
)
![Page 47: G Code Presentation](https://reader034.vdocuments.net/reader034/viewer/2022042511/55cf9c10550346d033a8713c/html5/thumbnails/47.jpg)
Pause Lesson
![Page 48: G Code Presentation](https://reader034.vdocuments.net/reader034/viewer/2022042511/55cf9c10550346d033a8713c/html5/thumbnails/48.jpg)
Example 2: PLTW
N01 G90 G80 T01
N02 G00 X0 Y0 Z1.000
N03 M03 S1000
N04 X.750 Y.500 Z1.000
N05 Z.100
N06 G01 Z-.250 F5.00
N07 Y2.500
![Page 49: G Code Presentation](https://reader034.vdocuments.net/reader034/viewer/2022042511/55cf9c10550346d033a8713c/html5/thumbnails/49.jpg)
Example 2: PLTW cont’d
N08 X1.250
N09 G02 X1.250 Y1.500 I1.250 J2.000
N10 G01 X.750
N11 G00 Z.100
N12 X2.250 Y2.500
N13 G01 Z-.250
N14 Y.500
![Page 50: G Code Presentation](https://reader034.vdocuments.net/reader034/viewer/2022042511/55cf9c10550346d033a8713c/html5/thumbnails/50.jpg)
Example 2: Program cont’d
N15 X3.250
N16 G00 Z.100
N17 X4.000
N18 G01 Z-.250
N19 Y2.500
N20 X3.500
N21 X4.500
![Page 51: G Code Presentation](https://reader034.vdocuments.net/reader034/viewer/2022042511/55cf9c10550346d033a8713c/html5/thumbnails/51.jpg)
Example 2: PLTW cont’d
N22 G00 Z.100
N23 X5.000 Y2.500
N24 G01 Z-.250
N25 X5.500 Y.500
N26 X5.750 Y1.500
N27 X6.000 Y.500
N28 X6.500 Y2.500
![Page 52: G Code Presentation](https://reader034.vdocuments.net/reader034/viewer/2022042511/55cf9c10550346d033a8713c/html5/thumbnails/52.jpg)
Example 2: PLTW cont’d
N29 G00 Z1.000
N30 X0 Y0
N31 M05
N32 M30
![Page 53: G Code Presentation](https://reader034.vdocuments.net/reader034/viewer/2022042511/55cf9c10550346d033a8713c/html5/thumbnails/53.jpg)
Curriculum Alignment:
Unit 2: CNC Machining
Section 2.3 – CNC Machining
PowerPoint – Introduction to CNC
PowerPoint – CNC Programming
![Page 54: G Code Presentation](https://reader034.vdocuments.net/reader034/viewer/2022042511/55cf9c10550346d033a8713c/html5/thumbnails/54.jpg)
References:
Oberg, E. & Jones F. D. & Horton, H. L. & Ryffell, H. H. (2000). Machinery’s Handbook, 26th
ed., New York, NY: Industrial Press Inc.
Valentino, J.V. & Goldenberg, J. (2003). Introduction to Computer Numerical Control (CNC), 3rd ed., Upper Saddle River, NJ: Prentice Hall
![Page 55: G Code Presentation](https://reader034.vdocuments.net/reader034/viewer/2022042511/55cf9c10550346d033a8713c/html5/thumbnails/55.jpg)
Credits:
Writer: Bob Arrendondo
Content Editor: Donna E. Scribner
Narration: Donna E. Scribner
PLTW Editor: Ed Hughes
Production: CJ Amarosa
Video Production: CJ Amarosa
Audio: CJ Amarosa
Project Manager: Donna E. Scribner