X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FGeomAlgoAPI%2FGeomAlgoAPI_IGESImport.cpp;h=79830e43f221a0ec7b79b3de7f4699ba767ad515;hb=f0cec241aae9ca16d86e166f45cb5c4987d2c792;hp=cc46fda83e713cb9a4f3315176415938bd7e36fd;hpb=1e6672faca975085d23724f44e9aa7284e014c57;p=modules%2Fshaper.git diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_IGESImport.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_IGESImport.cpp index cc46fda83..79830e43f 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_IGESImport.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_IGESImport.cpp @@ -1,7 +1,13 @@ // Copyright (C) 2014-20xx CEA/DEN, EDF R&D +// File: GEOMALGOAPI_IGESImport.cpp +// Created: May 14, 2015 +// Author: Sergey POKHODENKO + #include +#include + // OOCT includes #include #include @@ -11,35 +17,19 @@ * */ //============================================================================= -//extern "C" { -namespace IGESImport { -TopoDS_Shape Import(const TCollection_AsciiString& theFileName, - const TCollection_AsciiString&, - TCollection_AsciiString& theError, const TDF_Label&) +std::shared_ptr 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; - -// bool anIsIgnoreUnits = false; - + 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) { -// if( anIsIgnoreUnits ) { -// // need re-scale a model, set UnitFlag to 'meter' -// Handle(IGESData_IGESModel) aModel = -// Handle(IGESData_IGESModel)::DownCast( aReader.Model() ); -// if( !aModel.IsNull() ) { -// IGESData_GlobalSection aGS = aModel->GlobalSection(); -// aGS.SetUnitFlag(6); -// aModel->SetGlobalSection(aGS); -// } -// } - #ifdef _DEBUG std::cout << "ImportIGES : all Geometry Transfer" << std::endl; #endif @@ -49,7 +39,7 @@ TopoDS_Shape Import(const TCollection_AsciiString& theFileName, #ifdef _DEBUG std::cout << "ImportIGES : count of shapes produced = " << aReader.NbShapes() << std::endl; #endif - aResShape = aReader.OneShape(); + aShape = aReader.OneShape(); } else { switch (status) { @@ -68,18 +58,17 @@ TopoDS_Shape Import(const TCollection_AsciiString& theFileName, default: 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 aGeomShape(new GeomAPI_Shape); + aGeomShape->setImpl(new TopoDS_Shape(aShape)); + return aGeomShape; } -//}