Problem using to get planar coordinates ValueOfUV

I am trying to get parametric values (->ValueOfUV()) for each surface of a solid to perform 2D meshing and then project points back using ->value(u, v).

This seems to work fine for planar faces and some curved faces but other projection are simply wrong. What I am doing is taking the values of the surface's boundary and getting UV parameters of theses points. In some cases, they get out of bounds. I have a simple solid which is an extrusion and then a cutout hole in the middle. The hole has two curved surfaces which represent the hole. On one surface with bounds UV (0, 3.14) and (0, 1.5) the projection works fine. The other has UV bounds of (3.14, 6.28) and (0, 1.5) and the projection fails becuase point on the extremity at 6.28 returns 0 instead of 6.28. So the projection goes like this:

3.14-> 3.14, 4.28-> 4.28 and then 6.28->0. Which I guess is 2*pi so it comes back as zero?

Anyone experience similar problem?
How can I fix this?
Is this a bug?

Note: I am using v6.6.
Note: I am also having problems with complete cylindrical holes in which u goes from 0 to 6.28.

Billy's picture

OK. I solved it. I should have used method:
Handle(Geom2d_Curve) aCurve = BRep_Tool::CurveOnSurface(anEdge, aFace, s0, s1);