// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
+// File: GEOMALGOAPI_IGESImport.cpp
+// Created: May 14, 2015
+// Author: Sergey POKHODENKO
+
#include <GeomAlgoAPI_IGESImport.h>
+#include <TopoDS_Shape.hxx>
+
// OOCT includes
#include <IGESControl_Reader.hxx>
#include <IGESData_IGESModel.hxx>
*
*/
//=============================================================================
-//extern "C" {
-namespace IGESImport {
-TopoDS_Shape Import(const TCollection_AsciiString& theFileName,
- const TCollection_AsciiString&,
- TCollection_AsciiString& theError, const TDF_Label&)
+std::shared_ptr<GeomAPI_Shape> IGESImport(const std::string& theFileName,
+ const std::string&,
+ std::string& theError)
{
#ifdef _DEBUG
std::cout << "Import IGES from file " << theFileName << std::endl;
#endif
- TopoDS_Shape aResShape;
+ TopoDS_Shape aShape;
IGESControl_Reader aReader;
try {
- IFSelect_ReturnStatus status = aReader.ReadFile( theFileName.ToCString() );
+ IFSelect_ReturnStatus status = aReader.ReadFile( theFileName.c_str() );
if (status == IFSelect_RetDone) {
#ifdef _DEBUG
#ifdef _DEBUG
std::cout << "ImportIGES : count of shapes produced = " << aReader.NbShapes() << std::endl;
#endif
- aResShape = aReader.OneShape();
+ aShape = aReader.OneShape();
}
else {
switch (status) {
theError = "Wrong format of the imported file. Can't import file.";
break;
}
- aResShape.Nullify();
+ aShape.Nullify();
}
}
catch( Standard_Failure ) {
Handle(Standard_Failure) aFail = Standard_Failure::Caught();
theError = aFail->GetMessageString();
- aResShape.Nullify();
+ aShape.Nullify();
}
- return aResShape;
-}
-
+ std::shared_ptr<GeomAPI_Shape> aGeomShape(new GeomAPI_Shape);
+ aGeomShape->setImpl(new TopoDS_Shape(aShape));
+ return aGeomShape;
}
-//}