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).
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!
Mon, 01/26/2004 - 07:55
Use BRep_Tool::Pnt()
BTW, TopoDS_Vertex inherits TopoDS_Shape - easy to see, - hence you can use it directly whenever you need TopoDS_Shape&
Mon, 01/26/2004 - 19:53
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
Mon, 01/26/2004 - 20:07
Okay, I solved it via
TopoDS_Vertex avertex = TopoDS::Vertex(shape);
Thanks
MCV
Thu, 03/24/2005 - 07:49
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:
/**********************************************************
IGESControl_Reader reader;
IFSelect_ReturnStatus status = reader.ReadFile("filename");
if(status != IFSelect_RetDone)
{
AfxMessageBox("Failed to load IGES file");
return false;
}
reader.TransferRoots();
TopoDS_Shape shape = reader.OneShape();
TopoDS_Vertex vert = TopoDS::Vertex(shape);//Throws exception
/**********************************************************
Regards,
Jahfer V P
Thu, 03/24/2005 - 08:55
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