8. Design Notes

8.1. G-Code Parser

The RS-274 parser is generated automatically from the grammar defined in the paper The NIST RS274NGC Interpreter — Version 3 (Appendix E) using the generator PLY which implement a LALR(1) parser similar to the tools lex and yacc.

The parser construct an abstract syntax tree (AST) during the parsing.

User can subclass this parser to support a derived G-code flavour.

8.2. G-code flavours

The different flavours are partly handled in YAML files.

8.3. G-code Generation and Simulation

8.4. Computational Geometry Engine

The computational geometry engine requires these features :

  • import standard 2D object file, e.g. SVG and DXF
  • import standard 3D object file, e.g. STL
  • 2D path erosion and dilation, e.g. to compute cutter radius compensation
  • 2D/3D Minkowski sum along a path
  • 3D extrusion
  • 3D Boolean operation : object - tool path

8.4.1. List of the Main Open Source Computational Geometry Algorithms Libraries The Computational Geometry Algorithms Library

CGAL is a software project that provides easy access to efficient and reliable geometric algorithms in the form of a C++ library. CGAL is used in various areas needing geometric computation, such as geographic information systems, computer aided design, molecular biology, medical imaging, computer graphics, and robotics.

CGAL is used in:

Git repository and Python binding:

STL (STereoLithography) format support:

8.5. G-code Visualisation

The open source Qt framework provide a multi-platform User Interface framework with 3D support.

  • Qt 3D

    Qt 3D provides functionality for near-realtime simulation systems with support for 2D and 3D rendering in both Qt C++ and Qt Quick applications.

  • QMesh Class

    QMesh supports the following formats:

    • Wavefront OBJ
    • Stanford Triangle Format PLY
    • STL (STereoLithography)
    • Autodesk FBX if the SDK is installed