Basically (for now), I'm interested in visualizing an object whose CAD data are in an existing STP file. I found an example which supposed to work with STP files at http://www.opencascade.org/org/forum/thread_14041/. I tried, and it compiled and linked succesfully:
g++ -I/usr/include/opencascade -DHAVE_CONFIG_H -DHAVE_IOSTREAM -DHAVE_FSTREAM -DMAVE_LIMITS_H -lTKTopAlgo -lTKPrim -lTKFillet -lTKBO -lTKOffset -lTKSTEP -lTKXSBase main.cxx -o exe
main.cxx: In function 'int main()':
main.cxx:18: warning: deprecated conversion from string constant to 'char*'
But when I tried to launch the executable file, it didn't show anything. Am I missing something?
Thank you for your time,
--
Matteo
Arthur Magill
2009/10/18 21:14
Hi Matteo,
Not an expert here, but I think I can point you in the right direction :-)
The example in the thread you linked only tests the reader - it doesn't try to display anything. If no error message appears, you have successfully compiled an OCC program that can read your STP file - so, progress of sorts!
Two ideas to get you started come to mind. You could have a look at the tutorial example shipped with OCC (the one that builds and displays a bottle). You could probably combine your basic STP reader with that fairly easily.
Alternatively, have a look at PythonOCC (www.pythonocc.org). It's a set of Python wrappers around OCC. There are quite a few examples provided and the support, via the email list, is *very* good (thanks Thomas & Jelle). I can't remember, but there may already be a STP read/display example in there.
Good luck and let us know if you get it working,
Arthur
Matteo
2009/10/18 23:31
Hi Arthur,
thank you for your suggestions.
Actually, looking at the MakeBottle tutorial is the first thing I tried to do, but, unfortunately, the "opencascade-examples" package provided by my distrib does not ship any of the tutorials that can be found in the source version of OCC.
At light of this fact, I removed Ubuntu's OCC packages from my PC and installed OCC sources with the usual combination
However, I'm still not able to run any of the demonstrations in the OpenCASCADE6.3.0/samples directory. As an example, when I try to execute the script run.sh to compile the code in OpenCASCADE6.3.0/samples/tutorial/src, I get the following error:
matt@isaac:/usr/src/OpenCASCADE6.3.0/samples/tutorial$ export CASROOT=/usr/src/OpenCASCADE6.3.0/ros/
matt@isaac:/usr/src/OpenCASCADE6.3.0/samples/tutorial$ sh run.sh
Executable "/usr/src/OpenCASCADE6.3.0/samples/tutorial/Linux/bin/Tutorial" not found.
Probably you don't compile the application. Execute "make".
What does it means? There is no "Makefile" in the OpenCASCADE6.3.0/samples/tutorial directory. Ideed, if try to type "make", I get:
matt@isaac:/usr/src/OpenCASCADE6.3.0/samples/tutorial$ make
make: *** No targets specified and no makefile found. Stop.
Where should I execute "make" then?
I get the same error also with the QT demo in OpenCASCADE6.3.0/samples/standard/qt. Maybe I skipped some critical step during the installation process?
Thank you for your time.
--
Matteo
Arthur Magill
2009/10/19 01:52
Hi Matteo,
The tutorial is QT based - you should see a file called Turorial.pro in the tutorial directory. Make sure you have the qt-devel libs installed, then run "qmake Tutorial.pro". That will generate a Makefile. You can then run make as-per-normal. Check inside the Linux/bin directory, where you should find Tutorial. The run it, use the run.sh script (it sets some env vars I think).
Good luck!
Arthur
Matteo
2009/10/19 12:11
Hello Arthur,
I'm new both in OCC and in QT-based GUI, so I didn't know that I should have run the qmake command on Tutorial.pro. Thank you!
I installed a lot of qt4* packages, and the following dev libraries:
- libqt4-dev
- libqt4-opengl-dev
and finally, after a make failure complaining of not finding the command /bin/lrelease (I fixed it with a symlink to /usr/bin/lrelease), I've been able to create the executable file for the tutorial.
However, when I launch it, I get an empty GUI with a lot of buttons (MNU_FILE, MNU_VIEW, MNU_HELP, MNU_NEW and MNU_ABOUT). I tried to click on MNU_NEW button to see if I would be able to visualize something, but the whole application crashed and the following message appeared on the shell:
matt@isaac:/usr/src/OpenCASCADE6.3.0/samples/tutorial$ ./Linux/bin/Tutorial
terminate called after throwing an instance of 'Aspect_GraphicDeviceDefinitionError'
Aborted
The same issue occurred also with the IESample demo in OpenCASCADE6.3.0/samples/standard/qt. Any ideas?
Thank you for your valuable advices!
--
Matteo
Matteo
2009/10/19 12:22
Ok, sorry.
Just a quick update. I forgot to run "run.sh" after the make command. I didn't specified the QTDIR and this is the reason for which I got the complain of not finding the command /bin/lrelease.
I exported QTDIR to /usr/share/qt4/ and now I get a nice --still empty-- GUI where buttons have labels. However, clicking on the "New" button to try to visualize something still leads to a crash of the whole application:
matt@isaac:/usr/src/OpenCASCADE6.3.0/samples/tutorial$ sh run.sh
terminate called after throwing an instance of 'Aspect_GraphicDeviceDefinitionError'
Aborted
Thank you!
--
Matteo
Arthur Magill
2009/10/19 12:44
You're close now. Have you set CASROOT? Did you set various env vars, by running
$ source $CASROOT/env_DRAW.sh
? (if you don't have ksh installed, just change the first line to #!/bin/bash instead). You may have to edit this file, and run.sh, to find a sensible QTDIR (mine is /usr under Debian), TCL, etc. You sound like you know how to figure these out :-)
Matteo
2009/10/19 20:10
Hello Arthur,
your sentence "my QTDIR is /usr" made me rethink the whole setting I chose for the environment variables. So, I changed them to
CASROOT=/usr/local
QTDIR=/usr
TCLHOME=/usr
launched run.sh and it did work! The demos are really impressive.
Thank you for your help.
--
Matteo
Arthur Magill
2009/10/20 08:42
Excellent, glad it's working. Now you just have to write your STP reader ;-)
Arthur
Bryan Bishop
2009/10/19 13:37
By the way, there are packages available for OCC 6.3.1 (you said you're using 6.2.7?). Try this:
Hope this helps. They seem to have debug output turned on though, so be mindful of that. They probably have to be recompiled if you want them to be quiet.