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

Diplaying total no of vertex

Vidhyan's picture

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())
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.

Thanks in Advance,

Pawel's picture

Hi Vidhyan,

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


Vidhyan's picture

Thanks a lot Pawel

Vidhyan's picture

Can you able to send the code for it

Paul Jimenez's picture

TopTools_IndexedMapOfShape vertices;
TopExp::MapShapes(ResultShape, TopAbs_VERTEX, vertices);

Standard_Integer TotalNoOfVertex = vertices.Extent();

Vidhyan's picture

Thanks a lot for your reply

Vidhyan's picture

Paul Jimenez, now how to get the all 8 vertices Points ?

Paul Jimenez's picture

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.

Vidhyan's picture

Thanks it helped me a lot

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.