Extracting pcurves ?

Hi !

Which is the fastest way to get a list of all parametric curves for a face (TopoDS_Face or Geom_Surface) ?

Mikael

Mikael Aronsson's picture

Hi again !

Tpology is not my strong side so I need some help with this. What I am trying to do is to a list of all trimming curves for a face, I use the wire explorer to get all the edges and then I use BRep_Tool::CurveOnSurface() to get the pcurves, now the problem come.

For example a cylinder has a circle as pcurve for the plane that caps the end of the cylinder, but is also has a pcurve that is a straight line along the cylinder itself (in 3D space), I guess I only need the closed triming curves, but using IsClosed() does not work, it always returns false as none of the pcurves are closed, but the circle is closed (in 3D), So I evaluate the first and last point of the pcurve and use the x,y values returned as input to surface->D0( x, y) to get the first and last 3D points of the curve.

And if the teo 3D points are same or close I consider the pcurve closed, am I on the right track here or is there a better way to do all this ?.

I noticed that there is a Polygon_Polygon2d class, but I have not found and classes that use it, is there any built in support to tesselate pcurves into polygons.

Any ideas

Mikael

Joe's picture

Hi If the surface is close, test which direction is close by method Geom_Surface::IsUClosed/IsVClosed

Use Geom_Surface::Bounds(u1,u2,v1,v2) to get bound parameter.

If IsUClosed then the pcurve for the coincide edge is u1 and u2.

Best Regards Joe

Jean Michel Boulcourt's picture

Hello Mikael,

The method you describes to get the pcurves is the correct one. Just to be sure we are talking about the same thing, pcurves are Geom2d_Curve (defined in the parametric space).

Now about the BRep_Tool::IsClosed(TopoDS_Edge e, ...) Method :

In fact this method check if the edge is on the closing curve of a closed surface. Is does not check if the 3d curve is "closed" in a geometric meaning. This is typically the case for periodic surfaces like Geom_Cylinder or Sphere or Torus.

You can evaluate the 3d points corresponding to the extremities of the pcurve but take care about degenerate cases like on the sphere.

Best Regards.

Jean Michel.

Mikael Aronsson's picture

Hi !

Thanks for that, isn't there a generic method to extract all pcurves that are used to trim a face ?, I mean the BRepMesh class must have this information to find out where the bounds of a face is and any holes there might be in it, when the tesselation is done.

I could ignore degenerate pcurves and so on but would that be the correct solution ?

Mikael