Need of short C++ OpenCascade example

Dear All
It is very sad as well as unfortunate that there is hardly help for newcomers to OpenCascade.
I tried various places to learn OpenCascade but could not start due to lack of atleast one simple short example that can be properly compiled to see OpenCascade working with C++.

Can any of you provide short full example with all the header files and libraries needed so that atleast I can start programming in Opencascade?
Any example like showing line/sphere/box with help of OpenCascade will be helpful.

Please don't guide me to see the bundled examples with OpenCascade. I don't think it really helped as it has too many files attached to one working example.

Waiting for positive reply.

-Ravi

Manfred Griesinger's picture

Hallo Ravi,
which development system do you use (Linux or windows, visual studio, Qt, MFC )? Some weeks ago I started with OpenCascade too and I had exactly the same problems. I am working with Ubuntu 12.04, Qt, and OpenCascade 6.5.0 and in the meantime after long try and error I suceeded to build the example given in

http://myweb.tiscali.co.uk/dolbey/QtOpenCascade/QtOCC-0.11.zip

Using this example as a base, I reduced the code to two classes with about 50 lines of code and I think, that this is the minimum code to get an image on the screen. If you think that this can help you, please let me know.

manfred

raviarya's picture

Thanks Manfred Griesinger
I want to run OpenCascade in Linux and I am using Ubuntu currently.
Can you please share your whole reduced code? It will be really helpful because I could not get any code in Linux.

For windows, I used the code given at (thanks to Eryar)
http://www.cppblog.com/eryar/archive/2013/08/18/202617.html

There is also some other useful information on this blog.

Shing Liu's picture

You are welcome!

Shing Liu's picture

I put the simple occQt example to github:
https://github.com/eryar/occQt/

Update the code to use Qt5.4 and OpenCASCADE6.8.0.

Manfred Griesinger's picture

Hello Ravi,

here is my code, it is the complete qt project. The 3rd party files for gl2ps are added to resolve a symbol required by a open cascade lib.
I do not know, if all the libs I added are really necessary, a next step in my work will show this.
The directory for the open cascade includes is usr/include/opencascade
and the libraries are installen in the default directory usr/lib.

Try to bild it and let me know, if it works,

manfred

raviarya's picture

Thanks Manfred Griesinger
I will try to run it and get back to you.

raviarya's picture

Dear Manfred Griesinger and Eryar
I used Ubuntu(Raring) to compile this code and with help of you both it compiled. Thanks a ton. :)

For future users:
I also updated the OpenCascade by using following PPA (this has Open CASCADE Community Edition) as I could not find OpenCascade 6.6.0 on any PPA and did not want to compile OpenCascade.
deb http://ppa.launchpad.net/jrheinlaender/ppa/ubuntu raring main

I had to replace PI with M_PI within bottle.cpp to make Manfred's code to work. I think if you use OpenCascade, you might not have to change it (not sure).

I think from this Manfred's minimal code and Eryar's code, users can expand their knowledge of OpenCascade.

Thanks a lot again !!!!

thomas's picture

I can confirm that this example also works on Debian with only one change needed: I had to add the following line to OCCtut.pro:

INCLUDEPATH += /usr/include/oce

Thanks very much for posting this - I have also been struggling to construct a simple app based on Qt Creator in Debian.

Thomas

Forum supervisor's picture

Dear Manfred,
I would like to pay your attention to the fact that Open CASCADE 6.6.0 is available
starting from April of 2013. The latest version is more robust, more stable and includes over 250 new features, improvements and bug fixes over maintenance release 6.5.5 (see for details OCCT6.6.0 Release Notes). Therefore I suggest you to use OCCT6.6.0 if you certainly don't have serious objections.

Best regards

Manfred Griesinger's picture

Hello supervisor,

thank you very much for your hint. Of course I am iterested to use the newest version, I installed open cascade with the ubuntu software center and here I got 6.5.0. I have great experience in programming, but I am very new to linux, so I am not very familiar with building and instaling program packages.I think I will learn more about this in the next time so that this will change.

Best regards

manfred

Christian Carestia's picture

Hi everyone,

I am having a similar problem as well.

I am looking for a simple c++ script which allows to input a step file and export shell/faces as output.

Can someone provide an example of it?thank you very much!

Christian

Forum supervisor's picture

Dear Christian,

I can propose you to check OCCT ImportExport sample and Draw commands to deal with STEP files.
See the $(CASROOT)/\opencascade-6.9.1/samples/qt/IESample folder.
Use also OCCT html documentation located at $(CASROOT)/opencascade-6.9.1\doc/overview folder.

Best regards

FSR
 

Jacek's picture

Dear All,

I've went thought the same problems, but managed to overcome the difficulties (also with help of the above posts). I attache my simple portable code (Windows/Linux), which presents import/export capabilities. Pure import/export capabilities don't depend on any third party libraries, if Open Cascade visualization capabilities aren't used even the mandatory Tcl/Tk and Freetype libraries aren't needed. The code is based on one of the Open Cascade examples, which was stripped from Qt and greatly simplified. The code was compiled with Open Cascade 7.4.0 version with gcc on Linux and mingw64 using MSYS2 on Windows. Open Cascade static libraries are linked (with the flags in the Makefile static libraries order problem was solved: -Wl, --start-group ... libararies ... -Wl,--end-group), resulting in single executable.

Hope this will help to understand and start using Open Cascade.

Best regards

Attachments: