Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OpenSCAD thumbnails, please #7

Open
nathanielstenzel opened this issue Feb 25, 2020 · 10 comments
Open

OpenSCAD thumbnails, please #7

nathanielstenzel opened this issue Feb 25, 2020 · 10 comments

Comments

@nathanielstenzel
Copy link

If you do not do it already, could you please add OpenSCAD file thumbnail generation?
I know this is meant to be an STL thumbnail generator but if it uses OpenSCAD to make them then it should not be a big hassle. At least I hope not.

@kaklik
Copy link
Member

kaklik commented Feb 25, 2020

The .scad file thumbnail generation is a complicated task because of some scad files are very high computation and memory demanding. Therefore calculation of the thumbnail image could easily waste out all system resources.

@nathanielstenzel
Copy link
Author

I will have to admit that I have made one or two that would not "render" on my older machines. The "preview" on those works just fine, but can you get an image from the "preview" instead of the "render"?

@nathanielstenzel
Copy link
Author

It looks like you can export a PNG file from a "preview". That would work great. I don't think anyone would expect the thumbnails of any file to be made out of a high resolution render when there is a cheap (processing-wise) and easy method available.

@nathanielstenzel
Copy link
Author

cmd = "openscad -o %s.png --preview --imgsize=%s,%s %s 2> /dev/null; mv %s.png %s" % (fout, size, size, ff, fout, fout)

The --preview forces it to generate the image in preview mode. My test file was admittedly a simple one. I do not know if the default behavior is --render or --preview or if it varies based on output dimensions. I do know that the command generated a PNG of my SCAD file.

@nathanielstenzel
Copy link
Author

It looks like --preview is the default mode. Something with 781 CSG tree elements gets a thumbnail in 21-48 seconds on a Intel(R) Celeron(R) CPU 900 @ 2.20GHz (single core) when I run the command by hand. That is crappy, but it is a complex file on an old machine with 6GB of RAM too.

@nathanielstenzel
Copy link
Author

https://github.com/nathanielstenzel/stl-thumbnailer

I am not sure if I actually had to adjust the STL thumbnail stuff. I had trouble getting it to work. The magic number thing seemed to get it to work for me. It may be my imagination though since I tried a number of things.

@nathanielstenzel
Copy link
Author

It was easier to just have OpenSCAD called directly for the OpenSCAD thumbnail generation so I switched to that.

@nathanielstenzel
Copy link
Author

It looks like the Debian version in Linux Mint does not like --preview and expect a specific option to go with --preview. I have not made this thumbnailer work on Linux Mint but I have on Fedora Linux.

@vmario89
Copy link

vmario89 commented Aug 2, 2021

made some fork of the fork, which is made for Fedora 34, supporting stl and scad. dirty but works: https://github.com/vmario89/stl-thumbnailer

@ajbogh
Copy link
Contributor

ajbogh commented Dec 2, 2022

I had trouble with the current version in Ubuntu and found that the code for using openscad was complicated because it had to generate additional temp files. I created a fork that uses stl-thumb and opened #11.

Feel free to decline it if you feel like openscad is better.

@kaklik kaklik changed the title OpemSCAD thumbnails, please OpenSCAD thumbnails, please Dec 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants