Open G-Pereira opened 5 years ago
Hello,
I can confirm this behavior on Ubuntu 18.04.1. It seems to be corrupted by some changes in OS. I am unable to solve this issue, although it seems to be similar to the following reports: https://github.com/NixOS/nixpkgs/issues/50494 https://unix.stackexchange.com/questions/410395/custom-thumbnail-generation-fails
Having the same problem on Ubuntu 16.04.5 is there any workarauound to get this going?
I do not know, what is the difference. But here https://github.com/MLAB-project/stl-thumbnailer/issues/6 seem to be proof that at least some machines the same version still works. Isolating the trouble will be a great improvement of this thumbnailer.
Same problem with Ubuntu 20.04. No thumbnails at all. Any hints on how to troubleshoot it?
Same problem with Ubuntu 22.04.
Hi, I'm also having this problem with Ubuntu 22.04 .
Try https://github.com/unlimitedbacon/stl-thumb that should work.
Try https://github.com/unlimitedbacon/stl-thumb that should work.
I tried this one too and it didn't work. Just installed the deb file with GDebi and rebooted but the STL files just show blank document icons like before.
Is OpenGL installed?
Isn't openGL support built into the GPU?
Sorry, I meant OpenSCAD
Yes, it is installed.
I'm able to run the python script on its own and get a good result. However, I too can't get any thumbnails to show up after following the guide, including logging out and back in. What I did see in the logs is:
openscad[506240]: segfault at a8 ip 0000560bea2b42e4 sp 00007ffc6e774698 error 4 in openscad[560bea02d000+51a000]
Whenever it tries to generate a thumbnail. I don't know enough about how nautilus/ubuntu calls the script to troubleshoot further.
DISTRIB_ID=Ubuntu DISTRIB_RELEASE=22.04 DISTRIB_CODENAME=jammy DISTRIB_DESCRIPTION="Ubuntu 22.04.1 LTS"
Sounds like a problem with your OpenSCAD installation. Whats your OpenSCAD version?
OpenSCAD version 2021.01
I agree this looks like it might be an openscad issue, but why does the script work when I run it manually? Maybe it's a Nautilus issue?
GNOME nautilus 42.2
have you tried running OpenSCAD just from command line manually? Like giving it an input file to turn into an image (like what the thumbnail does)?
No, because I don't fully understand how the code converts the stl file to a scad one. If I have time later today I'll try to understand it better and run it manually. Or I can just try to find any scad file online and try that
I found a .scad file on thingiverse and was able to use openscad to convert it to png:
$ openscad -o out.png --imgsize=256,256 ../Downloads/Nut_Job.scad
Compiling design (CSG Products normalization)...
Normalized CSG tree has 1903 elements
Geometries in cache: 707
Geometry cache size in bytes: 875472
CGAL Polyhedrons in cache: 0
CGAL cache size in bytes: 0
Total rendering time: 0:00:00.354
File from https://www.thingiverse.com/thing:193647/files
Next I'll try to isolate the code that converts stl to scad and re-running the openscad command manually and see what happens.
I understand now. We're using the import() function in openscad to convert the file, which is written in plaintext to the /tmp folder. That's then fed to the openscad command. Running that manually also worked, but only if I gave it the full absolute path (relative paths error out with not found as it tries to do from /tmp):
# HERE WE'RE USING RELATIVE PATH. ALL I'M DOING IN MY TEST SCRIPT IS WRITING THE FILE OUT AND PRINTING WHAT WE WE WOULD'VE RUN
$ ./test_stl_thumb.py ../Documents/HeroMe/HMG5_Creality_Direct_Drive_Adapter.stl testingout.png 256
/tmp/stl_to_png_2d4b4dba3cd071a8c6d3b022b419ac06.scad
openscad -o testingout.png.png --imgsize=256,256 /tmp/stl_to_png_2d4b4dba3cd071a8c6d3b022b419ac06.scad 2> /dev/null; mv testingout.png.png testingout.png
$ cat /tmp/stl_to_png_2d4b4dba3cd071a8c6d3b022b419ac06.scad
1 │ import("../Documents/HeroMe/HMG5_Creality_Direct_Drive_Adapter.stl");
# WE FAIL DUE TO RELATIVE PATH
$ openscad -o testout.png --imgsize=256,256 /tmp/stl_to_png_2d4b4dba3cd071a8c6d3b022b419ac06.scad
WARNING: Can't open import file '/tmp/../Documents/HeroMe/HMG5_Creality_Direct_Drive_Adapter.stl', import() at line 1
Compiling design (CSG Products normalization)...
Normalized CSG tree has 1 elements
Geometries in cache: 1
Geometry cache size in bytes: 152
CGAL Polyhedrons in cache: 0
CGAL cache size in bytes: 0
Total rendering time: 0:00:00.107
# USE AN ABSOLUTE PATH
$ ./test_stl_thumb.py /home/me/Documents/HeroMe/HMG5_Creality_Direct_Drive_Adapter.stl testingout.png 256
/tmp/stl_to_png_a2f9bbfd47187b05ca04309ca098b3ba.scad
openscad -o testingout.png.png --imgsize=256,256 /tmp/stl_to_png_a2f9bbfd47187b05ca04309ca098b3ba.scad 2> /dev/null; mv testingout.png.png testingout.png
# CONVERT USING THE GENERATED TMP FILE THAT NOW CONTAINS THE IMPORT FUNCTION WITH AN ABSOLUTE PATH
$ openscad -o testout.png --imgsize=256,256 /tmp/stl_to_png_a2f9bbfd47187b05ca04309ca098b3ba.scad
Compiling design (CSG Products normalization)...
Normalized CSG tree has 1 elements
Geometries in cache: 1
Geometry cache size in bytes: 67832
CGAL Polyhedrons in cache: 0
CGAL cache size in bytes: 0
Total rendering time: 0:00:00.115
$
So this seems to be a Nautilus issue. I'm going to see what else I can debug when Nautilus tries to run it.
I see the issue: when nautilus runs it, it provides the input file as /tmp/name_of_stl
. So the import .scad file that is generated point to a non-existent file in /tmp: import("/tmp/HMG7 Universal Face Down Base.stl");
. The stl file to be thumbnailed is never copied there, but it really shouldn't. That would be unnecessary I/O. So we need to figure out how to appropriately format the import to include the full path to the stl.
Log file: 4 ['/usr/local/bin/stl_thumb.py', '/tmp/HMG7 Universal Face Down Base.stl', '/tmp/gnome-desktop-thumbnailer.png', '256']
Generated scad file: import("/tmp/HMG7 Universal Face Down Base.stl");
The correct path to the stl file exists within a folder in my home directory. So the correct import function command should be: import("/home/me/path/to/HMG7 Universal Face Down Base.stl");
Recently I merged the pull request https://github.com/MLAB-project/stl-thumbnailer/pull/11 which seems to resolve that long-term issue, by removing dependency on OpenSCAD and replacing it with stl-thumb that solution seems to be a less prone to errors, because it does not need temporary files. I had tested it on two different machines and it seems to work better, to me.
Recently I merged the pull request #11 which seems to resolve that long-term issue, by removing dependency on OpenSCAD and replacing it with stl-thumb that solution seems to be a less prone to errors, because it does not need temporary files. I had tested it on two different machines and it seems to work better, to me.
Brilliant! I'll test it soon. Thank you!
OS: Arch Linux I think this output can be helpful:
What information can I provide to further investigate the error? I already rebooted my pc. PS: sudo update-mime it does not wotk on my computer, the command isn't found