X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FGeomAlgoAPI%2FGeomAlgoAPI_IGESExport.cpp;h=c4d9add35d01336f89341f2061786c1be8314968;hb=b2a662eec6a0258d51a67ee7e341541e7a710752;hp=0479b0a4fda61bea081300fa556df98eed714ebb;hpb=f8585cb5f220ae69f8a7cb01cb0a38974b309bbc;p=modules%2Fshaper.git diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_IGESExport.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_IGESExport.cpp index 0479b0a4f..c4d9add35 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_IGESExport.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_IGESExport.cpp @@ -80,9 +80,18 @@ int KindOfBRep (const TopoDS_Shape& theShape) //============================================================================= bool IGESExport(const std::string& theFileName, const std::string& theFormatName, - const TopoDS_Shape& theShape, + 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 aFormatName(theFormatName.c_str()); TCollection_AsciiString aVersion = aFormatName.Token("-", 2); @@ -97,14 +106,10 @@ bool IGESExport(const std::string& theFileName, if( aVersion.IsEqual( "5.3" ) ) aBrepMode = 1; - #ifdef _DEBUG - std::cout << "Export IGES into file " << theFileName << 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; @@ -127,9 +132,9 @@ bool IGESExport(const std::string& 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.c_str()); + return ICW.Write(theFileName.c_str()) == Standard_True; } return false; }