tpaviot/pythonocc — Issue #19: Changing paths in OCE 0.6.0 > consequences for PythonOCC?
Author: stefkeB
Created: 2011-10-11 08:57:13+00:00
State: open

I am a (rather passive) follower of the OCE and PythonOCC projects. Yesterday I updated to OCE 0.6.0 and tried to compile PythonOCC from the git sources (after reading that it was dead easy). I'm using OSX 10.6.8 (aka Snow Leopard). It seems that the OCE folder structure has changed quite a bit over OCE 0.5 and that it isn't reflected in PythonOCC in several places.

# OCE and CASROOT

$CASROOT now points to a share subfolder inside the OCE installation: CASROOT=/Library/OCE/0.6.0/share/oce-0.6.0
Libraries are spread in the /Library/OCE/0.6.0/lib folder and in a subfolder /Library/OCE/0.6.0/lib/oce-0.6.0. So when giving one single lib folder, which one to point to?

Include files are in an "include/oce" folder, rather than in "inc".
Yet in some of the scripts the default looks at $CASROOT/lib and $CASROOT/inc which are both wrong.

# dependencies

Had to install FTGL seperately, as the OCE dylibs depend on it. Luckily, this was without problems, straight from SourceForge.

# GEOM

I had to comment a few lines in CMakeFiles.txt to not pick up the wrong paths
#FIND_PATH(OCC_INCLUDE_PATH Standard_Real.hxx $ENV{CASROOT}/inc)
#SET(OCC_LIB_PATH "$ENV{CASROOT}/lib")
#FIND_LIBRARY(OCC_LIB_PATH TKernel PATHS $ENV{CASROOT}/lib)
#MESSAGE(${OCC_LIB_PATH})

Only then I was able to compile GEOM in the contrib folder (cmake - make - make install):
cmake -DOCC_INCLUDE_PATH=/Library/OCE/0.6.0/include/oce -DOCC_LIB_PATH=/Library/OCE/0.6.0/lib ..

# PythonOCC

Had to add all paths to the setup call:
python setup.py build --disable-SMESH --with-occ-include=/Library/OCE/0.6.0/include/oce --with-occ-lib=/Library/OCE/0.6.0/lib --with-geom-lib=/usr/local/lib/GEOM-5.1.5.9

# GUI backend

So far, PythonOCC is fully compiled, but the backend GUI is troublesome on OSX and, alas, all PythonOCC samples use the GUI (apart from the unittests that work fine without).

* wx > I have give up on that one (after several comments from Jelle that it is broken severely).
* Qt4 > I recently worked on some Qt4 examples but in the mac-version. OCC needs the x11 version. It is not so easy to have both on the same machine... If I rename the PyQt4 folder there is "no backend" to be found.
* XLib > I installed this library but get the same error as with Qt4... (keyerror _V3d)

I was under the impression from the sources that there is also NIS support (Cocoa?) but don't know how to ask for that backend, it at all possible.

Traceback (most recent call last):
File "/Users/stefan/Downloads/DEV/OpenCASCADE/PythonOCC/git/pythonocc/src/examples/Level1/HelloWorld/helloworld.py", line 21, in
display, start_display, add_menu, add_function_to_menu = init_display()
File "/Library/Python/2.6/site-packages/OCC/Display/SimpleGui.py", line 134, in init_display
from qtDisplay import qtViewer3d
File "/Library/Python/2.6/site-packages/OCC/Display/qtDisplay.py", line 24, in
import OCCViewer
File "/Library/Python/2.6/site-packages/OCC/Display/OCCViewer.py", line 75, in
set_CSF_GraphicShr()
File "/Library/Python/2.6/site-packages/OCC/Display/OCCViewer.py", line 51, in set_CSF_GraphicShr
v3d_module_library = sys.modules['_V3d'].__file__
KeyError: '_V3d'

In the native Python shell, I can call "from OCC import *", but nothing that uses a GUI.