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:
- Offer a flexible yet easy to use "Python-like" interface to Open Inventor
- Facilitate the creation, modification and viewing of scene graphs
- Platform independent and compatible with major 3D libraries (Coin, MeVisLab (SGI) and ThermoFisher Scientific)
- Extensible with new scene objects without introducing compile time dependencies
- Provide tools for 3D graphics programming such as a scene graph editor
- Works with Python 3
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.
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.
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:
- iv: Interface module to access Inventor functions
- root: Root node of currently loaded scene graph
- view: Instance of SceneManager driving the render viewport
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.
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]
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.
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: