Extract underlying geometry from shapes
To extract the underlying geometry from a Shape, use the following methods:
BRep_Tool : :Surface to get the geometric surface from a face.
BRep_Tool : :Curve to get the 3d geometric curve from an edge.
BRep_Tool : :CurveOnSurface to get the 2d geometric curve of an edge,
defined in the parametric space of a face.
BRep_Tool : :Pnt to get the 3D point from a vertex.
Some of these methods have a location as argument.
For example, when you use :
S1 = BRep_Tool : : Surface(F,L);
you then get the surface stored in the TShape.
To use this surface in the same position as the face, you have to apply a transformation to it corresponding to the location of the face as follows:
gp_Trsf T(L) ;
S2 = S1->Moved(T) ;
The same method used without location as argument is:
S3 = BRep_Tool : : Surface(F);
returns a Surface in position, according to the location. S3 and S2 are geometrically equivalent surfaces.
Warning: with the first method, you get a pointer on the surface stored in the shape. So don't modify the surface because you will modify the shape and maybe produce an inconsistent model.
With the second method, you get a copy of the surface on which the location has been applied.
Note: you can use also a topological object directly just as if it were a geometric one by using the services of BRepAdaptor classes.