Creating Sphere using BRepPrimAPI_MakeRevol

Dear All,

I am trying to create a Sphere by revolving a Circular Arc by 360*. But I am having no clue, what wrong I am performing, so that I am unable to create such Sphere. Here is the code I am using to create Sphere.

// Points to create an Arc
gp_Pnt point1(Standard_Real(-11.0), Standard_Real(-7.0), Standard_Real(0.0));
gp_Pnt point2(Standard_Real(-7.0), Standard_Real(-3.0), Standard_Real(0.0));
gp_Pnt point3(Standard_Real(-11.0), Standard_Real(1.0), Standard_Real(0.0));

// Creating an OCC Circular Arc
GC_MakeArcOfCircle *occArcOfCircle = new GC_MakeArcOfCircle(point1, point2, point3);

//Geom Curve
Handle(Geom_Curve) m_OCCTCurve = occArcOfCircle->Value();

// Creating an OCC edge
TopoDS_Edge m_OCCTEdge = BRepBuilderAPI_MakeEdge(m_OCCTCurve);

//Direction for the rotary surface
gp_Dir direction(Standard_Real(0.0), Standard_Real(1.0), Standard_Real(0.0));

// Creating axis for the rotation surface
gp_Ax1 axis(gp_Pnt(Standard_Real(-11.0), Standard_Real(-7.0), Standard_Real(0.0)), direction);

//Revolving Shape
BRepPrimAPI_MakeRevol shapeRevolve(edge, axis, Standard_Real(6.2831859588623047));

if(shapeRevolve.IsDone())
{
// OCCT Face
TopoDS_Face m_OCCTFace = TopoDS::Face(shapeRevolve.Shape());

// Writing into STEP File
STEPControl_Controller::Init();
STEPControl_Writer aWriter;
aWriter.Transfer(m_OCCTFace, STEPControl_AsIs);
aWriter.Write("RevolvedFace.step");
}

Please anybody tell me, what is wrong with this code?

PG's picture

do u want to create a spherical surface or solid sphere ?

Sharad Verma's picture

Thanks for the Reply PG.

I found out the solution.

For 360* rotation use BRepPrimAPI_MakeRevol (const TopoDS_Shape &S, const gp_Ax1 &A, const Standard_Boolean Copy=Standard_False) Constuctor.