Skip to content
Snippets Groups Projects
Commit f128c29d authored by Ben Boeckel's avatar Ben Boeckel Committed by Code Review
Browse files

Merge topic 'stl-writer-errors' into master

9a00db82 STLWriter: Raise an error for non-triangles
parents 2e101a79 9a00db82
No related branches found
No related tags found
No related merge requests found
......@@ -113,6 +113,14 @@ void vtkSTLWriter::WriteAsciiSTL(vtkPoints *pts, vtkCellArray *polys)
//
for (polys->InitTraversal(); polys->GetNextCell(npts,indx); )
{
if (npts > 3)
{
fclose(fp);
vtkErrorMacro(<<"STL file only supports triangles");
this->SetErrorCode(vtkErrorCode::FileFormatError);
return;
}
pts->GetPoint(indx[0],v1);
pts->GetPoint(indx[1],v2);
pts->GetPoint(indx[2],v3);
......@@ -217,6 +225,14 @@ void vtkSTLWriter::WriteBinarySTL(vtkPoints *pts, vtkCellArray *polys)
//
for (polys->InitTraversal(); polys->GetNextCell(npts,indx); )
{
if (npts > 3)
{
fclose(fp);
vtkErrorMacro(<<"STL file only supports triangles");
this->SetErrorCode(vtkErrorCode::FileFormatError);
return;
}
pts->GetPoint(indx[0],v1);
pts->GetPoint(indx[1],v2);
pts->GetPoint(indx[2],v3);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment