The upcoming pythonOCC-0.5 release will provide an environment dedicated to rigid body simulation. The ODE dynamic engine (http://www.ode.org) is being embedded in a DYN package. It will be possible to use these features and benefit at the same time from the paramteric modeling framework, meshing, topology and all Level2 subpackages. Here are two screencast showing the status of this project.
The OpenCASCADE library is built upon X11. It doesn’t use Cocoa/Carbon. In order to be able to use the 3D viewer of pythonOCC with PyQt, you must first install Qt4-x11 and then PyQt4.7.
First, from the finkproject, download/install the qt4-x11 package. You can use finkcommander, a graphical frontend to fink, to manage your fink packages. Select the package named ‘qt4-X11′, install from source, and just be patient. When the build is achieved, your fink commander window should look like that:
The Qt4.5.2 libraries have been installed to /sw/lib/qt4-X11. Add the following line to your .bash_profile:
Just extract the content of this file to /Library/Python/2.6/site-packages and you should get done. Test the installation (no linkage errors):
Python 2.6.1 (r261:67515, Jul 7 2009, 23:51:51)
[GCC 4.2.1 (Apple Inc. build 5646)] on darwin
Type “help”, “copyright”, “credits” or “license” for more information.
>>> from PyQt4.QtCore import *
>>> from PyQt4.QtGui import *
>>>
You can run one of the pythonOCC samples. The PyQt4 package should be automatically detected. For instance, running the Geometry.py sample (/samples/Level1/Geometry) :
Then, from a python console, just check the installation is ok (i.e. no linkage errors):
Python 2.6.1 (r261:67515, Jul 7 2009, 23:51:51)
[GCC 4.2.1 (Apple Inc. build 5646)] on darwin
Type “help”, “copyright”, “credits” or “license” for more information.
>>> from OCC.Standard import *
>>>
Under MacOSX, unless you properly installed PyQt4-X11, you’ll need the python-xlib (0.15rc1 or higher) package in order to use the 3D viewer. You can now run the samples.
pythonOCC 0.4 was released today. Here are the main changes since the 0.3 release:
pythonOCC 0.4 comes with new advanced meshing features coming from the smesh project,
many new samples,
the OCC wrapper was improved (few missing modules were added, typical C++ mechanisms were pythonized),
64 bits support for Windows/Mac,Linux
New graphical backends: PyQt and python-xlib
MacOSX Snow Leopard support,
better installation script
many minor fixes/enhancements in the Parametric Application Framework and Display packages
pythonOCC-0.4 was successfully built/tested on Windows platforms (XP/Seven with py2.5/2.6), Linux (Ubuntu 9.10, OpenSuse) as well as MacOSX (SnowLeopard).
Recently I’ve been so fortunate to have an exposition at design gallery Vivid in Rotterdam. The exposition was an overview of the work of EZCT Architecture & Design Research, of which I’m one of the founding partners. An interesting aspect of the design is that its been implemtend with pythonOCC! It really is wonderful to see the hard work poored into the project have physical consequences. Thomas came from Paris (just moved from Paris -> Rotterdam to start working on my PhD at the Hyperbody research group ) to come and see the results for himself. The work on the design instigated the development of a high-level, pythonic module. Take for example and Edge or a Wire. Rather than grinding through heaps of documentation, you’d expect an API that succintly presents you the functionality in an orderly, well documentated fashion. Well, that’s what I’m working on. In pythonOCC we’ll start to refer to the Level1 API ( OCC wrapper ) and the Level2 API ( the pythonic API I’m talking about ).
Its coming along nicely we’ve targeted public release for the Level2 API for pythonOCC 0.5, which we expect to release in March ( 0.4 will follow in short notice ). Surely we’d appreciate your involvement though! Have a look at what’s here, if you’ve checked pythonOCC out from svn, you’ll find it in src/addons/KBE/Level2API.py
The new release (0.4) of pythonOCC comes with the Parametric Application Framework (known as PAF) as well as a meshing suite (SMESH). Here is a small demo that shows how to use both these tools to achieve a parametric mesh.
On the screencast below, a simple box is drilled with a hole of diameter 10mm. The box is parametrized with its with, height, depth, and the whole with two parameters: R1 (the radius) and Angle1 (the angle of the revolution, by default set to 0). In the PAF, each time a parameter is modified, the geometry is re-computed and displayed. It’s also possible to register customized callbacks: they are called each time a paramater is updated. In the following demo, we just added a ‘Mesh’ callback: whenever the parameter R1 or Angle1 is modified, the mesh is re-computed and displayed (using the MEFISTO2 mesher).
The source code of this sample can be found in the samples/Level2/PAF directory.
OCAF is the OpenCascade Application Framework. At it’s core, it provides the functionality to manage structured documents. The framework defines a document model but it’s up to the application to define the specific document structure (in the same way that xml defines a file format, but an application defines a specific xml schema). OCAF documents can be loaded from or saved to disk using a native format, or import/exported from a number of other formats.
Using OCAF you can:
Manage multiple documents and visualise document contents
store BRep Shapes, including their evolution (version control for Shapes), for undo/redo for example
define other metadata based on either existing standard types, or custom-defined types
import / export support for STEP and IGES, including layers, colours, materials and tolerances
define functions for reconstruction of parametric models
Basic OCAF Strucuture
OCAF documents are based on a hierarchy of labels (TDF.TDF_Label objects). At any one level in the tree, labels are identified by an index number. The series of index numbers from the root of the tree to a given label uniquely defines that label. The fully qualified label entry is writen as a colon-separated list of these integers e.g.
root label (0:)
label A (0:1)
label D (0:1:1)
label E (0:1:2)
label B (0:2)
label C (0:3)
label F (0:3:1)
Basic OCAF Use
Each OCAF app requires a single Application object.
Creating a new OCAF document
How is OCAF implemented in pythonOCC?
A recent developement of pythonOCC is the PAF framework, which implements Associativity, Parameters, Rules and Relations in a pythonic manner.