Parsing and translating ISO 6983 CNC G-code between dialects
The goal of this work is to try to create a parser and translator for Computer Numerical Control (CNC) code based on ISO 6983-1:2009[3], better known as G-code, between different dialects and machine implementations. Besides different choices in how common language features are implemented between vendors, there are often non-standard-compliant changes to the language content, and on top of this machines using G-code varies quite a lot in functionality, and thus implement quite different set of features on top of the basic language. The goal of this project is to start from the basic level defined in the standard and work upward to see to what extent a general parser/translator can be implemented and if any unsurmountable obstacles make themselves known. The intended use case for a potential end product is simplifying the conversion of CNC controlled production work between different machines that a company may have available to them, in the case where the programs are not defined through a separate CAD/CAM process but rather by manual programming. There will always be a need for user input before a translated program can be used on a real machine, since the tooling and setup of the machines may vary in a way that cannot easily be known at translation time, but it could potentially save time from having to redo programs from scratch. During the project, a minimal viable product is developed to serve as a proof of concept and as a vehicle to find some of the spots where translation will be more difficult to handle in the general case. The method chosen for this attempt is to first implement a minimal, mostly standard compliant, parser, then add those features needed to define a set of basic operations for two specific machines in use by the sponsoring company, and thus search in an iterative manner for where the pain points are for implementation, and refactoring the solution as needed to address those. Translation is done by creating a parse tree defined by the operations, commands, and parameters that codes refer to, one block at a time. This tree is then read by the output generator and transformed according to case-by-case rules until it defines a tree consisting only of those building blocks the target machine supports while as far as possible preserving the physical expressions this tree would take when run in a machine. This transformed tree can then be used to generate G-code usable by the target machine.
Publication Details
- Journal
- Örebro University Library (Örebro University)
- Published
- 2025-01-01
- Primary Topic
- Manufacturing Process and Optimization
- Type
- article
- Field-Weighted Citation Impact
- 0.00