[vtkusers] Extract points and polygons for a mesh using VTK

drslump scientist drslump.scientist at outlook.com
Mon Feb 27 05:54:18 EST 2017


Hello,


I want to reduce the number of triangles in a mesh (STL file). Here is my code:

import vtk

filename = 'E://stl_file.stl'
reader = vtk.vtkSTLReader()
reader.SetFileName('filename.stl')

##convert polygonal mesh into triangle mesh
tri = vtk.vtkTriangleFilter()
tri.SetInputConnection(reader.GetOutputPort());

##decimate triangle
deci = vtk.vtkDecimatePro()
deci.SetInputConnection(tri.GetOutputPort())
deci.SetTargetReduction(0.9)
deci.PreserveTopologyOn()

it seems to work (at least it runs without errors). Now how can I extract points and triangles of the mesh?


Regards

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20170227/883cf537/attachment.html>


More information about the vtkusers mailing list