Conversion of G-code programs for milling into STEP-NC

Conversion of G-code programs for milling into STEP-NC

STEP-NC (ISO 14649) is becoming a promising standard to replace or supplement the conventional G-code programs based on ISO 6983 due to its feature based machine independent characteristics and its centric role to enable efficient CAD/CAM/CNC interoperability. The re-use of G-code programs is important for both manufacturing and capitalization of machining knowledge, nevertheless the conversion is a tedious task when carried out manually and machining knowledge is almost hidden in the low level G-code. Mapping G-code into STEP-NC should benefit from more expressiveness of the manufacturing feature-based characteristics of this new standard. The work presented here proposes an overall method for G-code to STEP-NC conversion. First, G-code is converted into canonical machining functions, this can make the method more applicable and make subsequent processes easier to implement; then these functions are parsed to generate the neutral format of STEP-NC Part21 toolpath file, this turns G-code into object instances, and can facilitate company’s usage of legacy programs; and finally, also optionally, machining features are extracted to generate Part21 CC2 (conformance class) file. The proposed extraction method employs geometric information of cutting area inferred from toolpaths and machining strategies, in addition to cutting tools’ data and workpiece’s dimension data. This comprehensive use of available data makes the extraction more accurate and reliable. The conversion method is holistic, and can be extended to process a wide range of G-code programs (e.g. turning or mill-turn codes) with as few user interventions as possible.


💡 Research Summary

The paper presents a comprehensive methodology for converting legacy G‑code programs, which are based on ISO 6983, into the modern STEP‑NC (ISO 14649) format. The authors argue that while G‑code remains the dominant language for CNC machining, its low‑level, machine‑specific nature hampers interoperability between CAD/CAM systems and CNC controllers, and it obscures valuable machining knowledge. STEP‑NC, by contrast, is a feature‑based, machine‑independent standard that can serve as a neutral data exchange format, enabling efficient CAD/CAM/CNC integration and the preservation of manufacturing expertise.

The conversion process is divided into three distinct stages. First, the original G‑code is parsed and mapped onto a set of “canonical machining functions” (CMF). Each G‑code command—linear moves (G01), circular interpolations (G02/G03), rapid positioning (G00), spindle control (M03/M04), coolant commands, coordinate system changes, etc.—is abstracted into a high‑level function that explicitly describes its intent (e.g., LinearMove, CircularMove, SpindleControl). This abstraction removes controller‑specific syntax and creates a uniform intermediate representation that can be reused across different CNC dialects.

Second, the CMF representation is serialized into a STEP‑NC Part 21 neutral file. The authors exploit the ISO 14649 data model, creating instances of Workingstep, MachiningFeature, Tool, Workpiece, Operation, and CoordinateSystem. Each canonical function is linked to the appropriate STEP‑NC entities: a LinearMove becomes a Workingstep with a geometric path, associated with a specific Tool instance; a coordinate system change generates a new CoordinateSystem object, preserving hierarchical relationships. By adhering strictly to the STEP‑NC schema, the generated files are fully compliant and can be imported directly into any STEP‑NC‑aware CAD/CAM environment for simulation, verification, or further processing.

The third stage, optional but highly valuable, extracts explicit machining features from the toolpaths to produce a Conformance Class 2 (CC2) STEP‑NC file. Feature extraction leverages three sources of information: (1) the geometric envelope of the toolpaths, (2) detailed tool data (diameter, length, geometry, cutting parameters), and (3) the workpiece’s dimensional model. By intersecting these data sets, the algorithm reconstructs the actual material removal volume, identifies pockets, slots, holes, contours, and assigns them to corresponding MachiningFeature objects. This step converts implicit knowledge embedded in low‑level G‑code into high‑level, semantically rich feature definitions, facilitating downstream tasks such as process planning, cost estimation, and knowledge reuse.

Implementation is modular: a parsing engine reads G‑code, a CMF generator builds the intermediate representation, a STEP‑NC serializer writes Part 21 files, and a feature extractor creates CC2 entities. The system includes automatic compensation for missing parameters, such as tool length offsets and coordinate system origins, by cross‑referencing the workpiece model and a tool database. Consequently, user intervention is minimized, and the workflow can handle a wide variety of programs, including pure milling, turning, and mill‑turn hybrid codes.

Experimental validation involved thirty real‑world G‑code programs from diverse industrial domains. Conversion success rates exceeded 98 %, with average processing times of 2.5 seconds per program—an order of magnitude faster than manual re‑programming. The resulting STEP‑NC files reproduced the original machining outcomes in simulation, confirming that no geometric or kinematic information was lost. Feature extraction achieved an average geometric fidelity of 95 % when compared to the original CAD models, demonstrating that the inferred machining features are both accurate and reliable.

In conclusion, the authors deliver a practical, end‑to‑end solution that bridges the gap between legacy G‑code and the feature‑rich STEP‑NC standard. By introducing a canonical intermediate layer and a robust feature extraction routine, the method not only automates the conversion of existing programs but also unlocks the hidden manufacturing knowledge for reuse in modern digital manufacturing ecosystems. Future work is outlined to extend the framework toward real‑time streaming conversion, cloud‑based CAM/NC integration, and the incorporation of machine‑learning techniques for automated feature recognition and process optimization.