IGES import to Geom_BSplineSurface

I am having a little trouble with OpenCascade's IGES import routines. The IGES entity I am principally interested in is number 128, and I would like to represent this in OpenCascade as a Geom_BSplineSurface object, but the IGES example code I have looked at all deals with using Topological representations, rather than Geometric ones. Can I directly import my IGES 128 entities into Geom_BSplineSurface forms, or do I need to read into TopoDS_Shapes and convert?

Roman Lygin's picture

Hello,

Open CASCADE data exchange processors (IGES and STEP) are intended to transfer data between Open CASCADE topology (given as TopoDS_Shape) and neutral format entities. Of course, mapping at the level of geometry also exists but it is an intermediate level, while topology is an API.

To recover a geometrical surface (Geom_Surface) from received topological face (TopoDS_Face) you can use:

IGESControlStd_Reader aReader = ...;

...

TopoDS_Shape aResult = aReader.OneShape();

for (TopExp_Explorer anExp (aResult, TopAbs_FACE); anExp.More(); anExp.Next()) {

TopoDS_Face aFace = anExp.Current();

Handle(Geom_Surface) aSurface = BRep_Tool::Surface (aFace);

// working with aSurface

if (aSurface->IsKind (STANDARD_TYPE (Geom_BSplineSurface)) {

...

}

}

If you are extremely interested in the intermediary level of mapping geometry, please have a look at IGESToBRep_BasisSurface class.

Best regards, Roman

PG's picture

Hi

Any example code to use this class IGESToBRep_TopoSurface ?

Say I have OCC geometrical surface (for eg. spherical surface or rect. trimmed cylindrical surface ) and toplogical face ( b-spline surface with a circular hole in between).
Now I export these surfaces/face in IGES format.
When I read it back using the OCC IGES reader, I should be able to read the geometrical surfaces as OCC geometrical surfaces and the toplogical face as OCC brep face itself.
Can the above class help in this regard ???