|
| 1 | +# gcodeplot |
| 2 | + |
| 3 | +*Note that this app purposely supports only a very minimal subset of g-code features, since it is primarily supposed for educational purposes.* |
| 4 | + |
| 5 | + |
| 6 | + |
| 7 | +*The pictures show a screenshot without debugging features and a zoomed screenshot of debugging features.* |
| 8 | + |
| 9 | +## Description |
| 10 | + |
| 11 | +`gcodeplot` is a simulated plotter of [G-code](http://en.wikipedia.org/wiki/G-code) files. It supports only |
| 12 | +- `G28`: **return to home** position |
| 13 | +- `G1 X{} Y{}`: **linear move**, move directly to `(X,Y)` (from current position) |
| 14 | +- `G2 X{} Y{} I{} J{}`: (part-)**circular move in clockwise direction**, move to `(X,Y)` (from current position) along a circle with center in `CURRENTPOS + (I,J)` |
| 15 | +- `G3 X{} Y{} I{} J{}`: (part-)**circular move in anticlockwise direction**, move to `(X,Y)` (from current position) along a circle with center in `CURRENTPOS + (I,J)` |
| 16 | +- `M280 P0 S{}`: **Set the pen** as follows, if `S>=40` down (which means it can draw) and else up |
| 17 | +- `;{}`: **comment**, which can be put on seperate line or after a regular command |
| 18 | + |
| 19 | +## Arguments and features |
| 20 | + |
| 21 | +The application is programmed in rust with the [nannou library](https://nannou.cc/) for displaying and the [pest library](https://pest.rs/) for parsing. It supports the following command line arguments: |
| 22 | +- `INPUT` (required): sets the gcode file to plot |
| 23 | +- `-d {}`, `--debug {}`: This enables debugging and can take values up to 3. While running, this can be changed with the key <kbd>D</kbd> |
| 24 | +- `-s {}`, `--scale {}`: This scales the whole view. While running you can access it with the <kbd>+</kbd>(might be <kbd>=</kbd> on your PC) and <kbd>-</kbd> keys |
| 25 | +- `-g {}`, `--gridsize`: This describes the gridsize used. While running you can access it with the key <kbd>G</kbd> |
| 26 | +- the flag `--hot`, for hot reloading of the gcode file. Alternatively you can update in the app with <kbd>R</kbd> |
| 27 | +- and other arguments as `--treshold`, `--wwidth` and `-wheight`. |
| 28 | + |
| 29 | +It furthermore supports a subcommand `transform`, which |
| 30 | +allows you to transform a file by translation and dilation. |
| 31 | + |
| 32 | +In the graphical app, a few keyboard commands are enabled. To increase a value corresponding to a <kbd>key</kbd>, just press <kbd>key</kbd> and to decrease press <kbd>shift</kbd> + <kbd>key</kbd>. For bigger steps combine these combination with a further <kbd>ctrl</kbd>. |
| 33 | + |
| 34 | +## Room to improve |
| 35 | + |
| 36 | +While the app can be used for many purposes, it is in a early development phase. Tests are missing and not everything is programmed the clever way. If you want to improve it feel welcome to contribute. |
| 37 | + |
| 38 | +TODO: |
| 39 | +- [ ] better loop management for hot reloading |
| 40 | +- [ ] more file maniplulation features |
| 41 | +- [ ] move in grid support |
| 42 | +- [ ] draw mode? |
| 43 | +- [ ] more debug options, e.g. show coordinates |
0 commit comments