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()