Remake of MKS plugin and it's MKSPreview.py file to make a print preview in PrusaSlicer.
The script was created primarily for the Two Trees Bluer
printer, but by configuring it according to the JSON file below, it can be used for other types of printers as well.
The original script uses Cura's Snapshot class to make a screenshot of a model.
We edited it to extract the PrusaSlicer's G-code thumbnail and ussing Post-processing script it's edited and added to the G-code in the corresponding format.
- Go to
Printers > General > Firmware > G-code thumbnails
and insert400x300/PNG
. Now the slicer will make a screenshot of a model each time you Export it.
-
Get a full path of this script. Something like
path-to-file\GcodePreviewAdder.py
-
Get a full path of a Python executable. Something like
C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python39_64\python.exe
-
Now you can go to
Print Settings > Output options > Post-processing scripts
and insert the Python and script paths in quotes like:
"C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Python 3.9" "C:\path-to-file\GcodePreview\GcodePreviewAdder.py"
- Enjoy! Now the slicer will add a preview of a model on the Export
A: Most likely your Python interpreter doesn't have the libraries installed.
- With the full Python path run this:
"full-python-path\python.exe" -m pip list
- If you get an error
No module named 'pip'
, then downloadhttps://bootstrap.pypa.io/get-pip.py
and run it with your interpreter.
"full-python-path\python.exe" "full-path-to-the-get-pip.py"
Now the step 1 should work :D
- When the step 1 is working but the
PyQt5
library is not listed. Install it ussing
"full-python-path\python.exe" -m pip install PyQt5
A: Our remake of this script uses Default configuration of the plugin and it can be remade for any other configuration.
Just rewrite the values in the generate_preview(image)
function according to your needs.
[
{ "index": 1, "label": "Default", "simage": "100", "gimage": "200", "encoded": false },
{ "index": 2, "label": "FLSUN QQ-S", "simage": "", "gimage": "" , "encoded": false },
{ "index": 3, "label": "Flying Bear Ghost 4S/5", "simage": "50", "gimage": "200", "encoded": false },
{ "index": 4, "label": "Two Trees Sapphire", "simage": "100", "gimage": "200" , "encoded": false },
{ "index": 5, "label": "Wanhao D12", "simage": "100", "gimage": "200" , "encoded": false },
{ "index": 6, "label": "Artillery Sidewinder X3", "simage": "85", "gimage": "230", "mimage": "170", "encoded": true },
{ "index": 7, "label": "Elegoo Neptune2 | NeptureX", "simage": "100", "gimage": "200", "encoded": true },
{ "index": 8, "label": "Elegoo Neptune3+", "simage": "160", "gimage": "200", "encoded": true }
]
When there is too small gimage
:
A: The color of the preview depends on a color of the model
A: Yes! Run it with your Python interpreter like this:
python3 "path-to-file\GcodePreviewAdder.py" "path-to-file\sliced-model.gcode"