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 //=============================================================================
14 TopoDS_Shape IGESImport(const std::string& theFileName,
16 std::string& theError)
19 std::cout << "Import IGES from file " << theFileName << std::endl;
21 TopoDS_Shape aResShape;
22 IGESControl_Reader aReader;
24 IFSelect_ReturnStatus status = aReader.ReadFile( theFileName.c_str() );
26 if (status == IFSelect_RetDone) {
28 std::cout << "ImportIGES : all Geometry Transfer" << std::endl;
30 aReader.ClearShapes();
31 aReader.TransferRoots();
34 std::cout << "ImportIGES : count of shapes produced = " << aReader.NbShapes() << std::endl;
36 aResShape = aReader.OneShape();
40 case IFSelect_RetVoid:
41 theError = "Nothing created or No data to process";
43 case IFSelect_RetError:
44 theError = "Error in command or input data";
46 case IFSelect_RetFail:
47 theError = "Execution was run, but has failed";
49 case IFSelect_RetStop:
50 theError = "Execution has been stopped. Quite possible, an exception was raised";
53 theError = "Wrong format of the imported file. Can't import file.";
59 catch( Standard_Failure ) {
60 Handle(Standard_Failure) aFail = Standard_Failure::Caught();
61 theError = aFail->GetMessageString();