gcodeToObj
Rust 2021 Edition.
A G-code visualization tool written in rust
A nom based parser, outputs a "Wavefront Obj" file which can be imported into blender for visualization.
Both .gcode files and binary .bgcode files are accepted.
Multipart files are supported, for examples purge towers will be written to the OBJ file as a separate object,
Performance
Currently 9.9MByte bgcode file can be processed into a 16MBytes obj file in 1.5secs.
[ See the git repository associated with this project... assets/gear-holder-print-in-place_04n_022mm_pla_mk4_6h49m.bgcode ]
How to use
Pass the gcode file in as 'StdIn' and the program will send the obj file to 'StdOut' :-
Binary ".bgcode" files must be passed in by filename :-
## Binary bgcoode files must be passed in as an argument because they are not utf-8 encoded
Here the obj files are imported in to blender and processed.
Within blender :-
- This obj has been "Imported".
- Converted into a "Curve".
- Finally a circular bevel object has been applied to make the object solid [ A circle to represent a 0.1mm fibre].
Future work
-
Make this nom-parser a "streaming / zero copy" parser. So only a small fragment of the large files is in memory.
-
I have only tested against gcode files that use absolute positioning.
-
Convert "G5 - Bézier Cubic Spline" commands into the equivalent "obj" spline by defining a basis matrix. Support is not universal I could fall back to a series of line segments.