BUG in OCC 5.1.2 Example (...samples/standard/mfc/08_ImportExport)

When a step-file is read which contains more than a solid, too much TopoDS_Shape's are created (The STEP-file is correct). For example if you have a step file with 3 boxes (3 solids), the first will be read 3 times, the second 2 times and the last one ones.

It seems to me that the step-reader doesn't do the right thing. Does anybody have allready more information about the problem?

Marcel

marcelkeller's picture

I've changed the code. The following code should works fine:

IFSelect_ReturnStatus ImportExport::ReadSTEP(const Standard_CString& fileName,
Handle(TopTools_HSequenceOfShape)& sequenceOfShape) {
TopoDS_Shape shape;
STEPControl_Reader reader;

IFSelect_ReturnStatus status = reader.ReadFile(fileName);
if (status == IFSelect_RetDone) {
reader.TransferRoots();
// Collecting resulting entities
int numberOfShapes = reader.NbShapes();
if (numberOfShapes == 0) {
sequenceOfShape.Nullify();
return IFSelect_RetVoid;
} else {
for (int i =1; i<=numberOfShapes; i++) {
shape = reader.Shape(i);
sequenceOfShape->Append(shape);
}
}
} else {
sequenceOfShape.Nullify();
}
return status;
}