How to know whether 2 solids have intersection?

Hello,

I want to check whether two solids have their intersection. I use BRepAlgoAPI_Common. My problem is the BRepAlgoAPI_Common always create a new object although my two solids actually have no intersection at all. Therefore I could not know if the intersection of two solids exists.

I tried IsDone(), IsNull() ... but receive nothing relating to what I need.

Is there any method to know the status?

Thanks.

---------------------------------------------- My code:

gp_Pnt origin1( 100, 100, 100 );
gp_Dir vZ1( 0, 0, 1 );
gp_Dir vX1( 1, 0, 0 );
gp_Ax2 axis1( origin1, vZ1, vX1 );
TopoDS_Solid box = BRepPrimAPI_MakeBox( axis1, 100, 100, 100 );

gp_Pnt center(0, 0, 0 );
gp_Ax2 axis3( center, gp_Dir( 0.7, 0.7, 0.7 ) );
TopoDS_Solid cyl = BRepPrimAPI_MakeCylinder( axis3, 50 , 100 );

BRepAlgoAPI_Common Common( box, cyl );
TopoDS_Shape Com = Common.Shape(); // always create new shape!

Robert Boehne's picture

You could find the volume of the new shape, if it is zero, then you have no overlap.