Problem with TopExp_Explorer

Hi all,

I am trying to find all the faces in my imported shape "sh" using the following code snippet:

TopExp_Explorer Ex;
for (Ex.Init(sh,TopAbs_FACE); Ex.More(); Ex.Next()) {

I get the following error message:
"error C2065: 'ProcessFace' : undeclared identifier
Error executing cl.exe"

I have included the following headers in my program:
#include "IGESControl_Reader.hxx"
#include "TColStd_HSequenceOfTransient.hxx"
#include "TopoDS_Shape.hxx"
#include "Bnd_Box.hxx"
#include "BRepBndLib.hxx"
#include "BRepTools.hxx"
#include "Geom_Surface.hxx"
#include "BRep_Tool.hxx"
#include "gp_Pnt.hxx"
#include "Geom_Plane.hxx"
#include "TopoDS_Face.hxx"
#include "TopExp_Explorer.hxx"
#include "TopAbs.hxx"
#include "TopoDS.hxx"
#include "TopExp.hxx"
#include "Standard.hxx"
#include "HLRTopoBRep_OutLiner.hxx"

Is this error because I am missing some header(s)? What could be the problem?

Thanks !

slips's picture

Hi, ProcessFace is a function that symbols any processing. It is up to you to implement this.
Ex.Current() gives the face to you. With

TopoDS_Face face = TopoDS::Face(Ex.Current());
you get the face and then you can process it.


Karthik Viswanathan's picture

Hi Steffen,

Thanks for your reply.

I need to figure out which faces in my solid have multiple wires and extract the dimensions of all but the outermost edges in each of those faces. Could you please tell me how I could do his?

Thanks !!

CloneX's picture

Try something like this:

// get all faces in the solid
TopTools_IndexedMapOfShape faces;
TopExp::MapShapes(sh, TopAbs_FACE, faces);

// for each face
for(int i=1; i<=faces.Extent(); ++i)
TopoDS_Face face=TopoDS::Face(faces.FindKey(i));

// get all wires in the face and outerwire
TopTools_IndexedMapOfShape wires;
TopExp::MapShapes(face, TopAbs_WIRE, wires);
TopoDS_Wire outerWire=BRepTools::OuterWire(face);

// for each wire in face
for(int j=1; j<=wires.Extent(); ++j)
TopoDS_Wire wire=TopoDS::Wire(wires.FindKey(j));
// get dimensions

Hope that helps,


Karthik Viswanathan's picture

Hi Chris,

Thank you very much for your help. I'll try out the code you gave me. In case I have any more problems, I'll message you again.

Thanks a bunch !!