Install/Run pythonOCC on Ubuntu 10.04 (Lucid) LTS in 5 steps and 10 minutes

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

Add software sources

Step 2 : search/install the python-occ package

From the Synaptic Package Manager utility, search for the python-occ package :

Search the pythonocc package

Mark python-occ for installation :

Mark all dependencies for installation

Wait for the download to be completed :

Required packages are downloaded

Step 3 : set the CSF_GraphicShr env variable

The CSF_GraphicShr variable must point to /usr/lib/libTKOpenGl-6.3.0.so :

Set up the required environment variables

Step 4 : install a GUI manager

You can choose PyQt4 or wxPython. I rather user PyQt4 :

Choose a GUI manager (PyQt or wxPython)

Step 5 : run the HelloWorld example

You’re ready to run the following example (that creates/displays a box) :

from OCC.Display.SimpleGui import *
from OCC.BRepPrimAPI import *
display, start_display, add_menu, add_function_to_menu = init_display()
my_box = BRepPrimAPI_MakeBox(10.,20.,30.).Shape()
display.DisplayShape(my_box)
start_display()
Run the HelloWorld sample to check the installation
If you can see the yellow box and can handle it with your mouse, you’re done. Just enjoy!