To convert a TopoDS_Face into a Geom_Surface

When I try this simple example :

TopoDS_Face F;
Handle(Geom_Surface) S;
double r = 10;
double h = 20;
double u1 = 0;
double u2 = 0;
double v1 = 0;
double v2 = 0;

F = BRepPrimAPI_MakeCylinder( gp::ZOX(), r, h ).Face();
S = BRepTool::Surface( F );
S->Bounds( u1, u2, v1, v2 );

... I obtain wrong values for v1 : -2e+100 ; and for v2 : 2e+100 (u1 = 0 and u2 = 2*PI are right), as if the cylinder had an infinite height (that we can see by S->Value(u1,v1) for example).
I've got the same result with a box instead of a cylinder.
Why do the parameters have wrong values ? (ie : Why the surface is infinite for a finite face ?)

Francois Lauzon's picture

Hello Vincent,
That's just the way it is, the values are not wrong. The face is build from a Geom_CylindricalSurface (which is finite in the U direction and infinite in the V direction) and from a wire, which limits the cylindrical surface.

You will find the same thing in a face build from a Geom_ConicalSurface, or from an edge build from a Geom_Line (a geom line is infinite).

Good Luck,

François Lauzon, Ing. Stag.
Software Development Coordinator
DBM Reflex Inc.
1620 boul. Dagenais ouest
Laval, Québec