mirror of
https://git.salome-platform.org/gitpub/modules/geom.git
synced 2025-01-13 10:10:34 +05:00
Compatibility with OCCT dev version
This commit is contained in:
parent
9680031be0
commit
4bad0df238
@ -24,6 +24,7 @@
|
|||||||
// KERNEL includes
|
// KERNEL includes
|
||||||
#include <utilities.h>
|
#include <utilities.h>
|
||||||
#include <Basics_Utils.hxx>
|
#include <Basics_Utils.hxx>
|
||||||
|
#include <Basics_OCCTVersion.hxx>
|
||||||
|
|
||||||
// GEOM includes
|
// GEOM includes
|
||||||
#include "GEOM_Function.hxx"
|
#include "GEOM_Function.hxx"
|
||||||
@ -32,6 +33,13 @@
|
|||||||
#include <BRepBuilderAPI_Copy.hxx>
|
#include <BRepBuilderAPI_Copy.hxx>
|
||||||
#include <StlAPI_Writer.hxx>
|
#include <StlAPI_Writer.hxx>
|
||||||
#include <TopoDS_Shape.hxx>
|
#include <TopoDS_Shape.hxx>
|
||||||
|
#include <Bnd_Box.hxx>
|
||||||
|
#include <BRepBndLib.hxx>
|
||||||
|
#include <BRepTools.hxx>
|
||||||
|
#include <BRepMesh_IncrementalMesh.hxx>
|
||||||
|
|
||||||
|
#define MAX2(X, Y) ( Abs(X) > Abs(Y) ? Abs(X) : Abs(Y) )
|
||||||
|
#define MAX3(X, Y, Z) ( MAX2 ( MAX2(X, Y) , Z ) )
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function : GetID
|
//function : GetID
|
||||||
@ -84,15 +92,31 @@ Standard_Integer STLPlugin_ExportDriver::Execute( TFunction_Logbook& log ) const
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
StlAPI_Writer aWriter;
|
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
|
// set relative mode on false for using custom deflection coefficient
|
||||||
aWriter.RelativeMode( ) = anIsRelative;
|
aWriter.RelativeMode( ) = anIsRelative;
|
||||||
aWriter.ASCIIMode() = anIsASCII;
|
|
||||||
if( anIsRelative )
|
if( anIsRelative )
|
||||||
aWriter.SetCoefficient( aDeflection );
|
aWriter.SetCoefficient( aDeflection );
|
||||||
else
|
else
|
||||||
aWriter.SetDeflection( aDeflection );
|
aWriter.SetDeflection( aDeflection );
|
||||||
BRepBuilderAPI_Copy aCopy( aShape, Standard_False );
|
#endif
|
||||||
aWriter.Write( aCopy.Shape(), aFileName.ToCString() );
|
aWriter.Write( aCopyShape, aFileName.ToCString() );
|
||||||
log.SetTouched( Label() );
|
log.SetTouched( Label() );
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user