I have been having problems with BRepAlgoAPI_Cut when I have two solids that have overlapping faces and where one solid is not entirely inside the other. Think of a small cube and a large cube that share one corner. OpenCascade constantly crashed when trying to cut these.
In the end I have tracked it down to a failure in the Angle2D method of BOP_WireSplitter. At the end of this function it creates a gp_Dir2d instance and then crashes when it calls the Angle function. The last two lines are
It appears that in my case both the X and Y value of aDir2D are 0. I haven't had time to work out why but I discovered that if I check for this and just return 0 all works well.
if(aV2D.X()==0 && aV2D.Y()==0)
Now I don't know if this is correct, I am not good enough at OpenCascade, but it does work. I would appreciate any comments or if you are more knowledgable and know of another way to fix this properly I would be very greatful. I also have found a problem with cutting using semi-infinite solids which I still looking at. Essentially the wire and face exploration parts of BRepAlgoAPI_Cut don't like to find that the top face is in infinity...any ideas?