Retreive Normals from IGES reader

Hi,

I'm currently writing a converter that converts from IGES
into a Scene Graph Structure (OpenSG). I'm having some
trouble with the normals, most of them look ok but there
are always some corrupt normals (the file is ok as other
readers calculate correct normals!).

Here's more or less how I retreive the normals:

BRepGProp_Face prop(TopoDS::Face(child));

if( pc.Triangulation()->HasUVNodes() ){
for( int k = 1; k gp_Pnt2d uv = (pc.Triangulation()->UVNodes())(triangle(k));

gp_Pnt pnt;
gp_Vec faceNormal;

prop.Normal(uv.X(),uv.Y(),pnt,faceNormal);

if( TopoDS::Face(child).Orientation() == TopAbs_REVERSED )
faceNormal *= -1;
}
}

I observed that some normals are (0,0,0)... What am I supposed to
do with them?

And as I'm very new to the IGES format here some more questions:
Does the file format contain color information or the faces?
Does it contain Texture coordinates? Are the normals intended as
per vertex or do connected faces share the normals on
their shared vertices?

Thank you for your help, regards,

Toni

Patrik Mueller's picture

Hi Antonio,

how about using the NURBS nodes from OpenSG? I think it should also give you good results...

About IGES: IGES supports colors (but no textures). If you want to receive color informations you can use the XDE classes or take a look at the "IGESCAFControl_Reader" class for further informations.

Greets,

Patrik

bleile's picture

Oh Hi Patrik,

nice to see you here as well! Good suggestion for
using the NURBS in OpenSG... I have learned to
tesselate the surfaces in Cascade, but I have no idea
on how to retreive the NURBS from Cascade.... ;)
Will check it out, any pointer appreciated!

Cheers,

Toni

P Dolbey's picture

May be worth delving into the FreeCAD code on sourceforge. It does a similar thing but uses Coin3d instead of OpenSG.

Also the code on http://projects.opencascade.org/projects/graphperf/download.htm

might help

Pete

Patrik Mueller's picture

Hi Pete,

not so sure - I think FreeCAD still uses Coin3d 1.0? I don't know how good the NURBS support is in 1.0 - and 2.0 is GPL licensed!

Greets,

Patrik

P Dolbey's picture

I've actually recompiled FreeCAD against my own Coin3d 2.4.5, SoQt and OpenCASCADE 6.1 builds all under Visual Studio 2005 - the biggest difficulty was managing a Qt3 (QTWin'd) build coexisting with my favoured Qt4 4.2.2 platform (and I probably fudged around the python libs but it was a couple of months ago). Anyway I wasn't suggesting a move to an Open Inventor scenegraph, only that the source code might reveal some useful insights with respect to pulling an OpenCASCADE model itom OpenSG. FreeCAD still seems poor in its user interface model, unless you're a python guru, so I'm sticking to OCC rendering for now.

Pete

Patrik Mueller's picture

OK,

it was my fault (or my english :-))

Greets,

Patrik

Patrik Mueller's picture

Hi Toni,

don't hesitate to ask me via EMail..

Greets,

Patrik

Anup's picture

Hi,

Anyone please help me, I am new to opencascade, My task is to import iges file and display in coin3D, I don't know whether coin3D is good to display or not, I had displayed STL File in coin3D, But now i need to display IGES please help.... is there any way to do it?? or any other way to display IGES file??