Featured post

new redirect for blender.org bpy docs.

http://www.blender.org/api/blender_python_api_current/ As of 10/11 november 2015 we can now link to the current api docs and not be worr...

June 29, 2012

Render Object as SVG

The first step towards a greater goal is always a small one. A While back I needed a way to represent xyz differences between two points, this resulted in a basic GL-calliper, but it died in the water for various reasons. One reason being unable to figure out how to render bgl as a renderlayer.

Coming from an AutoCAD background I do miss being able to dimension stuff for printing. Macouno intends to write an updated and enhanced version of his 2.49 Calliper, you can find his project page here. Macouno and I have different opinions about what is necessary to make a good dimensioning system, he chooses to generate 3d geometry for each dimensioning-item. My approach will build no new geometry but make a flat svg overlay based on the list of dimensions (angle/length etc) that the user wants to represent.

Gotta start somewhere

run bvp_to_svg.py from the viewport with an object selected. It will generate an svg in your home folder.
Not too much code involved, upon reflection it's probably good to keep things modular (instead of enveloping the svg-write and bpy-read-geometry concepts in one function). Right now I am starting to see flashes of program architecture, but it's too early to formalize it.

My real intent is not to write an svg renderer, but being able to suck down geometry and turn it into 2d space svg paths will be a vital component of the dimensioning system. Less talk more work.

No comments:

Post a Comment

Please use Blender.StackExchange.com for python scripting questions unrelated to this post.