Equality of TopoDS_Face

I have two TopoDS_Shapes, the second is created through a cut operation with the first shape as the cutter. I want to create a user AIS_Shape which colours the faces created by the cut operation.

So far I have used a topo explorer to iterate the FACES of the first and second shapes, which I now need to compare, however the IsEqual() method always returns false. I have also tried computing the HashCode(10000) for each of the faces which also is never the same.

--I am testing with MakeBox(x,y,z) so three faces should be the same.

I presume that the cut operation is creating new topology for its shape and hence the comparator is returning false. If so, is there a way to find if two TopoDS_Faces (created independantly) are the same in terms of geometry, location and orientation?

Many thanks,

David Bramall

kim wj's picture

Refer to the OCC documentation.

IsPartner() -> Same TShape IsSame() -> Same TShape and TopLoc_Location IsEqual() -> Same TShape, TopLoc_Location and


But, if you(or the cutter) made two faces from different geom_surfaces, any of them would not return 'true'.

If you want to know whether two faces have same geom_surface, try this.

Handle_GeomSurface s1=BRep_Tool::Surface(f1,l1); Handle_GeomSurface s2=BRep_Tool::Surface(f2,l2);

if(s1==s2){//same Geom_Surface

} else{


Sharad Verma's picture


Did you find any solution for comparing two shapes, because comparison at Geometry level is also not working.

Sharad Verma

Rodrigo Castro Andrade's picture


Sorry to bump an old post, but has anyone found a viable solution for this? I also tested BOPTools_AlgoTools::CheckSameGeom() and it is also not working.


Rodrigo Castro Andrade's picture

As a final update on this isse, BOPTools_AlgoTools::CheckSameGeom() works! It was failing before because I performed rotations on the model that held one of the faces for comparison... So because the faces were not occupying the same place the check would obviously fail.

Thanks again!