Can I cast the TopoDS_Shape to the Geom_***?

I can construct a sub shape of TopoDS_Shape like followings:

Standard_Real x_length=5;
Standard_Real y_length=5;
gp_Pnt aPnt1(0, 0 , 0);
gp_Pnt aPnt2(x_length , 0 , 0);
gp_Pnt aPnt3(x_length, y_length , 0);
gp_Pnt aPnt4(0, y_length , 0);

Handle(Geom_TrimmedCurve) aSegment1 = GC_MakeSegment(aPnt1 , aPnt2);
Handle(Geom_TrimmedCurve) aSegment2 = GC_MakeSegment(aPnt2 , aPnt3);
Handle(Geom_TrimmedCurve) aSegment3 = GC_MakeSegment(aPnt3 , aPnt4);
Handle(Geom_TrimmedCurve) aSegment4 = GC_MakeSegment(aPnt4 , aPnt1);

TopoDS_Edge aEdge1 = BRepBuilderAPI_MakeEdge(aSegment1);
TopoDS_Edge aEdge2 = BRepBuilderAPI_MakeEdge(aSegment2);
TopoDS_Edge aEdge3 = BRepBuilderAPI_MakeEdge(aSegment3);
TopoDS_Edge aEdge4 = BRepBuilderAPI_MakeEdge(aSegment4);

TopoDS_Wire aWire = BRepBuilderAPI_MakeWire(aEdge1 , aEdge2 , aEdge3 , aEdge4);
TopoDS_Face myFaceProfile = BRepBuilderAPI_MakeFace(aWire);

The question is, if I just have the object of the TopoDS_Face like 'myFaceProfile', how can I get the positions of that four points?

Another question is, Can I cast the TopoDS_Shape to the Geom_***?
i.e, casting the TopoDS_Vertex to Geom_CartesianPoint.

Thank you in advance!!

Marco Matt's picture

You cannot simply "cast" from a Topology to a Geometry.

The procedure I use is something like the following...

shape is a TopoDS_Shape

switch ( shape.ShapeType() )
{
case TopAbs_COMPOUND:
{
...
} break;
case TopAbs_COMPSOLID:
{
...
} break;
case TopAbs_EDGE:
{
TopoDS_Edge edge = TopoDS::Edge(shape);
TopLoc_Location location;
Standard_Real pFirst, pLast;
Handle(Geom_Curve) curve = BRep_Tool::Curve(edge, location, pFirst, pLast);
....
} break;
...
}