Simple Wavefront obj to STL converter.

Discussion in 'Software and Applications' started by cyborg_ar, Jan 13, 2011.

  1. cyborg_ar
    cyborg_ar New Member
    I have had some bad problems with blender's STL exporter so i wrote my own script. My solution is a bit kludgy, i didn't write a "real" exporter, because i really cant be assed to study the necessary python api in blender yet (besides it's always changing), but i wrote a standalone script that takes a Wavefront .obj file and outputs a binary STL, since the .obj exporter works WONDERFULLY, and both formats are dead simple to read and write the script was fairly short. That also means that it's useful for other software which can export .obj too.

    As an extra i added a feature to let you specify the scale in the STL conversion. So for example you can model your stuff in centimeters and put a scaling factor of 10 to output a STL in Milimeters that Shapeways will accept. The script also automatically skips degenerated faces (points and segments) and triangulates the mesh using a pretty naïve triangle-fan triangulation, so don't use it if you have grossly deformed/non-planar quads or n-gons that are not completely convex.

    Well enough babbling, here's the code (attached) As the header says, you're free to do whatever you want with it.

    Attached Files: