1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
3 // File: GEOMALGOAPI_IGESImport.cpp
4 // Created: May 14, 2015
5 // Author: Sergey POKHODENKO
7 #include <GeomAlgoAPI_IGESImport.h>
10 #include <IGESControl_Reader.hxx>
11 #include <IGESData_IGESModel.hxx>
13 //=============================================================================
17 //=============================================================================
18 TopoDS_Shape IGESImport(const std::string& theFileName,
20 std::string& theError)
23 std::cout << "Import IGES from file " << theFileName << std::endl;
25 TopoDS_Shape aResShape;
26 IGESControl_Reader aReader;
28 IFSelect_ReturnStatus status = aReader.ReadFile( theFileName.c_str() );
30 if (status == IFSelect_RetDone) {
32 std::cout << "ImportIGES : all Geometry Transfer" << std::endl;
34 aReader.ClearShapes();
35 aReader.TransferRoots();
38 std::cout << "ImportIGES : count of shapes produced = " << aReader.NbShapes() << std::endl;
40 aResShape = aReader.OneShape();
44 case IFSelect_RetVoid:
45 theError = "Nothing created or No data to process";
47 case IFSelect_RetError:
48 theError = "Error in command or input data";
50 case IFSelect_RetFail:
51 theError = "Execution was run, but has failed";
53 case IFSelect_RetStop:
54 theError = "Execution has been stopped. Quite possible, an exception was raised";
57 theError = "Wrong format of the imported file. Can't import file.";
63 catch( Standard_Failure ) {
64 Handle(Standard_Failure) aFail = Standard_Failure::Caught();
65 theError = aFail->GetMessageString();