
Thu, 07/13/2023 - 11:24
Hello, buddy, recently I have a problem in building an ellipsoid, want to ask you.
gp_Pnt TargetPoint(0, 0, 0); // The center point of ellipse
gp_Dir xdir(1, 0, 0); // motion along the long axis
gp_Ax2 axis(TargetPoint, gp::DZ(), xdir);
Handle_Geom_Ellipse ellipse = new Geom_Ellipse(axis, 30, 10);
TopoDS_Edge edge = BRepBuilderAPI_MakeEdge(ellipse);
gp_Dir vector_1;
gp_Ax1 revolAxis(TargetPoint, vector_1); // Define an axis of rotation
TopoDS_Shape ellipsoid = BRepPrimAPI_MakeRevol(edge, revolAxis); //An ellipsoid is obtained about the axis of rotation
In theory, my vector_1 should be a perpendicular axis intersecting with axis, such as gp::DX() or gp::DY(). However, this implementation will report an error, I do not know why?
When I set vector_1 to gp::DZ(), there is no error, but the ellipsoid shape obtained is only a plane ring obtained by the long axis and the short axis as the radius, and it is not the ellipsoid I want.
Because, I would like to ask you, what might be the problem?
Thu, 07/13/2023 - 11:53
Hello,
There is some sample, please check.
Best regards, Dmitrii.
Thu, 07/13/2023 - 13:15
Hello, first of all, thank you very much for your reply!
I have adjusted the code structure according to your ideas, and the good thing is that the direction of the rotation axis is now on the theoretical corresponding. The bad thing is that the resulting model is still a flat ring structure, rather than a three-dimensional ellipse structure.
Thu, 07/13/2023 - 11:56
The problem is - you need to trim rotated countour/ You will have self intersection in another case.
Best regards, Dmitrii.
Thu, 07/13/2023 - 13:18
Hello, do you mean that there may be conflicts when modeling in this way?
Thu, 07/13/2023 - 13:32
Try to rotate circle along axis. It will be double surface on one point. You need to rotate circle only on 180 degree instead of 360. To make sphere you need to rotate a half of circle for 360 or whole circle for 180.
Best regards, Dmitrii.
Thu, 07/13/2023 - 13:59
It is true that the Angle of rotation of the model needs to be defined, as you said. I thought it would be OK to follow the default model.
Thank you very much!