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

Jens Schmidt jens.g.w.schmidt at gmx.de
Mon Feb 27 15:29:00 EST 2017


Hi there,

you might consider v-hacd https://github.com/kmammou/v-hacd
for the decimation purpose (you'll love it).

For the other question, you could probably connect the DecimatePro 
output to a vtkSTLWriter. 
http://www.vtk.org/doc/nightly/html/classvtkSTLWriter.html

Cheers Jens


Am 27.02.2017 um 11:54 schrieb drslump scientist:
> 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
>
>
>
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
>
> Search the list archives at: http://markmail.org/search/?q=vtkusers
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/vtkusers
>


More information about the vtkusers mailing list