X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FGeomAlgoAPI%2FGeomAlgoAPI_IGESExport.cpp;h=c4d9add35d01336f89341f2061786c1be8314968;hb=b2a662eec6a0258d51a67ee7e341541e7a710752;hp=93fb05b025dc428c319d64a5869d15143dad8bbc;hpb=0479361746467f244b7ccfd1d25443677bdea8a6;p=modules%2Fshaper.git diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_IGESExport.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_IGESExport.cpp index 93fb05b02..c4d9add35 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_IGESExport.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_IGESExport.cpp @@ -78,13 +78,23 @@ int KindOfBRep (const TopoDS_Shape& theShape) } //============================================================================= -bool IGESExport(const TCollection_AsciiString& theFileName, - const TCollection_AsciiString& theFormatName, - const TopoDS_Shape& theShape, - TCollection_AsciiString& theError) +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 + + if (!theShape.get()) { + theError = "IGES Export failed: An invalid argument"; + return false; + } + // 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 IGESExport(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,9 +132,9 @@ bool IGESExport(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; }