The rest of this email is just describing how I did it and what files I used.
You can find bearing.stl in OCC 6.3.0; linux users can run `locate bearing.stl` and find it.
bearing.stl was here for me on various machines: /home/bryan/opencascade/OpenCASCADE6.3.0/data/stl/bearing.stl /home/kanzure/local/opencascade/OpenCASCADE6.3.0/data/stl/bearing.stl
You can find bearing.iges in OCC 6.3.0; linux users can run `locate bearing.iges` and find it.
bearing.iges was here for me on various machines: /home/bryan/opencascade/OpenCASCADE6.3.0/data/iges/bearing.iges /home/kanzure/local/opencascade/OpenCASCADE6.3.0/data/iges/bearing.iges /home/kanzure/code/skdb/import_tools/models/bearing.iges
I don't want to upload that STL file, sorry. There's already an STL file there, but it's the one provided with OCC 6.3.0, not the one generated by running iges2stl.
iges2stl is *slow*. OCC is very slow when exporting or converting to STL. Took me about 30 to 60 seconds for the bearing.
Clearly the resulting image doesn't look as good as occray. I wish I would have known about occray last night, I wouldn't have written iges2png and have to reinvent the wheel.
I looked around on the opencascade.org forum and found that others have been trying to generate images from CAD files since 2000. There were posts in 2000, 2002, and one more recently in 2008, of people complaining about Xw_Window.cxx and how OCC uses Xlib to save an image of the scene, rather than using some off screen rendering mechanism. I also noticed that src/OpenGl/ isn't included in pythonOCC? I was hoping to dig around in there and see if I could find a way to do off screen rendering. PyOpenGL doesn't implement the gl off screen rendering method, sadly enough, so it might have to be either compiled into OCC, or we just hope that the OCC devs bothered to put it in (which I am starting to doubt).
The other option is to use blender for rendering of STL files. Sadly this still requires using OCC to convert from IGES/STEP to STL, which takes forever. The other problem is that my blender script doesn't seem to work-- I use renderAnim, I set up lamps and lights, and point the camera at the object, but the resulting image is just black pixels.
I was running blender with: blender -b -P render_image.py
I see. Right now converting from IGES to STL is taking a long time. The povray part is pretty quick. One other option that I am investigating is using gmsh (which links to OCC) to load an IGES file and then save an image (it has some image saving functions). The problem is that the output of the GIF exporter looks like this:
But it is significantly faster, so a compiled tool (linking to gmsh) might be better in the end. I don't know how fast occray is, it was just announced this morning. An off-screen OpenGL renderer would be even better. I guess I'll go back to digging through the OCC code-base.
I've experimented a bit with Zach Smith's render, which is in use at
Thingiverse.com. I think I have the files you need to get similar to
Thingiverse rendering. The following are files branched from a very
old release of Zach's setup, but they do work under Debian and Ubuntu
(with perl and probably requiring some libraries). I've uploaded it
here:
It was part of an attempt to improve it for Thingiverse, which I
really wish to support. Perhaps, since it's also useful to you, we can
improve it together.
Eventually it should be part of a system, I envision that serves as a
distributed processing system where everyone can participate in
helping rendering and toolpath generation (skeinforge for 3D printing
is pretty processor intensive) for fabbing.
Also, I'd like to see user generated parametric models being converted
into fabber ready (e.g. STL) file format. I've just tried a proof of
concept of this by making a bottle from a script. I only 'told it'
which dimensions I wanted. Creating a completely seamless (but clogged
together) toolchain to have the machine fab without any manual steps
in between it is entirely a plausible thing to code in a week, but I'm
afraid that I don't have a spare week right now ;)
Here is a blast from the past! I was reading a lot of stuff to get .stl files to load on a site I'm creating and found this from 2009.
Would one of you be able to elaborate on how to have stls be viewable like Thingiverse? The file can be successfully loaded by a user but open up in a new page as data.
> I've experimented a bit with Zach Smith's render, which is in use at > Thingiverse.com. I think I have the files you need to get similar to > Thingiverse rendering. The following are files branched from a very > old release of Zach's setup, but they do work under Debian and Ubuntu > (with perl and probably requiring some libraries). I've uploaded it > here:
> It was part of an attempt to improve it for Thingiverse, which I > really wish to support. Perhaps, since it's also useful to you, we can > improve it together.
> Eventually it should be part of a system, I envision that serves as a > distributed processing system where everyone can participate in > helping rendering and toolpath generation (skeinforge for 3D printing > is pretty processor intensive) for fabbing.
> Also, I'd like to see user generated parametric models being converted > into fabber ready (e.g. STL) file format. I've just tried a proof of > concept of this by making a bottle from a script. I only 'told it' > which dimensions I wanted. Creating a completely seamless (but clogged > together) toolchain to have the machine fab without any manual steps > in between it is entirely a plausible thing to code in a week, but I'm > afraid that I don't have a spare week right now ;)
On Sat, Oct 20, 2012 at 3:03 PM, Andrew Mazzotta
<andrewmazzo...@gmail.com>wrote:
> Would one of you be able to elaborate on how to have stls be viewable like
> Thingiverse? The file can be successfully loaded by a user but open up in a
> new page as data.
I don't understand your second sentence. Anyway, thingiverse has since
changed their rendering system to something using blender. The original
method was the stl2pov script with some tweaks.
Basically you want to use a task queue to render things as they are
uploaded from your website. For example, I was doing this from a git
post-receive hook.
<andrewmazzo...@gmail.com> wrote:
> Would one of you be able to elaborate on how to have stls be viewable like
> Thingiverse? The file can be successfully loaded by a user but open up in a
> new page as data.
how about using an in-browser renderer like jsc3d or three.js?
On Saturday, October 20, 2012 10:23:40 PM UTC-4, Triffid Hunter wrote:
> On Sun, Oct 21, 2012 at 7:03 AM, Andrew Mazzotta > <andrewm...@gmail.com <javascript:>> wrote: > > Would one of you be able to elaborate on how to have stls be viewable > like > > Thingiverse? The file can be successfully loaded by a user but open up > in a > > new page as data.
> how about using an in-browser renderer like jsc3d or three.js?