[vtkusers] Question about vtkPolyData::GetNumberOfPoints()

David Doria daviddoria at gmail.com
Fri Nov 25 07:10:24 EST 2011


On Fri, Nov 25, 2011 at 3:21 AM, ysa0829 <ysa0829 at gmail.com> wrote:
> I use a filter that Inherit vtkPolyDataAlgorithm,then I try to get the
> output's number of points ,but It would be zero. It my example code:
>
> /vtkCylinderSource *implantCylinderSource = vtkCylinderSource::New();
>
>        implantCylinderSource->SetCenter(0,0,0);
>        implantCylinderSource->SetRadius(2);
>        implantCylinderSource->SetHeight(10);
>        implantCylinderSource->SetResolution(36);
>        implantCylinderSource->CappingOn();
>        implantCylinderSource->Update();
>
>
> vtkTriangleFilter * tri2 = vtkTriangleFilter::New();
> tri2 ->SetInput(implantCylinderSource ->GetOutput());
>
> int numberOfPoints = tri2->GetOutput()->GetNumberOfPoints();
> /
>
> I can see the result in my renderer,but the numberOfPoints is Zero.
>
> Is anyway to get numberofpoints ? ,or Get the Polydata's Points that I can
> modify.
>
> Thanks and regards,
> Anne.

Try calling tri2->Update() before trying to get the number of points.

David



More information about the vtkusers mailing list