1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-04 13:13:25 +03:00

0027561: Since OCCT 7.0.0, exporting a curve to STL creates a file that results in an endless loop when read

Add check for empty triangulation when writing STL file to report error instead of creation of empty file.

STL reader has been improved to properly handle case of empty or small files, and Ascii files without EOL at the end.
This commit is contained in:
abv
2017-08-15 17:58:53 +03:00
committed by bugmaster
parent d21ddc4f17
commit 22e7073865
5 changed files with 127 additions and 14 deletions

View File

@@ -49,8 +49,11 @@ Standard_Boolean StlAPI_Writer::Write (const TopoDS_Shape& theShape,
{
TopLoc_Location aLoc;
Handle(Poly_Triangulation) aTriangulation = BRep_Tool::Triangulation (TopoDS::Face (anExpSF.Current()), aLoc);
aNbNodes += aTriangulation->NbNodes();
aNbTriangles += aTriangulation->NbTriangles();
if (! aTriangulation.IsNull())
{
aNbNodes += aTriangulation->NbNodes ();
aNbTriangles += aTriangulation->NbTriangles ();
}
}
// create temporary triangulation