G-code (abbreviation for geometric code; also called RS-274, standardized today in ISO 6983-1) is the most widely used
computer numerical control
Computer numerical control (CNC) or CNC machining is the Automation, automated control of machine tools by a computer. It is an evolution of numerical control (NC), where machine tools are directly managed by data storage media such as punched ...
(CNC) and
3D printing
3D printing, or additive manufacturing, is the construction of a three-dimensional object from a CAD model or a digital 3D model. It can be done in a variety of processes in which material is deposited, joined or solidified under computer ...
programming language
A programming language is a system of notation for writing computer programs.
Programming languages are described in terms of their Syntax (programming languages), syntax (form) and semantics (computer science), semantics (meaning), usually def ...
. It is used mainly in
computer-aided manufacturing
Computer-aided manufacturing (CAM) also known as computer-aided modeling or computer-aided machining is the use of software to control machine tools in the manufacturing of work pieces. This is not the only definition for CAM, but it is the most ...
to control automated
machine tool
A machine tool is a machine for handling or machining metal or other rigid materials, usually by cutting, Boring (manufacturing), boring, grinding (abrasive cutting), grinding, shearing, or other forms of deformations. Machine tools employ some s ...
s, 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
Mill may refer to:
Science and technology
* Factory
* Mill (grinding)
* Milling (machining)
* Millwork
* Paper mill
* Steel mill, a factory for the manufacture of steel
* Sugarcane mill
* Textile mill
* List of types of mill
* Mill, the arithmetic ...
, a
cutting tool
Cutting is the separation or opening of a physical object, into two or more portions, through the application of an acutely directed force.
Implements commonly used for cutting are the knife and saw, or in medicine and science the scalpel an ...
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 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
MIT Servomechanisms Laboratory in the 1950s. In the decades that followed, many implementations were developed by numerous organizations, both commercial and noncommercial. Elements of G-code had often been used in these implementations. The first
standardized
Standardization (American English) or standardisation (British English) is the process of implementing and developing technical standards based on the consensus of different parties that include firms, users, interest groups, standards organiza ...
version of G-code used in the United States, ''RS-274'', was published in 1963 by the
Electronic Industries Alliance
The Electronic Industries Alliance (EIA; until 1997 Electronic Industries Association) was an American standards organization, standards and trade organization composed as an alliance of trade associations for electronics manufacturers in the ...
(EIA; then known as Electronic Industries Association). In 1974, EIA approved ''RS-274-C'', which merged ''RS-273'' (variable block for positioning and straight cut) and ''RS-274-B'' (variable block for contouring and contouring/positioning). A final revision of ''RS-274'' was approved in 1979, as ''RS-274-D''. In other countries, the standard ''
ISO
The International Organization for Standardization (ISO ; ; ) is an independent, non-governmental, international standard development organization composed of representatives from the national standards organizations of member countries.
Me ...
6983'' (finalized in 1982) is often used, but many European countries use other standards. For example, ''
DIN 66025'' is used in Germany, and PN-73M-55256 and PN-93/M-55251 were formerly used in Poland.
During the 1970s through 1990s, many CNC machine tool builders attempted to overcome compatibility difficulties by standardizing on machine tool controllers built by
Fanuc.
Siemens
Siemens AG ( ) is a German multinational technology conglomerate. It is focused on industrial automation, building automation, rail transport and health technology. Siemens is the largest engineering company in Europe, and holds the positi ...
was another market dominator in CNC controls, especially in Europe. In the 2010s, controller differences and incompatibility were mitigated with the widespread adoption of CAD/CAM applications that were capable of outputting machine operations in the appropriate G-code for a specific machine through a software tool called a post-processor (sometimes shortened to just a "post").
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
A high-level programming language is a programming language with strong Abstraction (computer science), abstraction from the details of the computer. In contrast to low-level programming languages, it may use natural language ''elements'', be ea ...
. Additionally, all primary manufacturers (e.g., Fanuc, Siemens,
Heidenhain) provide access to
programmable logic controller
A programmable logic controller (PLC) or programmable controller is an industrial computer that has been ruggedized and adapted for the control of manufacturing processes, such as assembly lines, machines, robotic devices, or any activity that ...
(PLC) data, such as axis positioning data and tool data, 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.
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
Direct numerical control (DNC), also known as distributed numerical control (also DNC), is a common manufacturing term for networking CNC machine tools. On some CNC machine controllers, the available memory is too small to contain the machining p ...
*
LinuxCNC
*
List of computer-aided manufacturing software
References
Bibliography
*
*
*
*
External links
CNC G-Code and M-Code Programming*
* http://museum.mit.edu/150/86 Has several links (including history of MIT Servo Lab)
Complete list of G-code used by most 3D printersat reprap.org
Haas Milling Manual
{{Metalworking navbox, machopen
Computer-aided engineering
Domain-specific programming languages
Encodings
Metalworking