As write in the title i get some problem to work with edge in a wire created by the function BRepBuilderAPI_MakeEdge2d in spite of BRepBuilderAPI_MakeEdge.
First in function of differents case i create theses types of edge :
- 2 points : BRepBuilderAPI_MakeEdge2d edgeConstruct(point1,point2);
- a segment of line :
Handle(Geom2d_Curve) line2d = new Geom2d_Line(line);
- an arc :
Handle(Geom2d_Curve) circle2d = new Geom2d_Circle(circle);
BRepBuilderAPI_MakeEdge2d edgeConstruct(circle2d ,point1,point2);
Next i add the differents edges in a wire :
My problem start after the creation of the wire.
The wire is correct, it corresponds exactly at what i want (i check it by creating a brep file and loading it in the example of OpenCascade)
My aim is to recuperate the differents edge and to display them.
So i use a TopExp_Explorer like this :
Standard_Real firstParam, lastParam;
for (contourExp.Init(myWire,TopAbs_EDGE); contourExp.More() ; contourExp.Next())
edge = TopoDS::Edge(contourExp.Current());
//Until this point all is ok but i don't know how to recuperate geometry of arc type.
If it is only segment no hay problem i do that and i can display it without problem
TopoDS_Vertex vertex1 = TopExp::FirstVertex(edge);
TopoDS_Vertex vertex2 = TopExp::LastVertex(edge);
gp_Pnt pnt3D1 = BRep_Tool::Pnt( vertex1 );
gp_Pnt pnt3D2 = BRep_Tool::Pnt( vertex2 );
But with a wire more complex with an arc i need to recuperate the geometry 2D, know which type of curve it is (basically segment or arc) to know how to display it (i use my own display)
I've try that but it doesn't work the curve3D object is garbage.
Handle(Geom_Curve) curve3D = BRep_Tool::Curve(edge,firstParam,lastParam);
Handle(Geom2d_Curve) curve2D = GeomAPI::To2d(curve3D,gp_Pln(gp::XOY()));
So i would like to know how to recuperate from an edge created by a BRepBuilderAPI_MakeEdge2d the type of the edge (segment, arc, circle etc...) to call my function of drawing (for instance if it is an arc i need the extremities point and the center of the arc to display it)
Thanks in adavance