Correct loading of IGES files?

Hello,

Curiously when an IGES file is read with IGESControl_Reader, you get more edges than expected, it is as if they were duplicated (they surely are).
What I do is to read the file, iterate over the retrieved faces, and sew them. So this way there is no problem of duplicated edges :

IGESControl_Reader reader;
int status = reader.ReadFile (some_path);

reader.TransferRoots ();
TopoDS_Shape one_shape = reader.OneShape ();

BRepOffsetAPI_Sewing face_sewer (0.001);
TopExp_Explorer explorer (one_shape, TopAbs_FACE);
while (explorer.More ())
{
face_sewer.Add (explorer.Current ());
explorer.Next ();
}
face_sewer.Perform ();
return face_sewer.SewedShape ();

Everybody agrees with this?

Patrik Mueller's picture

Hi Hugues,

how about using the ShapeFix classes?

Greets,

Patrik

jacobStoren's picture

Hei !
From what I have experienced by trying to get sane information extracted from an IGES file, circular edges are (somewhere ) substituted by a lot of short Bspline curves. Typically with 4 vertexes. It seems like it is the edges of plane surfaces that gets this behaviour. (at least).

I have tried to understand how to use the ShapeHelaing stuff in open Cascade, but I have not managed to do any healing at all.

I have done :
Handle(ShapeFix_Shape) sfs = new ShapeFix_Shape;
sfs->Init ( myShape );
sfs->Perform();
//Get result
TopoDS_Shape aResult = sfs->Shape();

if(sfs->Status(ShapeExtend_DONE) ) {
cout << "Shape was fixed" << endl;
}
else if(sfs->Status(ShapeExtend_FAIL)) {
cout << " Shape could not be fixed" << endl;
}
else if(sfs->Status(ShapeExtend_OK)) {
cout << "Initial face is valid with specified precision =" << sfs->Precision() << endl;
}

It does not fix wrong surface normals on some faces of a STEP model, and does not make a solid out of an IGES model thet is supposed to be a solid.
Does anybody hae a clue to how the resource file for the shape healing / IGES /STEP readers actually works ? I have not seen any effect of changing them.
(Resource file like in "read.iges.resource.name")

Thank you for the hint on sewing faces together :-)

Jacob