X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FGeomAlgoAPI%2FGeomAlgoAPI_STLExport.cpp;fp=src%2FGeomAlgoAPI%2FGeomAlgoAPI_STLExport.cpp;h=48477c36a18386ad1d897a8fdef042974cb6f23b;hb=ce72dd01645885d720b731795d676e2feeabc8d6;hp=a11aa6565795f9bf2e52aec8eba559da10606d78;hpb=8e1b6aa1930d46fcb341b61886370385fe02e117;p=modules%2Fshaper.git diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_STLExport.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_STLExport.cpp index a11aa6565..48477c36a 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_STLExport.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_STLExport.cpp @@ -56,7 +56,7 @@ bool STLExport(const std::string& theFileName, try { - double lDeflection = theDeflection; + double aDeflection = theDeflection; StlAPI_Writer aWriter; // copy source shape BRepBuilderAPI_Copy aCopy( theShape->impl(), Standard_False ); @@ -65,13 +65,15 @@ bool STLExport(const std::string& theFileName, aWriter.ASCIIMode() = theIsASCII; if ( theIsRelative ) { Standard_Real aXmin, aYmin, aZmin, aXmax, aYmax, aZmax; - Bnd_Box bndBox; - BRepBndLib::Add( theShape->impl(), bndBox ); - bndBox.Get( aXmin, aYmin, aZmin, aXmax, aYmax, aZmax ); - lDeflection = MAX3( aXmax-aXmin, aYmax-aYmin, aZmax-aZmin ) * theDeflection; + Bnd_Box aBndBox; + BRepBndLib::Add( theShape->impl(), aBndBox ); + aBndBox.Get( aXmin, aYmin, aZmin, aXmax, aYmax, aZmax ); + aDeflection = MAX3( aXmax-aXmin, aYmax-aYmin, aZmax-aZmin ) * theDeflection; } //Compute triangulation - BRepMesh_IncrementalMesh aMesh( aCopyShape, lDeflection ); + BRepTools::Clean( aCopyShape ); + BRepMesh_IncrementalMesh aMesh( aCopyShape, aDeflection ); + if (!aWriter.Write( aCopyShape, theFileName.c_str())) { theError = "STL Export failed"; return false;