[vtkusers] Getting the number of polygons

Jenny Simpson simpson at cs.utah.edu
Tue Jan 6 13:43:17 EST 2004


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




More information about the vtkusers mailing list