A couple of days after Ubuntu 10.04 was released, Oliver Borm contributed a package for pythonOCC-0.4 (see https://launchpad.net/~cae-team/+archive/ppa). Here is how to proceed to get it run in 5 steps and less than 10 minutes of your precious time.
The following results were obtained from a new installation of Ubuntu 10.04 from the original 32 bit CDROM, on a Virtual Box 3.1.6 machine.
Step 1 : set a new package source.
Insert the following line in the source field:
deb http://ppa.launchpad.net/cae-team/ppa/ubuntu lucid main
Step 2 : search/install the python-occ package
From the Synaptic Package Manager utility, search for the python-occ package :
Mark python-occ for installation :
Wait for the download to be completed :
Step 3 : set the CSF_GraphicShr env variable
The CSF_GraphicShr variable must point to /usr/lib/libTKOpenGl-6.3.0.so :
Step 4 : install a GUI manager
You can choose PyQt4 or wxPython. I rather user PyQt4 :
Step 5 : run the HelloWorld example
You’re ready to run the following example (that creates/displays a box) :
from OCC.BRepPrimAPI import *
display, start_display, add_menu, add_function_to_menu = init_display()
my_box = BRepPrimAPI_MakeBox(10.,20.,30.).Shape()