face's type

Who can tell me how get the face's type such as plane or cylind?

Miguel Costa's picture

Hi Wanghs,

This is how I did it. It hope it can help you somehow. Starting with a TopoDS_Shape theShape that is supposes to be a TopoDS_Face (i.e. theShape.ShapeType() == TopAbs_FACE)

TopoDS_Face aFaceElement= TopoDS::Face(Face);
BRepAdaptor_Surface aFaceElementAdaptor(aFaceElement, true);
GeomAbs_SurfaceType theTypeElement= aFaceElementAdaptor.GetType();

if(theTypeElement==GeomAbs_Cylinder)//Si le type de surface est un cylindre
gp_Cylinder theCylinder= aFaceElementAdaptor.Cylinder();
//Get the data on the cylinder using the gp_Cylinder functions
else if(theTypeElement==GeomAbs_Plane
gp_Pln thePlane= aFaceElementAdaptor.Plane();
//Get the data on the plane using the gp_Pln functions

I hope I understood your question and I hope this could help you. You may also search the forum, many others said very useful thing on that subject.


wanghs's picture