Ubuntu – How to render 3D models as SVG vector graphics? (planar projection)


enter image description here

This image (original SVG from Wikipedia, public domain) was created using the following procedure:

  1. Create a 3D model in Google sketchup
  2. Export as PDF
  3. Import in Inkscape
  4. Save as SVG

Is there a straightforward way to produce such a SVG with software that runs (natively) on Ubuntu? (Pantograph, a Blender plugin, has only broken download links; VRM, another Blender plugin works with Belnder 2.4x, but not with Blender 2.6x.)

Best Answer

You have two options:

Option 1

The first requires a recent builds of Blender (available from Graphicall), which can now use the Freestyle rendering engine

Freestyle is a software for Non-Photorealistic Line Drawing rendering from 3D scenes.

Within Freestyle there exists a plugin, SVGWriter, that can write Blender scenes to SVGs. Instructions for usage are available on that page. Below is an example of its output:

Original Blender render: enter image description here

Freestyle SVG output: enter image description here

Freestyle is still in development and you can follow its progress on their blog.

The still image SVG writer in SVGWriter currently only renders one image i.e. you can't render each frame to an SVG. I've rewritten the script to do this, and the author has informed me that my modification will be integrated into the main download in a future update. Here is the modification

Option 2

The second option only allows you to render bezier curves. First, you must install svgwrite for Python 3. You can do this by going into the folder and running

sudo python3 setup.py install

You may need to copy the svgwrite folder into .blender/version_number/python/lib/python3.2/

You then need to download SVGwriter for Blender. Install Git and then run

git clone git://gitorious.org/blender-2-6-svg-export/blender-2-6-svg-export.git

Inside the downloaded folder you will need to copy the Python scripts (those ending in .py) and overwrite the ones located either in ./blender/[version_number]/scripts/addons/io_curve_svg/ or in /usr/lib/blender/scripts/addons/io_curve_svg/ .

Finally, in Blender, draw your bezier curve and then go to File > Export > SVG. Here's an example of the output

Original Blender curve enter image description here

SVG output. The line thickness was increased for clarity enter image description here

Related Question