G-code
![]() | This article includes a list of general references, but it lacks sufficient corresponding inline citations. (January 2025) |
![]() | This article may require restoring an older revision.(May 13, 2025) |
G-code | |
---|---|
Developer | Electronic Industries Association (RS-274), International Organization for Standardization (ISO-6983) |
First appeared | 1963 | (RS-274)
Filename extensions | .gcode, .mpt, .mpf, .nc and several others |
Major implementations | |
Numerous; mainly Siemens Sinumerik, FANUC, Haas, Heidenhain, Mazak, Okuma |
G-code (abbreviation for geometric code; also called[1] RS-274,[2] standardized today in ISO 6983-1[3]) is the most widely used computer numerical control (CNC) and 3D printing programming language. It is used mainly in computer-aided manufacturing to control automated machine tools, as well as for 3D-printer slicer applications. G-code has many variants.
G-code instructions are provided to a machine controller (industrial computer) that tells the motors where to move, how fast to move, and what path to follow. The two most common situations are that, within a machine tool such as a lathe or mill, a cutting tool is moved according to these instructions through a toolpath cutting away material to leave only the finished workpiece and/or an unfinished workpiece is precisely positioned in any of up to nine axes[4] around the three dimensions relative to a toolpath and, either or both can move relative to each other. The same concept also extends to noncutting tools such as forming or burnishing tools, photoplotting, additive methods such as 3D printing, and measuring instruments.
History
The first implementation of a numerical control programming language was developed at the
During the 1970s through 1990s, many CNC machine tool builders attempted to overcome compatibility difficulties by standardizing on machine tool controllers built by
Syntax
G-code began as a limited language that lacked constructs such as loops, conditional operators, and programmer-declared variables with natural-word-including names (or the expressions in which to use them). It was unable to encode logic but was just a way to "connect the dots" where the programmer figured out many of the dots' locations longhand. The latest implementations of G-code include macro language capabilities somewhat closer to a high-level programming language. Additionally, all primary manufacturers (e.g., Fanuc, Siemens, Heidenhain) provide access to programmable logic controller (PLC) data, such as axis positioning data and tool data,[11] via variables used by NC programs. These constructs make it easier to develop automation applications.
Extensions and variations
Extensions and variations have been added independently by control manufacturers and machine tool manufacturers, and operators of a specific controller must be aware of the differences between each manufacturer's product.
One standardized version of G-code, known as BCL (Binary Cutter Language), is used only on very few machines. Developed at MIT, BCL was developed to control CNC machines in terms of straight lines and arcs.[12]
Some CNC machines use "conversational" programming, which is a wizard-like programming mode that either hides G-code or completely bypasses the use of G-code. Some popular examples are Okuma's Advanced One Touch (AOT), Southwestern Industries' ProtoTRAK, Mazak's Mazatrol, Hurco's Ultimax and Winmax, Haas' Intuitive Programming System (IPS), and Mori Seiki's CAPS conversational software.
See also
- Canned cycle
- Direct Numerical Control
- LinuxCNC
- List of computer-aided manufacturing software
References
- ^ Barkmeyer, Edward J.; Hopp, Theodore H.; Michael J., Pratt; Gaylen R., Rinaudot, eds. (1995). Background Study: Requisite Elements, Rationale, and Technology Overview for the Systems Integration for Manufacturing Applications (SIMA) Program (PDF) (Technical report) (NIST Interagency/Internal Report (NISTIR) 5662 ed.). Gaithersburg, MD, USA: NIST Technical Series Publications. p. 45.
- ^ EIA Standard RS-274-D Interchangeable Variable Block Data Format for Positioning, Contouring, and Contouring/Positioning Numerically Controlled Machines. 2001 Eye Street, NW, Washington, D.C. 20006: Electronic Industries Association. February 1979.
{{cite book}}
: CS1 maint: location (link) - ^ Technical Committee ISO/TC 184/SC 1, ed. (December 2009). ISO 6983-1:2009 Automation systems and integration — Numerical control of machines — Program format and definitions of address words; Part 1: Data format for positioning, line motion and contouring control systems (Technical report). Geneva, Switzerland: International Standards Organization.
{{cite tech report}}
: CS1 maint: numeric names: editors list (link) - ISBN 0-8311-3375-9.
- ISBN 978-1-59904-716-4– via Google Books.
- ISBN 978-0-7680-9096-3– via Google Books.
- ^ Evans, John M. Jr. (1976). National Bureau of Standards Information Report (NBSIR) 76-1094 (R): Standards for Computer Aided Manufacturing (PDF). National Bureau of Standards. p. 43.
- ^ Schenck, John P. (January 1, 1998). "Understanding common CNC protocols". Wood & Wood Products. 103 (1). Vance Publishing: 43 – via Gale.
- ^ EIA Standard RS-274-D Interchangeable Variable Block Data Format for Positioning, Contouring, and Contouring/Positioning Numerically Controlled Machines, Washington D.C.: Electronic Industries Association, February 1979
- ISBN 978-1-84882-739-4– via Google Books.
- ^ "Fanuc macro system variables". Archived from the original on 2014-05-03. Retrieved 2014-06-30.
- OCLC 895436474.
Bibliography
- Oberg, Erik; Jones, Franklin D.; Horton, Holbrook L.; Ryffel, Henry H. (1996), Green, Robert E.; McCauley, Christopher J. (eds.), OCLC 473691581.
- Smid, Peter (2008), CNC Programming Handbook (3rd ed.), New York: Industrial Press, LCCN 2007045901.
- Smid, Peter (2010), CNC Control Setup for Milling and Turning, New York: Industrial Press, LCCN 2010007023.
- Smid, Peter (2004), Fanuc CNC Custom Macros, Industrial Press, ISBN 978-0-8311-3157-9.
External links
- CNC G-Code and M-Code Programming
- Kramer, T. R.; Proctor, F. M.; Messina, E. R. (1 Aug 2000), "The NIST RS274NGC Interpreter – Version 3", NIST, NISTIR 6556
- http://museum.mit.edu/150/86 Archived 2016-03-19 at the Wayback Machine Has several links (including history of MIT Servo Lab)
- Complete list of G-code used by most 3D printers at reprap.org
- Fanuc and Haas G-code Reference
- Fanuc and Haas G-code Tutorial
- Haas Milling Manual
- G Code For Lathe & Milling
- M Code for Lathe & Milling