Problem with IGES (TransferRoots)

hello!

i'm working on a linux machine running occ50. i have written the following procedure for reading iges files:

IGESToBRep_Reader reader;
Standard_Integer stat = reader.LoadFile((char*)filename);
cout if (reader.Check (Standard_True)) cout reader.TransferRoots(Standard_False);

this work fine for most IGES files, but for some, like the attached, it crashes in the last line with output:

0
OK
Beginning of IGES data translation.
read.precision.mode : 0
read.iges.bspline.continuity : 1
read.surfacecurve.mode : 0

that's all. i have tried loading the file with the DRAW test program and everything works fine.

so i'm not sure, do i have a mistake in my function or is there a bug hidden somewhere in the TransferRoots routine ...

looking foreward to any suggestions
thx
robert

the iges-file can be downloaded on
http://www.opencascade.org/forumorg/bug.php?bug_id=153&f=8

Patrik Mueller's picture

Hi,

try this:

IGESControl_Reader Reader;

Standard_Integer status = Reader.ReadFile(aFileName);

if (status != IFSelect_RetDone) return status;
Reader.TransferRoots();
TopoDS_Shape aShape = Reader.OneShape();
aHSequenceOfShape->Append(aShape);

return status;
}

The difference is using "IGESControl_Reader" instead of "IGESToBRep_Reader"

HTH,

Patrik

robert_gaisbauer's picture

hi patrik!

thx for your urgent reply. unfortunately i have already tried your approach. but the result is absolutely the same.

nevertheless, thx a lot
robert

Patrik Mueller's picture

Hi Robert,

I can open your IGES file without problems. Perhaps you can give me some more infos or code??

Patrik

robert_gaisbauer's picture

thx again!

i have tried it again now, and it works somehow. but i'm not sure if it works again tomorrow. i uploaded a second file, which doesn't work either.

when executed in gdb, i get the error message:

IGES_2030
IGES_2035
IGES_2045
IGES_2050

Program received signal SIGSEGV, Segmentation fault.
0x4360469a in ShapeExtend_WireData::Add(TopoDS_Shape const&, int) ()
from /home/robert/netgen/occ/lib/libTKShHealing.so

Patrik Mueller's picture

Hi Robert,

I also get crashes if I try to open the IGES file. I'm afraid you can't use it at the moment.

Greets,

Patrik

Jérome Dufaure's picture

hello
I have download your file A6-610-314-0132.igs.
It crashes when i try to open it with OCC.
I Hvae converted it in STEP format.
Now I open it with no bugs.
If you want to use this file, i think using a step file is a good way.
Good luck
jerome

Francois Lauzon's picture

Hi,
the root entity you have in your iges files is a IGESSolid_ManifoldSolid and one of the surface in the solid can't be transfered, and the solid can't be build. So you might try to transfer all of the faces instead with something like this:

// read file in memory
IGESControl_Controller::Init();
IGESControl_Reader aReader;
IFSelect_ReturnStatus stat=aReader.ReadFile((char*)filename);

// get iges faces
// usually, you might use
// Handle(TColStd_HSequenceOfTransient) aListInit=aReader.GiveList("xst-transferrable-roots");
Handle(TColStd_HSequenceOfTransient) aList=aReader.GiveList("iges-faces");

// transfert all the iges entity
TopTools_SequenceOfShape listOfShapes;
for (j=1; j<=aList->Length(); j++) {
// downcast to an iges entity
Handle(IGESData_IGESEntity) igesEntity= Handle(IGESData_IGESEntity)::DownCast(aList->Value(j));
if (!igesEntity.IsNull()) {
// clear any old shape
aReader.Clear();
try {
isTransfered=aReader.TransferEntity(igesEntity);
// transfert is ok
if (aReader.IsDone()) {

// get the shape
TopoDS_Shape aShape=aReader.OneShape();
listOfShapes.Append(aShape);
}
}
catch (Standard_Failure) {
}
catch (...) {
}
}
}

Good Luck,
Francois.

robert_gaisbauer's picture

happy new year all together!

thank you for that tip. i will use your approach just to be sure everything works. one last questions: are you using occ5.1 or an older version? i'm using occ5.0, so i thought perhaps 5.1 manages the file. but occ5.1 doesn't link with my gcc 3.3.1 and i didn't manage to rebuild it.

thanks
robert

Francois Lauzon's picture

I am using 5.1