1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
3 #include <GeomAlgoAPI_IGESImport.h>
6 #include <IGESControl_Reader.hxx>
7 #include <IGESData_IGESModel.hxx>
9 //=============================================================================
13 //=============================================================================
15 namespace IGESImport {
16 TopoDS_Shape Import(const TCollection_AsciiString& theFileName,
17 const TCollection_AsciiString&,
18 TCollection_AsciiString& theError)
21 std::cout << "Import IGES from file " << theFileName << std::endl;
23 TopoDS_Shape aResShape;
24 IGESControl_Reader aReader;
26 IFSelect_ReturnStatus status = aReader.ReadFile( theFileName.ToCString() );
28 if (status == IFSelect_RetDone) {
30 std::cout << "ImportIGES : all Geometry Transfer" << std::endl;
32 aReader.ClearShapes();
33 aReader.TransferRoots();
36 std::cout << "ImportIGES : count of shapes produced = " << aReader.NbShapes() << std::endl;
38 aResShape = aReader.OneShape();
42 case IFSelect_RetVoid:
43 theError = "Nothing created or No data to process";
45 case IFSelect_RetError:
46 theError = "Error in command or input data";
48 case IFSelect_RetFail:
49 theError = "Execution was run, but has failed";
51 case IFSelect_RetStop:
52 theError = "Execution has been stopped. Quite possible, an exception was raised";
55 theError = "Wrong format of the imported file. Can't import file.";
61 catch( Standard_Failure ) {
62 Handle(Standard_Failure) aFail = Standard_Failure::Caught();
63 theError = aFail->GetMessageString();