# How to get the coordinates of a TopoDS_Vertex ?

How to get the coordinates of a TopoDS_Vertex ?
Does anyone know the answer ?
Shall I convert it to something else and how ?

MCV

Use BRep_Tool::Pnt()

BTW, TopoDS_Vertex inherits TopoDS_Shape - easy to see, - hence you can use it directly whenever you need TopoDS_Shape&

Thank you, that was a great hint and it works well !.

Do you know how to transform a TopoDS_Shape into a TopoDS_Vertex ? DownCast did not make it, or maybe I did something wrong ?

Here is what I try to do:
I transform a gp_Pnt into a TopoDS_Vertex via BRep_Tool and rotate this point (vertex) around an axis using BRepBuilderAPI_GTransform,gp_GTrsf and gp_Trsf.

Now I seek the coordinates of the rotated vertex.
Therefore I ask BRepBuilderAPI_GTransform for the shape (TopoDS_Shape), which is just my rotated vertex, and I need to convert this TopoDS_Shape into a TopoDS_Vertex (for a later conversion to a gp_Pnt).

How ????

Best Regards
MCV

Okay, I solved it via

TopoDS_Vertex avertex = TopoDS::Vertex(shape);

Thanks

MCV

Hi MCV,

When I tried this conversion "TopoDS_Vertex avertex = TopoDS::Vertex(shape);" it throws an exception.

What may be wrong with me?

I created the "shape" as follows:

/**********************************************************

if(status != IFSelect_RetDone)
{
return false;
}

TopoDS_Vertex vert = TopoDS::Vertex(shape);//Throws exception
/**********************************************************

Regards,
Jahfer V P

Hi,

first look with shape.ShapeType() if your shape is a TopoDS_Vertex. If not take a look at the TopExp_Explorer class or getting the vertices from your shape!

HTH,

Patrik