https://github.com/themanyone/gcodethumb
Thumbnail viewer for file managers in Linux and possibly Windows. Configure your slicer to embed thumbnails in gcode headers. This tool will render them. Otherwise, it will generate a quick preview, complete with "layer lines" and other unavoidable artifacts from the .gcode itself.)
https://github.com/themanyone/gcodethumb
Last synced: 6 months ago
JSON representation
Thumbnail viewer for file managers in Linux and possibly Windows. Configure your slicer to embed thumbnails in gcode headers. This tool will render them. Otherwise, it will generate a quick preview, complete with "layer lines" and other unavoidable artifacts from the .gcode itself.)
- Host: GitHub
- URL: https://github.com/themanyone/gcodethumb
- Owner: themanyone
- License: gpl-2.0
- Created: 2021-10-02T18:28:07.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2024-08-17T16:46:07.000Z (about 1 year ago)
- Last Synced: 2025-01-29T20:36:28.580Z (8 months ago)
- Language: Python
- Homepage:
- Size: 196 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# gcodeThumb
Extracts thumbnails from `.gcode` headers, or renders them if not present.Includes configuration of file managers to show embedded previews.
## Optional configuration.
You may optionally configure slicers to embed thumbnails.
If embedded thumbnails are present, `gcodeThumb.py` will extract them. They aren't necessary though.
* PrusaSlicer-2.3.3 Look under Printer Settings and set G-Code thumbnails to 128x128, or the size of your printer display.
* Older versions may need to [edit the ini files](https://duckduckgo.com/?q=Prusa+printer.ini+embed+thumbnails&ia=web)
* [Configure Cura](https://github.com/Razor10021990/SnapmakerGcodeWriter)This example shows an embedded thumbnail (orange) alongside our generated thumbnails (blue).
## Limitations
The code takes colossal shortcuts to minimize memory usage and dependencies. The parser doesn't support curves perfectly. It treats them as lines. The renderer fakes 3D by subtracting Y-Z. The shader is literally just layer height. But that's not all. Tracing the path of print head moves from gcode introduces unavoidable artifacts, including "layer lines," "skirts," "brims," and "purge towers." If the results are unsatisfactory, configure slicers to embed previews.Written with Linux in mind. The Python parts should work on Windows, though. If not, [report an issue](https://github.com/themanyone/gcodeThumb/issues) ⏫
## Requirements
Python3. PIL image library.## Linux Installation
* edit `inst.sh` and `uninst. sh` with your preferred install locations.
`inst.sh`
* Clear cache to regenerate thumbnails.
`rm -rf ~/.cache/thumbnails`
Thunar requires `tumbler` to generate thumbnails.
It may be necessary to log out from the desktop session, or reboot.
Other file managers, like `pcmanfm` and `nautilus`, should work now.
## Windows Install
Make sure you have python installed.
Manually copy `gcodeThumb.py` to somewhere in `C:\Program Files`
Open regedit and navigate to `HKEY_CLASSES_ROOT\*.gcode`
Set the value of `ThumbnailHandler` to the location of `gcodeThumb.py`
## Troubleshooting
If no thumbnails are generated, follow the above instruction to clear the thumbnail cache. If it still doesn't work, edit the "MimeType=" line in `~/.local/share/thumbnailers/gcode.thumbnailer`. Use `grep -i gcode /usr/share/mime/*` to discover what mimetypes the system is using and try those. Refer to `https://specifications.freedesktop.org/shared-mime-info-spec/` for complete documentation.
Sometimes GTK bugs out, and it becomes necessary to update its icon cache as well.
`gtk-update-icon-cache ~/.local/share/icons/hicolor/ -t`
## Adding on
From the mime info documentation above, you can add thumbnail support for other gcode-like file extensions, such as `*.gc` and `*.nc` by first creating a file called `Override.xml` in `~/.local/share/mime/packages` like so:
```
Gcode file
```
Then run `update-mime-database ~/.local/share/mime` to see them.Get recent code updates, or fork the project on GitHub. https://github.com/themanyone/gcodeThumb
## Author's links
- GitHub https://github.com/themanyone
- YouTube https://www.youtube.com/themanyone
- Mastodon https://mastodon.social/@themanyone
- Linkedin https://www.linkedin.com/in/henry-kroll-iii-93860426/
- [TheNerdShow.com](http://thenerdshow.com/)