Welcome! Log In Create A New Profile

Advanced

Converting STL files to images

Posted by nophead 
Converting STL files to images
March 08, 2012 03:49PM
Does anybody know a Windows command line tool that will convert STL files to images, png or jpg?


[www.hydraraptor.blogspot.com]
VDX
Re: Converting STL files to images
March 08, 2012 04:03PM
Hi Chris,

is it a 3D-renderer or a slicer, what you're searching?

You should look if Meshlab is operable per batch-jobs ...


Viktor
--------
Aufruf zum Projekt "Müll-freie Meere" - [reprap.org] -- Deutsche Facebook-Gruppe - [www.facebook.com]

Call for the project "garbage-free seas" - [reprap.org]
Re: Converting STL files to images
March 08, 2012 04:08PM
A 3D render for Mendel90 documentation. Will Meshlab do that?


[www.hydraraptor.blogspot.com]
VDX
Re: Converting STL files to images
March 08, 2012 04:27PM
... tested the actual Version for my Win7_64bit - you can save a snapshot of the actual visible object with a 'screen-multiplyer' - an object on my notebook-screen with screen-multiplyer of 10 was saved as a .PNG with 13660x6250 pixel in full resolution!

I'm rendering mostly with Lightwave - ask me, if you need something special rendered photorealistic, but Meshlab seems to make things easier ...


Viktor
--------
Aufruf zum Projekt "Müll-freie Meere" - [reprap.org] -- Deutsche Facebook-Gruppe - [www.facebook.com]

Call for the project "garbage-free seas" - [reprap.org]
Re: Converting STL files to images
March 08, 2012 05:43PM
I don't think it can do a screenshot in batch mode because there isn't a screen. Openscad has the same problem, you can do it from the GUI, but not from the command line.


[www.hydraraptor.blogspot.com]
VDX
Re: Converting STL files to images
March 08, 2012 05:52PM
... why from command line?

For a good representation you have to orient the STL-object in space, what's only possible with the GUI.

The 'screenshot' is not a screen-copy, but a special task, that renders the object anew with different setting than the actual screen view (especially with the screen-multiplyer-option).

You can download the complete source, so maybe a programming interface?

You should read through the documentation, what's possible with scripting or plugins ...


Viktor
--------
Aufruf zum Projekt "Müll-freie Meere" - [reprap.org] -- Deutsche Facebook-Gruppe - [www.facebook.com]

Call for the project "garbage-free seas" - [reprap.org]
It'd require a bit of hand-cobbling, but it can be done with some free tools:

There's a python script called stl2pov that will generate meshes for POV-Ray: [rsmith.home.xs4all.nl]

POV-Ray (http://www.povray.org/download/) can do commandline renders:

For example, render "woodbox.pov" at 640x480, as a PNG:
pvengine /exit /render woodbox.pov +W640 +H480 +FN

If you used stl2pov to generate the same output mesh filename, you could use a fixed .pov template file for all of the renders.

-Dave
VDX
Re: Converting STL files to images
March 08, 2012 06:09PM
... some years passed, since I've last used POVray - most of my renders were made for short video clips, so changed to Lightview and 3DSMax ... but yes, would be my second bet after Meshlab grinning smiley


Viktor
--------
Aufruf zum Projekt "Müll-freie Meere" - [reprap.org] -- Deutsche Facebook-Gruppe - [www.facebook.com]

Call for the project "garbage-free seas" - [reprap.org]
Re: Converting STL files to images
March 08, 2012 06:16PM
I want to do it from the command line because I have a lot of different parts to make images of. I don't want to open each one, render it and save it manually.

I can orient the object in the STL file to put its best face towards the camera.

Thingiverse does it but for some reason it puts an object in the first quadrant at the back and shows the Y axis going the wrong way. If you look here: [reprap.org] you can see somebody has uploaded the Thingiverse images but the objects are all at the back. I could move them in the STL file but it takes a long time to upload them all again. Some of those files contain multiple objects but I want to show them all individually. There are actually 44 different parts, a lot of them are tiny though.

I can't find the documentation, it is a 404 but the command line usage seems to for inputting a mesh, operating on it with a script and outputting it as a mesh again.

I don't think the source code will help. The fundamental problem is that it is a screen shot and there is no screen. There doesn't seem to be an export raster option. It's the same with openscad.

Perhaps I need povray. I think that is what Thingiverse uses.


[www.hydraraptor.blogspot.com]
Re: Converting STL files to images
March 09, 2012 12:16AM
With a little python scripting, you can also automate Blender to render STL files to images from the command line.


--
Tony Buser http://tonybuser.com * http://reprap.org/wiki/User:Tbuser#Projects
Re: Converting STL files to images
March 09, 2012 06:44AM
does this help: [forge.kasey.fr]?
Re: Converting STL files to images
March 10, 2012 05:28PM
nophead, I have experience making tech art with Blender and would like to volunteer my services, if you'd find it helpful.

I can import all the pieces into Blender and render them for you. Or, if you think there's going to be an ongoing need for new renders, I can import all the pieces, set up the scene (settings, lights, camera) and send the file to you. You'd just have to move the parts around as you like and then hit F12 to render the image. Of course, I can do both; render everything and send you the Blender scene as well.

Here's a quickly done sample. The mesh put out by OpenScad tends to be messy, I'm afraid, so you'll see some lines where there shouldn't be, but I can clean up those issues given more time.


Re: Converting STL files to images
March 10, 2012 06:04PM
I can render them manually in openscad, netfabb and Meshlab. What I want to do is run a Python script that makes all the STL files and the images from them. The reason being is that there are a lot of small parts in Mendel90 (rather that trying to minimise the printed parts like everybody else does, I make use of the fact that I have a 3D printer and make as much as I can, such as 3 sizes of cable clip to match the bundles of wires, PCB standoffs, etc). I need the images so people can identify the parts, as some look very similar.

The design is parametric so people can select what rods, motors, etc they prefer and my python scrip makes all of the STL files, DXF files, master BOM and sub assembly BOMs. I have three standard configurations and it would be very tedious to manually render all those images.

stl2pdf or stl2pov and povray might do what I want but it needs a later version of python than I am running, so I will have to install it on another machine as I can't afford to stop my machines running ( they rely on Python). It probably isn't much hassle to update, but it will have to wait a day or two.

The extra lines you can see are real. They are a consequence of me adding a 0.01mm bodge factor all over the place to avoid coincident faces which make non-manifold objects, a PITA but seems to be the norm with CSG. They are less visible in packages that just draw the surfaces rather than the edges. This is what it looks like on openscad. It's a pity it can't make images from the command line.



Edited 1 time(s). Last edit at 03/10/2012 06:06PM by nophead.


[www.hydraraptor.blogspot.com]
Attachments:
open | download - x-motor.png (20.2 KB)
Re: Converting STL files to images
October 31, 2012 01:43PM
Can somebody help me to use Blender from command-line to open a STL file, center it and render it as a jpeg file.

Regards,
Nuri Erginer
Re: Converting STL files to images
October 31, 2012 01:59PM
Have a look at mendel90 on github: [github.com]

Render.py does what you want with some helper files: [github.com]


[www.hydraraptor.blogspot.com]
Re: Converting STL files to images
October 31, 2012 02:27PM
WOW That is what I need. Our community is very lucky to have you nophead.

Thanks alot.

Nuri
Re: Converting STL files to images
October 31, 2012 03:48PM
Don't thank me, it was zignig who contributed it. I haven't a clue about Blender.


[www.hydraraptor.blogspot.com]
Re: Converting STL files to images
April 28, 2013 06:46PM
Stumbled upon this web based STL to Image converter that does the job.
[stlfoo.lazywasp.net]

It lets you select a local STL file, instantly convert it to a PNG image and save it to your server... Sort of a an automatic thumbnail generator for STL files. It uses Javascript/Html5/PHP for the job.

So if you are looking for a web based solution to convert STL file to image this seems to be the thing available out there.

Cheers!
Re: Converting STL files to images
May 17, 2013 04:55AM
I prefer to I prefer to use a SDK rather than a program because the former one is simpler and faster in its way of processeing.

However, I'm still a green hand here.

I need your suggestion badly.

Thanks in advance.


Best Regards,
Arron
I'm new at RepRap
Wanna learn about image conversion.
Re: Converting STL files to images
May 17, 2013 03:15PM
openscad is able to render to images, i'm using 2013.05.16, i think some version before it was also able to output images
Usage: /home/gchoinka/opt/openscad/openscad [ -o output_file [ -d deps_file ] ]\
                                            [ -m make_command ] [ -D var=val [..] ] [ --render ] \
                                            [ --camera=translatex,y,z,rotx,y,z,dist | \
                                              --camera=eyex,y,z,centerx,y,z ] \
                                            [ --imgsize=width,height ] [ --projection=(o)rtho|(p)ersp] \
                                            filename

e.g.
openscad  --projection=o --camera=0,0,0,55,0,25,328 --imgsize=1000,1000  -o "test2.png" test.scad
Attachments:
open | download - test2.png (5 KB)
Re: Converting STL files to images
May 17, 2013 03:21PM
FTR Here is a little tutorial on the povray approach. If we're talking websites, thingiview is nice. (As noted on this this thread)
Re: Converting STL files to images
July 03, 2013 05:18PM
stl2pov you can also get as C source code to create a command line executable.


Bob Morrison
Wörth am Rhein, Germany
"Luke, use the source!"
BLOG - PHOTOS - Thingiverse
Sorry, only registered users may post in this forum.

Click here to login