# Diplaying total no of vertex

A box contains 8 vertex (points). I used x,y,z,l,w,b to create a box.

BRepPrimAPI_MakeBox mkBox( gp_Pnt(x, y ,z),l, h ,w);
TopoDS_Shape ResultShape = mkBox.Shape();
int count=0;
TopExp_Explorer ex;
for (ex.Init(ResultShape, TopAbs_VERTEX); ex.More(); ex.Next())
{
count++;
TopoDS_Vertex vertex = TopoDS::Vertex(ex.Current());
gp_Pnt pt = BRep_Tool::Pnt(vertex);
}

After debugging the above code i am getting the count value as 48. why it is coming as 48. How can i get the 8 vertices.

Vidhyan Hi Vidhyan,

use TopTools_IndexedMapOfShape instead. TopExp_Explorer might visit - as you see - the vertices more than once.

Regards
Pawel Thanks a lot Pawel Can you able to send the code for it TopTools_IndexedMapOfShape vertices;
TopExp::MapShapes(ResultShape, TopAbs_VERTEX, vertices);

Standard_Integer TotalNoOfVertex = vertices.Extent();  Paul Jimenez, now how to get the all 8 vertices Points ? To retrieve each shape [I from 1 to Extent()]:

const TopoDS_Shape & TopTools_IndexedMapOfShape::operator() (const Standard_Integer I) const

To convert the TopoDS_Shape to TopoDS_Vertex:

static const TopoDS_Vertex & TopoDS::Vertex(const TopoDS_Shape &S)

To retrieve the point of a vertex:

static gp_Pnt BRep_Tool::Pnt(const TopoDS_Vertex &V)

You should really consider downloading the Reference Documentation and also reading the Technical Overview to get an idea of how to do all those things. Thanks it helped me a lot