# Identify all the vertices of part

Hello,

I'm a newbie with OCC. I want to ask you 1 question: How can I extract coordinates of all the vertices of a slot from a STEP file and input the result to a text file with name separately for each vertex (like vertex1 (3; 4; 5), vertex2 (1; 2; 3)?

Tuan

Ciao

``````
//! all includes have been intentionally omitted
//! assuming you .step file is FILENAME
//! coords are written onto stdoutput

if(stat!=IFSelect_RetDone) exit(1);

TopTools_IndexedMapOfShape vMap;
TopExp::MapShapes(aShape,TopAbs_VERTEX,vMap);
for(int n=1; n<=vMap.Extent(); n++)
{
const TopoDS_Vertex &aVertex = TopoDS::Vertex(vMap.FindKey(n));
const gp_Pnt &P = BRep_Tool::Pnt(aVertex);
int index = vMap.FindIndex(aVertex);
printf("Vertex index: %d Coords(%f, %f, %f)\n",index,P.X(),P.Y(),P.Z());
}
``````

Giovanni

Hello Giovanni,

Can you help me with a problem about the normal vector?

I extracted the normal vector of all planes of Slot. But do you know how to calculate the cross and dot product between 2 normal vectors?

Tuan

Ciao

gp_Dir identifies a unit vector in space. Example for a dot product:

For a the vectorial product use the method gp_Dir::cross.

Several methods are available. See the documentation of package gp for further details.

Giovanni

Hello,