Assuming we have an .stl
file under filenameSTL
we can load the contents of that file using the vtkSTLReader
class as such:
readerSTL = vtk.vtkSTLReader()
readerSTL.SetFileName(filenameSTL)
# 'update' the reader i.e. read the .stl file
readerSTL.Update()
polydata = readerSTL.GetOutput()
# If there are no points in 'vtkPolyData' something went wrong
if polydata.GetNumberOfPoints() == 0:
raise ValueError("No point data could be loaded from '" + filenameSTL)
how can i get no of triangles on a mesh ?