Wed, 05/03/2023 - 23:14
Forums:
Hello everyone. I would like to ask you a question to see if someone is able to answer me.
Let's suppose that I have 4 points whose coordinates could be the following:
gp_Pnt P1(-1,5,0);
gp_Pnt P2(10,10,0);
gp_Pnt P3(8,-10,0);
gp_Pnt P4(-4,0,0);
What I need is to obtain a TopoDS_wire
so that the mentioned points are part of the spline and, in addition, it is a closed spline.
I have tried with methods such as BezierSpline and the interpolate function but both generate closed curves in which the points P1
, P2
, P3
and P4
are not part of.
Thanks
Thu, 05/04/2023 - 00:07
Hello, in OCCT create TopoDS_Vertex for each knot of spline is not possible.
TopoDS_Vertex is a start and end of edge.
I think, BRepBuilderAPI_MakePolygon can help you. You be able to create from 3,4 points via constructor and then usd Add to insert new point.
Best regards, Dmitrii.
Thu, 05/04/2023 - 00:15
Yes, as you say with the polygon option I could do it. But the goal was to do it with a spline between the points.
Similar to what you can do with SolidWorks or other programs where you can define the position of the points and make a spline pass through them.
Thank you so much
Thu, 05/04/2023 - 01:41
What about my next message about GeomAPI_PointsToBSpline? It can help you? I need more information about final result.
GeomAPI_PointsToBSpline help with the next scenarion:
Curve by GeomAPI_PointsToBSpline -> TopoDS_Edge by BRepBuilderAPI_MakeEdge -> TopoDS_Wire by BRepBuilderAPI_MakeWire. In this case you will have 1-2 TopoDS_Vertex.
Best regards, Dmitrii.
Thu, 05/04/2023 - 00:11
If you would like to create just a Edge and then Wire from this Edge(you will have only 2 or 1 TopoDS_Vertex in this case). So, for creating BSpline you can use GeomAPI_PointsToBSpline.
Best regards, Dmitrii
Thu, 05/04/2023 - 16:34
I propose to use the class GeomAPI_Interpolate. The draw command to create the curve with your points:
tanginterpol c p 4 -1 5 0 10 10 0 8 -10 0 -4 0 0
The result is on the picture.