About CurveOnSurface on cylindrical surface

When I use the following codes to find a projected curve on a cylindrical surface, the Function CurveOnSurface always return NULL Geom2d_Curve. I have made sure that the 3d circle curve is on the cylindrical curve.

Could anyone tell me why?

Thanks in advace.

==============================
gp_Cylinder cylinder(axis3, radius);
GC_MakeCylindricalSurface mcyl(cylinder);
Handle(Geom_CylindricalSurface) cylSurface = mcyl.Value();

gp_Ax2 axis2(center, xaxis, yaxis);
GC_MakeCircle mc(axis2, radius);
BRepBuilderAPI_MakeEdge me;
me.Init(mc.Value());

TopLoc_Location loc;
Standard_Real first, last;
Handle(Geom2d_Curve) paraCurve = BRep_Tool::CurveOnSurface
(me.Edge(), cylSurface, loc, first, last);

========================================

gpsunjp's picture

I resolved this problem using ShapeFix_Edge::FixAddPCurve()

G.P. Sun