G-code began as a limited language that lacked constructs such as loops, conditional operators, and programmer-declared variables with [[Natural language|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,<ref>{{cite web |url-status=dead |archive-date=2014-05-03 |url=http://www.machinetoolhelp.com/Applications/macro/system_variables.html |title=Fanuc macro system variables |access-date=2014-06-30 |archive-url=https://web.archive.org/web/20140503030834/http://www.machinetoolhelp.com/Applications/macro/system_variables.html }}</ref> via variables used by NC programs. These constructs make it easier to develop automation applications.
==Programming environments==
{{Original research section|date=January 2016}}
G-code's programming environments have evolved in parallel with those of general programming—from the earliest environments (e.g., writing a program with a pencil, typing it into a tape puncher) to the latest environments that combine CAD ([[computer-aided design]]), CAM ([[computer-aided manufacturing]]), and richly featured G-code editors. (G-code editors are analogous to [[XML editor]]s, using colors and indents semantically [plus other features] to aid the user in ways that basic [[text editor]]s can't. CAM packages are analogous to [[integrated development environment|IDEs]] in general programming.)
Two high-level paradigm shifts have been toward:
# abandoning "manual programming" (with nothing but a pencil or text editor and a human mind) for [[:Category:Computer-aided manufacturing software|CAM software]] systems that generate G-code automatically via postprocessors (analogous to the development of [[Visual programming language|visual]] techniques in general programming)
# abandoning hardcoded constructs for parametric ones (analogous to the difference in general programming between hardcoding a constant into an equation versus declaring it a variable and assigning new values to it at will; and to the [[object-oriented programming|object-oriented]] approach in general).
Macro (parametric) CNC programming uses human-friendly variable names, [[relational operator]]s, and loop structures, much as general programming does, to capture information and logic with machine-readable semantics. Whereas older manual CNC programming could only describe particular instances of parts in numeric form, macro programming describes abstractions that can easily apply in a wide variety of instances.
The tendency is comparable to a computer programming evolution from [[low-level programming language]]s to [[High-level programming language|high-level ones]].{{Citation needed|date=January 2022}}
[[STEP-NC]] reflects the same theme, which can be viewed as yet another step along a path that started with the development of machine tools, jigs and fixtures, and numerical control, which all sought to "build the skill into the tool." Recent developments of G-code and STEP-NC aim to build the information and semantics into the tool. This idea is not new; from the beginning of numerical control, the concept of an end-to-end CAD/CAM environment was the goal of such early technologies as [[DAC-1]] and [[APT (programming language)|APT]]. Those efforts were fine for huge corporations like GM and Boeing. However, [[small and medium enterprises]] went through an era of simpler implementations of NC, with relatively primitive "connect-the-dots" G-code and manual programming until CAD/CAM improved and disseminated throughout the industry.
== See also ==
|