[vtkusers] Getting the number of polygons

Berk Geveci berklist at nycap.rr.com
Tue Jan 6 13:50:48 EST 2004


You are calling GetNumberOfPolys before the filter executes. The
execution of the filter is caused by the first render. Try adding
$pdnormals Update
before you get the number of polygons.

-Berk

On Tue, 2004-01-06 at 13:43, Jenny Simpson wrote:
> I want to find the number of polygons in dataset I'm rendering in Vtk.
> I'm using the Tcl version of the vtkPolyData GetNumberOfPolys function to
> try to get the number of polygons, but I always get a count of zero, so
> I must be doing something wrong.  I also get a count of zero for
> all the other GetNumberOf* functions.  Any ideas?
> Here's the code I'm using:
> 
> ---------------------------------------------------------------
> 
> vtkPolyDataReader $pdreader
>   $pdreader SetFileName $fileName
> vtkDecimatePro $deci
>     $deci SetInput [$pdreader GetOutput]
>     $deci SetTargetReduction 0.9
>     $deci PreserveTopologyOn
> vtkPolyDataNormals $pdnormals
>     $pdnormals SetInput [$pdreader GetOutput]
>     $pdnormals FlipNormalsOn
> 
> # Print the number of polygons
> set numPolygons [ [$pdreader GetOutput] GetNumberOfPolys ]
> puts "(makeSurfaceViewer) number of polygons = $numPolygons"
> 
> ------------------------------------------------------------------
> 
> Thanks,
> 
> Jenny Simpson
> Scientific Computing and Imaging Institute
> University of Utah
> 
> _______________________________________________
> This is the private VTK discussion list. 
> Please keep messages on-topic. Check the FAQ at: <http://public.kitware.com/cgi-bin/vtkfaq>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
-- 
Berk Geveci <berklist at nycap.rr.com>




More information about the vtkusers mailing list