From: vsr Date: Wed, 11 Feb 2015 15:06:56 +0000 (+0300) Subject: Compatibility with OCCT dev version X-Git-Tag: V7_6_0a1~49 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=4bad0df2382016bd84f1e2a6e5689e1c827f6aa6;hp=9680031be017f475ebb1d506a72b9527f5ce70b3;p=modules%2Fgeom.git Compatibility with OCCT dev version --- diff --git a/src/STLPlugin/STLPlugin_ExportDriver.cxx b/src/STLPlugin/STLPlugin_ExportDriver.cxx index 7d02d6f8f..41130de41 100644 --- a/src/STLPlugin/STLPlugin_ExportDriver.cxx +++ b/src/STLPlugin/STLPlugin_ExportDriver.cxx @@ -24,6 +24,7 @@ // KERNEL includes #include #include +#include // GEOM includes #include "GEOM_Function.hxx" @@ -32,6 +33,13 @@ #include #include #include +#include +#include +#include +#include + +#define MAX2(X, Y) ( Abs(X) > Abs(Y) ? Abs(X) : Abs(Y) ) +#define MAX3(X, Y, Z) ( MAX2 ( MAX2(X, Y) , Z ) ) //======================================================================= //function : GetID @@ -84,15 +92,31 @@ Standard_Integer STLPlugin_ExportDriver::Execute( TFunction_Logbook& log ) const try { StlAPI_Writer aWriter; + // copy source shape + BRepBuilderAPI_Copy aCopy( aShape, Standard_False ); + TopoDS_Shape aCopyShape = aCopy.Shape(); + // ASCII mode + aWriter.ASCIIMode() = anIsASCII; +#if OCC_VERSION_LARGE > 0x06080000 + if ( anIsRelative ) { + Standard_Real aXmin, aYmin, aZmin, aXmax, aYmax, aZmax; + Bnd_Box bndBox; + BRepBndLib::Add( aShape, bndBox ); + bndBox.Get( aXmin, aYmin, aZmin, aXmax, aYmax, aZmax ); + aDeflection = MAX3( aXmax-aXmin, aYmax-aYmin, aZmax-aZmin ) * aDeflection; + } + //Compute triangulation + BRepTools::Clean( aCopyShape ); + BRepMesh_IncrementalMesh aMesh( aCopyShape, aDeflection ); +#else // set relative mode on false for using custom deflection coefficient aWriter.RelativeMode( ) = anIsRelative; - aWriter.ASCIIMode() = anIsASCII; if( anIsRelative ) aWriter.SetCoefficient( aDeflection ); else aWriter.SetDeflection( aDeflection ); - BRepBuilderAPI_Copy aCopy( aShape, Standard_False ); - aWriter.Write( aCopy.Shape(), aFileName.ToCString() ); +#endif + aWriter.Write( aCopyShape, aFileName.ToCString() ); log.SetTouched( Label() ); return 1; }