For all issues regarding the Forums use, please, refer to the Forum Rules.

Our Solutions

Need professional assistance?
Consider our:

Support Offerings


Need to speed up your development?
Have a look at our:

Samples & Tools


Need some functionality extending standard OCCT capabilities?
Check out our:

Adv. Components

Related pages

Quickest way to check if two shapes intersect?

EricThompson's picture

I need to determine if two TopoDS_Shapes intersect. I don't care about the topology of the intersection, I just need a yes or no answer.

I'm currently using BRepAlgoAPI_Common, but this is fairly slow because it is performing the entire boolean operation.

Does anyone know of a quicker way to get a simple yes/no?


Deepak Agrawal's picture

Did you figure it out? I am having some problems using BRepAlgoAPI_Common and BRepAlgoAPI_Section. I would be really grateful if you can help me out.

EricThompson's picture

Sorry, I never did. I ended up reworking what I was doing to avoid having to check that.

Pawel's picture


you can try the Voxel package.

I've been testing it (although not very intensively) for some weeks now. It looks very interesting although I have already spotted some problems. However, I think this is suitable for telling if two shapes intersect (with respect to the specified tolerance).


AP's picture

this might work:

bool isintersecting(TopoDS_Shape shape1,TopoDS_Shape shape2, double detail)
if (!(detail > 0)) detail = 0.1;

BRepExtrema_DistShapeShape dst (shap1, shape2,detail);
if (dst.IsDone())

gp_Pnt P1, P2;
for (int i = 1; i {
P1 = dst.PointOnShape1(i);
P2 = dst.PointOnShape2(i);
Standard_Real Dist = P1.Distance(P2);
if ( Dist {
return true;

return false;


This works as long as the shape only has one face in it, if there are more than one faces

bool isintersecting(TopoDS_Shape srf1,TopoDS_Shape srf2)

qDebug() srf1 = HSF::getfacefromshape(srf1);
srf2 = HSF::getfacefromshape(srf2);
Handle(Geom_Surface) S1 = BRep_Tool::Surface(TopoDS::Face(srf1));
Handle(Geom_Surface) S2 = BRep_Tool::Surface(TopoDS::Face(srf2));
//double precision = Precision::Confusion();
double precision = 0.1;
qDebug() GeomAPI_IntSS Intersector(S1, S2, precision);
qDebug() if (Intersector. NbLines() > 0) { return true; } else { return false;}


TopoDS_Shape getfacefromshape(TopoDS_Shape shape1)
TopoDS_Shape myshape;//=shape1 ;
TopExp_Explorer Ex;
for (Ex.Init(shape1,TopAbs_FACE); Ex.More(); Ex.Next())
myshape = Ex.Current();
return myshape;

James D.'s picture

I have the following problem. Read two IGES files. The problem is, that visual crash here:

BRepAlgoAPI_Common aCMP= BRepAlgoAPI_Common (myIGESShape1, myIGESShape2);
// here is the crash ...
TopoDS_Shape myIGES_Result= myIgesReader2.OneShape();

with simple models I have no problem. But when I have a cube an a cylinder it crash ...

James D.'s picture

I have the same problem with two cubes models. I atached this file ... what's te problem?

Forum supervisor's picture

Dear James,
The problem is that the common operation fails with
the specified arguments (no result):
==> not done ErrorStatus()=101
Your arguments are set of independent faces...

James D.'s picture

"Your arguments are set of independent faces..."

Ok I understand, but what can I do?

Second question: Is it possible to compare two objects with XDE?

James D.'s picture

??? Can you explain me what you mean?

Forum supervisor's picture

Dear James,
I mean that in spite you call your objects 'cubes'
no one of them is not a cube. It is just a set of separate
independent faces. To have a cube you should sew faces and
only after that apply boolean operations.

James D.'s picture

You mean face-modell and shell-modell (face and brep). Ok, I understand.

But I have a lot of obejcts without Error 101. The programm crashed (tb_alloc .... )

James D.'s picture

When I create a solid I get this message:

Unhandled exception at 0x779715de in ***.exe: 0x00000000:

StdFail_NotDone at memory location 0x0043f478..

Forum supervisor's picture

Dear James,
It means that you made a mistake.
First you should create a shell from the mentioned faces.
And only after that - create a solid.
If you feel some luck of knowledge in 3D modeling our training and e-learning courses are at your disposal -
In case of need you may contact us via the Contact Form

James D.'s picture

Yes, I create a face-model, join the faces and close surfaces ...

Unhandled exception at 0x779715de in ***.exe: Microsoft C++ exception: StdFail_NotDone at memory location 0x002afa58..

James D.'s picture

here are the to solids

Forum supervisor's picture

Dear James,
Your attachment has no solids.
It seems you don't have clear understanding what you are doing.
The best solution for you is some basic training.
Pay attention to my previous post.

James D.'s picture

create a part -> Join -> ... -> close surfaces -> Solid ???-

Forum supervisor's picture

Dear James,
I just can suggest you to read more carefully
chapter "5.Topology" of "Modeling Data User's Guide".
I do hope you will find all necessary information
at this guide.

James D.'s picture

I think the problem is that IGES supports only surfaces and STEP supports solids ...

James D.'s picture

I create two cylinder, no problem. I create this two objects -> Error

James D.'s picture

Here are another two files:

Contact us

Attention: DO NOT use this form for all kind of request for the removal of your personal data. Please follow this link for such cases.