[Media] A G-code simulator in Rust. Looking for feedback.

595 points NavrajKalsi 38 comments
[Media] A G-code simulator in Rust. Looking for feedback.

Hi there, thanks for clicking on this post!

I recently completed my first project in Rust after finishing the Rust book (Option, match & Result are the best things I have seen after learning about pointers in C, although I haven't seen much).

Geometric-code is used mostly in manufacturing to encode instructions for CNC machines that move them in a precise and controlled manner.

The program is split across two threads:

  1. TUI thread: Parses and interprets the code, updates TUI and sends the changes to the GUI.
  2. GUI thread: Renders the changes received from the TUI either in 3D space or 2D XY plane (toggleable at runtime).

Why use the TUI anyways?
When I started this project, I did not know anything about TUIs and planed to render the simulation inside the TUI itself (I did not know anything about character cells sizes and the resolution a terminal offers).
Needless to say, it looked terrible (I could not even get a circle to render correctly).
I needed much more resolution and still wanted to implement my new-found knowledge of TUIs. Hence, TUI and GUI architecture.

I have tried to explain and highlight the workings of the program in the project README.

I would appreciate if you took some time to take a look at the project and offer any feedback, comment, criticism or suggestion.

Github: https://github.com/navrajkalsi/gsim-rs

Thank you!