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.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¶
8.4.1.1. 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:
- many academic projects
- OpenSCAD
Git repository and Python binding:
- https://github.com/CGAL/cgal
- https://github.com/CGAL/cgal-swig-bindings
- https://github.com/sciencectn/cgal-bindings
STL (STereoLithography) format support:
- https://en.wikipedia.org/wiki/STL_(file_format)
- https://doc.cgal.org/latest/Polyhedron/classCGAL_1_1Polyhedron__incremental__builder__3.html
- include/CGAL/IO/Polyhedron_builder_from_STL.h
- https://github.com/CGAL/cgal/blob/master/Polyhedron/demo/Polyhedron/Plugins/IO/STL_io_plugin.cpp
- demo/Polyhedron/Plugins/IO/STL_io_plugin.cpp
- https://github.com/CGAL/cgal/blob/master/Polyhedron_IO/include/CGAL/IO/STL_reader.h
- include/CGAL/IO/STL_reader.h
- include/CGAL/IO/STL_writer.h
8.4.1.2. Open CASCADE¶
- https://www.opencascade.com
- Open CASCADE Community Edition
- https://github.com/tpaviot/pythonocc-core — python wrapper
Open CASCADE is used in:
8.5. G-code Visualisation¶
The open source Qt framework provide a multi-platform User Interface framework with 3D support.
-
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 supports the following formats:
- Wavefront OBJ
- Stanford Triangle Format PLY
- STL (STereoLithography)
- Autodesk FBX if the SDK is installed