View on GitHub

PyInventor

3D Graphics in Python with Open Inventor

Download this project as a .zip file Download this project as a tar.gz file

PyInventor provides a Python binding for the Open Inventor 3D graphics toolkit, which is an object oriented, high level programming layer for OpenGL. The Open Inventor toolkit is considerably easier to learn and use than OpenGL, hence the motto "3D programming for humans".

The main goals for the Python integration project are:

Get Started

With the help of PyInventor programmers can create rich, interactive 3D applications in the Python scripting language. Others may find the included scene graph viewer / editor application useful as it allows the creation of 3D objects and scenes without the requiring programming skills.

Programming with PyInventor

For an overview on how to create applications with PyInventor please visit the wiki where you can find a getting started guide and examples.

Preview

The documentation for all classes, functions and data used to interface with the Open Inventor toolkit is built into the library and therefore displayed in the help system of the IPython shell and most development environments. Furthermore the PyInventor class reference is available here.

For documentation on the 3D graphics toolkit itself please refer to the Coin documentation.

Scene Graph Editor

The included Scene Graph Editor application can render scene graph files (Inventor, VRML, 3D Studio, STL) and show their structure in a tree view. It furthermore allows adding, removing or rearranging nodes within the scene graph as well as editing of field values, immediately making those changes visible in the viewport.

To run the editor, simply type the following command:

python -m PyInventor [--console] [<scene graph file>]

With the --ipython option an interactive shell is opened at the bottom of the scene graph editor application. In this shell the scene can be analyzed or edited programmatically. The following variables are added to the shell environment:

Extension libraries that provide additional scene objects can be loaded by defining the IV_LIBS environment variable, which can contain dynamically loadable libraries separated by a semicolon. Those libraries need to define a function called initAllClasses() that register all scene objects in the global database.

Scene Graph Editor

Installation

The software can be compiled and installed from source with the included distutils setup script. Python 3.x, PyOpenGL, PySide, numpy and Open Inventor / Coin are required on the target system. The setup script is pre-configured for Coin on Windows and OS X. Adaptations to the following variables defined in setup.py might be necessary for other configurations.

# Open Inventor paths and libraries:
oivincpath = ''
oivlibpath = ''
oivlib = []

To compile and install PyInventor, call:

python setup.py install [--static]

macOS

For Mac systems I recommend installing Python 3.x and the required packages via MacPorts as it is straightforward and does not interfere with the Python 2.x installation that comes bundled with macOS. Please refer to the Installation page for detailed setup steps.

Windows (64 bit)

Alternatively to installing the module from source, there is also a binary installation package available for Windows. The prerequisites and of course PyInventor itself can be installed with the following downloadable packages:

License

PyInventor is distributed under the BSD 3-Clause License. For full terms see the included COPYING file.