Shapely as a Python module for Blender

Shapely in Blender

Shapely is a Python module that builds on top of libgeos, an open source library for 2D geometry operations. We will use Shapely to learn Python in a visual and playful way. Shapely, developed and maintained by Sean Gillies, has been modified by Lukas Treyer to run as a Python module in Blender. It comes with the necessary DLL’s/Dylibs/.so-files, that’s why you have to install platform specific versions:

Shapely OSX 64bit 
Shapely Win7 64bit ( Visual Studio 2012 C++ Redistributable require)
Shapely_Linux (manual libgeos installation required)

libgeos sources (LGPL Licence)

INSTALLATION: Unzip and move your downloaded folder to
OSX: /Users/(username)/Library/Application Support/Blender/2.68/scripts/modules
Win/Unix: (your Blender Application folder)/2.68/scripts/modules
or on Windows something similar like:
/Users/(username)/AppData/Roaming/Blender Foundation/Blender/2.68/scripts/modules/ IN "Blender/2.68/" create "scripts/modules" as necessary.

The .blend-file that corresponds with the shown screenshot above can be downloaded here.

EDIT: in order to use Blender’s intellisense capabilities with this version of shapely, you have to replace a python script in the Blender application folder:
replace “Blender Application Folder”/2.68/python/lib/python3.3/rlcompleter.py with this rlcompleter.py

EDIT II: we wrote a helper script that takes care of converting shapely geometry to blender geometry: blender_show.py

Also refer to the fabulous Shapely manual for more information.

Shapely’s feature gallery (links to the manual):

unified buffered pointsgeometry collection as a result of a intersection operationsymmetrical differencedifferencebuffersimplificationskewunion
parallel offsetparallel offset mitre

One Response to Shapely as a Python module for Blender

  1. Pingback: iA – Chair of Information Architecture » Blog Archive » Introduction to Python Programming