1 // File: IGESImport.cxx
2 // Created: Wed May 19 14:36:35 2004
3 // Author: Pavel TELKOV
4 // <ptv@mutex.nnov.opencascade.com>
8 #include <IFSelect_ReturnStatus.hxx>
9 #include <IGESControl_Reader.hxx>
11 #include <TCollection_AsciiString.hxx>
12 #include <TopoDS_Shape.hxx>
15 #include <SALOME_WNT.hxx>
17 #define SALOME_WNT_EXPORT
20 //=============================================================================
24 //=============================================================================
29 TopoDS_Shape Import (const TCollection_AsciiString& theFileName,
30 TCollection_AsciiString& theError)
32 IGESControl_Reader aReader;
33 TopoDS_Shape aResShape;
35 IFSelect_ReturnStatus status = aReader.ReadFile(theFileName.ToCString());
37 if (status == IFSelect_RetDone) {
38 MESSAGE("ImportIGES : all Geometry Transfer");
41 // aReader.TransferRoots(false);
42 aReader.ClearShapes();
43 aReader.TransferRoots();
45 MESSAGE("ImportIGES : count of shapes produced = " << aReader.NbShapes());
46 aResShape = aReader.OneShape();
50 // case IFSelect_RetVoid:
51 // theError = "Nothing created or No data to process";
53 // case IFSelect_RetError:
54 // theError = "Error in command or input data";
56 // case IFSelect_RetFail:
57 // theError = "Execution was run, but has failed";
59 // case IFSelect_RetStop:
60 // theError = "Execution has been stopped. Quite possible, an exception was raised";
65 theError = "Wrong format of the imported file. Can't import file.";
69 catch(Standard_Failure) {
70 Handle(Standard_Failure) aFail = Standard_Failure::Caught();
71 theError = aFail->GetMessageString();