X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FGeomAlgoAPI%2FGeomAlgoAPI_BREPExport.cpp;h=a9c4fffd2ca63d6727c7213e83297202760e6ff4;hb=3205d0f18200948632155bbe7b640bc1e482243d;hp=506a082645e816ee5831cc0a3c86eff803dc4501;hpb=144fb75724b240b9a627ce7179f43e04ee90b465;p=modules%2Fshaper.git diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_BREPExport.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_BREPExport.cpp index 506a08264..a9c4fffd2 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_BREPExport.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_BREPExport.cpp @@ -1,7 +1,15 @@ // Copyright (C) 2014-20xx CEA/DEN, EDF R&D +// File: GEOMALGOAPI_BREPExport.cpp +// Created: May 14, 2015 +// Author: Sergey POKHODENKO + #include +#include "GeomAlgoAPI_Tools.h" + +#include + #include #include @@ -10,22 +18,26 @@ * */ //============================================================================= -//extern "C" { -namespace BREPExport { -bool Export(const TCollection_AsciiString& theFileName, - const TCollection_AsciiString&, - const TopoDS_Shape& theShape, - TCollection_AsciiString& theError) +bool BREPExport(const std::string& theFileName, + const std::string&, + const std::shared_ptr& theShape, + std::string& theError) { #ifdef _DEBUG std::cout << "Export BREP into file " << theFileName << std::endl; #endif - if ( !BRepTools::Write( theShape, theFileName.ToCString() ) ) { + + if (!theShape.get()) { + theError = "BREP Export failed: An invalid argument"; + return false; + } + + // Set "C" numeric locale to save numbers correctly + GeomAlgoAPI_Tools::Localizer loc; + + if (!BRepTools::Write(theShape->impl(), theFileName.c_str())) { theError = "BREP Export failed"; return false; } return true; } - -} -//}