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>
14 //=============================================================================
18 //=============================================================================
23 __declspec(__dllexport)
25 TopoDS_Shape Import (const TCollection_AsciiString& theFileName,
26 TCollection_AsciiString& theError)
28 IGESControl_Reader aReader;
29 TopoDS_Shape aResShape;
31 IFSelect_ReturnStatus status = aReader.ReadFile(theFileName.ToCString());
33 if (status == IFSelect_RetDone) {
34 MESSAGE("ImportIGES : all Geometry Transfer");
37 // aReader.TransferRoots(false);
38 aReader.ClearShapes();
39 aReader.TransferRoots();
41 MESSAGE("ImportIGES : count of shapes produced = " << aReader.NbShapes());
42 aResShape = aReader.OneShape();
46 // case IFSelect_RetVoid:
47 // theError = "Nothing created or No data to process";
49 // case IFSelect_RetError:
50 // theError = "Error in command or input data";
52 // case IFSelect_RetFail:
53 // theError = "Execution was run, but has failed";
55 // case IFSelect_RetStop:
56 // theError = "Execution has been stopped. Quite possible, an exception was raised";
61 theError = "Wrong format of the imported file. Can't import file.";
65 catch(Standard_Failure) {
66 Handle(Standard_Failure) aFail = Standard_Failure::Caught();
67 theError = aFail->GetMessageString();