Open CASCADE, the 3D modelling kernel
3D modeling & numerical simulation

Search the Forums
See All Topics
 

Boolean operation hang on OCC 6.5.3

Boolean operation hang on OCC 6.5.3
Jayesh Salvi 2012/09/03 07:29
I am trying to evaluate OCC for performing complex boolean operations. I've put together following simple cpp program that demonstrates a possible bug in OCC which leads to perpetual hang with 90% CPU usage by the process.

The program attached is single cpp file, with compilation instructions. Just replace $OCC_INSTALL_DIR by the path in which you have OCC 6.5.3 (or any older version) installed. On successful build and run, it will generate an STL at /tmp/0.stl. If you change the value of TOTAL to be greater than 10, you may see the perpetual hang I am talking about. I can get this program to work for all values of TOTAL < 10 and it hangs for any value >10 that I've tried.

I've compiled and run this program on older versions of OCC (6.5.0, 6.3.0) and I see failures of different kind. Sometimes I get Standard_ConstructionError and other times it hangs as described above. Strangely enough when I run an equivalent program written on top of PythonOCC (which I believe uses same 6.3.0 libraries I used with native program), it runs successfully.

You can also see the code at the link https://gist.github.com/3606545

Thanks.
You have to be logged in to download the attached file
Forum supervisor 2012/09/03 10:57
Dear Jayesh Salvi,
I would like to inform you that the reported issue was checked.
The problem is not in Boolean operations, but rather in your code.
Which value of the 'step' do you expect if TOTAL > 10 ?
float step = 10/TOTAL;
I guess it will be => 0;
I suggest you to use:
float step = 10.0/TOTAL;

Regards
Jayesh Salvi 2012/09/03 15:07
Thanks for pointing that out. After making the change it doesn't hang any more.

I am surprised however that I didn't get an exception or a crash, because I was effectively passing r=0 to MakeCylinder. Instead the library went on executing infinitely.
Forum supervisor 2012/09/03 16:52
On Windows platform it leads to crash.
In any case before using Boolean it is better to check
arguments for validity. It will allow you to avoid unexpected behavior
in the future.
Regards
 
 
Latest news
  • Open CASCADE Technology 6.8.0 is available for download!
  • New features to enhance the development process
  • Open CASCADE Technology 6.7.1 is available for download!

  • © OPEN CASCADE 2000 - 2014  |  Search  |  Contacts   |  Site map