-// Copyright (C) 2014-2020 CEA/DEN, EDF R&D
+// Copyright (C) 2014-2023 CEA, EDF
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
try
{
- double lDeflection = theDeflection;
+ double aDeflection = theDeflection;
StlAPI_Writer aWriter;
// copy source shape
BRepBuilderAPI_Copy aCopy( theShape->impl<TopoDS_Shape>(), Standard_False );
aWriter.ASCIIMode() = theIsASCII;
if ( theIsRelative ) {
Standard_Real aXmin, aYmin, aZmin, aXmax, aYmax, aZmax;
- Bnd_Box bndBox;
- BRepBndLib::Add( theShape->impl<TopoDS_Shape>(), 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<TopoDS_Shape>(), 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;