X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FGeomAlgoAPI%2FGeomAlgoAPI_IGESExport.cpp;h=c4d9add35d01336f89341f2061786c1be8314968;hb=580f1752efd9d3e8c2890c4016b04dafd639bab7;hp=936dfd6935ae41eae03a7667da9dc300c60f55e2;hpb=d7d6265cce5e49374130cb4c6a4cfb3a90eba875;p=modules%2Fshaper.git diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_IGESExport.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_IGESExport.cpp index 936dfd693..c4d9add35 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_IGESExport.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_IGESExport.cpp @@ -1,5 +1,9 @@ // Copyright (C) 2014-20xx CEA/DEN, EDF R&D +// File: GEOMALGOAPI_IGESExport.cpp +// Created: Dec 24, 2014 +// Author: Sergey BELASH + #include #include "GeomAlgoAPI_Tools.h" @@ -74,17 +78,23 @@ int KindOfBRep (const TopoDS_Shape& theShape) } //============================================================================= -//extern "C" { +bool IGESExport(const std::string& theFileName, + const std::string& theFormatName, + const std::shared_ptr& theShape, + std::string& theError) +{ + #ifdef _DEBUG + std::cout << "Export IGES into file " << theFileName << std::endl; + #endif -namespace IGESExport { + if (!theShape.get()) { + theError = "IGES Export failed: An invalid argument"; + return false; + } -bool Export(const TCollection_AsciiString& theFileName, - const TCollection_AsciiString& theFormatName, - const TopoDS_Shape& theShape, - TCollection_AsciiString& theError) -{ // theFormatName expected "IGES-5.1", "IGES-5.3"... - TCollection_AsciiString aVersion = theFormatName.Token("-", 2); + TCollection_AsciiString aFormatName(theFormatName.c_str()); + TCollection_AsciiString aVersion = aFormatName.Token("-", 2); #ifdef _DEBUG if (!aVersion.IsEqual("5.1") || !aVersion.IsEqual("5.3")) std::cout << "Warning: unrecognized version " << aVersion.ToCString() @@ -96,14 +106,10 @@ bool Export(const TCollection_AsciiString& theFileName, if( aVersion.IsEqual( "5.3" ) ) aBrepMode = 1; - #ifdef _DEBUG - std::cout << "Export IGES into file " << theFileName.ToCString() << std::endl; - #endif - // Mantis issue 0021350: check being exported shape, as some stand-alone // entities (edges, wires and vertices) cannot be saved in BRepMode if( aBrepMode == 1 ) { - int aKind = KindOfBRep( theShape ); + int aKind = KindOfBRep( theShape->impl() ); if( aKind == -1 ) { theError = "EXPORT_IGES_HETEROGENEOUS_COMPOUND"; return false; @@ -126,13 +132,9 @@ bool Export(const TCollection_AsciiString& theFileName, Interface_Static::SetCVal( "write.precision.mode", "Max" ); // perform shape writing - if( ICW.AddShape( theShape ) ) { + if( ICW.AddShape( theShape->impl() ) ) { ICW.ComputeModel(); - return ICW.Write( theFileName.ToCString() ); + return ICW.Write(theFileName.c_str()) == Standard_True; } return false; } - -} - -//}