Open CASCADE, the 3D modelling kernel
3D modeling & numerical simulation

Search the Forums
See All Topics
Open CASCADEShowroomGet it!Developer CornerSupport and ProductsAbout us
Technical overview
Areas of use
Shape factory
Shape gallery
What's new
System requirements
Download Center
Public license
Getting started
Open Source community
Training and e-learning
A-la Carte Support
Value-added software
Complementary Components
Customer Corner
Company Profile
Marketing Materials
Contact Us
Home / Developer Corner / Forums / Usage issues / Reading IGES files

Reading IGES files

Reading IGES files
QUENAN Christian 2012/07/25 22:15
Hello everybody

I'm a new user of Opencascade, and i need some help...
I have an IGES file using NURBS representing a surface and i need to calculate the normal vectors to the surface on different points.
I thought to find in OpenCascade source code how the file is read, and modify it using the points coordinates to compute normal vectors.
My problem is I didn't understood how OpenCascade read coordinates of the points and draw polygons.

Someone can help me?
Or if anybody knows an other solution for this problem, i'm opened to any suggestion.

Thanks for reading, and sorry for my english, I don't speak very well.

Pawel 2012/07/31 17:02
Hi Quenan,

I would do that like this:

1. Read Iges file.
2. Use TopExp_Explorer or TopTools_IndexedMapOfShape to find all the faces of the imported shape.
3. For each face obtain the U and V parameters and iterate.
4. At each U-V-point get the surface normal using BRepLProp_SLProps

It would look something like this:

TopTools_IndexedMapOfShape aMap;

          BRepClass3d_SolidClassifier solidClassifier(shape);

          TopExp::MapShapes(shape, TopAbs_FACE, aMap);

          BRepLProp_SLProps surfaceProperties(1, Precision::Confusion());
          double u0, u1, v0, v1;
          double u, v;
          double uDelta, vDelta;                                                                      

          for(int i = 1; i <= aMap.Extent(); i++)
               BRepAdaptor_Surface surface(TopoDS::Face(aMap(i)));                                        

               u0 = surface.FirstUParameter();
               u1 = surface.LastUParameter();

               v0 = surface.FirstVParameter();
               v1 = surface.LastVParameter();

               u = u0;
               v = v0;

               uDelta = surface.UResolution(resolution);
               vDelta = surface.VResolution(resolution);                    

               while(u <= u1)
                    v = v0;
                    while(v <= v1)
                         GetSurfaceProperties(u, v,
                              surfaceProperties, solidClassifier,
                              output, propertyToCompute);

                         v += vDelta;                              
                    if(v != v1)
                         v = v1;
                         GetSurfaceProperties(u, v,
                              surfaceProperties, solidClassifier,
                              output, propertyToCompute);

                    u += uDelta;
               if(u != u1)
                    u = u1;
                    v = v0;
                    while(v <= v1)
                         GetSurfaceProperties(u, v,
                              surfaceProperties, solidClassifier,
                              output, propertyToCompute);

                         v += vDelta;                              
                    if(v != v1)
                         v = v1;
                         GetSurfaceProperties(u, v,
                              surfaceProperties, solidClassifier,
                              output, propertyToCompute);

QUENAN Christian 2012/08/06 22:08
Hi Pawel,

thank you for your quick answer, and sorry for mine, arriving a little bit late.

But i don't understand some parts of your code.

First, i don't know how to use this line "BRepAdaptor_Surface surface(TopoDS::Face(aMap(i)));"

Secondly, the fonction GetSurfaceProperties(), where it is define? I don't find it.

Sorry if my questions are stupid.

thx for advance,

Pawel 2012/08/06 23:47
Hi Christian (sorry for confusing your name/surname ;)

the sample code is taken from my application so let me explain:

- I used BRepLProp_SLProps to get the properties of a surface. To use that class I needed a BRepAdaptor_Surface object which is based on a TopoDS_Face taken from a map filled before

- GetSurfaceProperties looks something like this:

void shellDocObjectProperties::GetSurfaceProperties(double u, double v,
          BRepLProp_SLProps & surfaceProperties,
          BRepClass3d_SolidClassifier & solidClassifier,
          ArrayList ^ output, SurfaceProperties propertyToCompute)
          gp_Pnt point;
          gp_Dir normal;

          surfaceProperties.SetParameters(u, v);
          point = surfaceProperties.Value();                         

          solidClassifier.Perform(point, Precision::Confusion());

          //take only points that are on the surface of the object
          if( solidClassifier.State() != TopAbs_ON)


          switch (propertyToCompute)
          case SurfaceProperties::CurvatureDirections:
                    gp_Dir minD, maxD;
                    surfaceProperties.CurvatureDirections(maxD, minD);



          case SurfaceProperties::GaussianCurvature:
case SurfaceProperties::Normal:

This is how you can get the surface normal.

Hope this helps.


QUENAN Christian 2012/08/22 19:22
Thank you for your help!!

I have some details to solve to do exactly what I want, but your help was very good !

Sorry for the late response and thx again.

With regards,


Game Milky 2012/12/18 11:46
Dear Christian,

I face the same problem right now,would you share it!

Best Regards

Latest news
  • Open CASCADE Technology 6.7.0 is available for download!
  • Open CASCADE Technology 6.6.0 is available for download!
  • Open CASCADE Technology 6.5.5 is available for download!

  • © OPEN CASCADE 2000 - 2014  |  Search  |  Contacts   |  Site map