[vtkusers] FW: invalid vtkSource Pointer from vtkActor

David Doria daviddoria at gmail.com
Fri Sep 9 11:43:59 EDT 2011


On Fri, Sep 9, 2011 at 11:33 AM, Luigi Laneve <luigi_laneve at hotmail.com> wrote:
> I've verified that if i try to extract the vtkSource object (SS) immediatly
> after the sphere "source-mapper-actor" definition
> it result a NULL pointer.
> See the following instructions:
> -----
> vtkSphereSource *sphere=vtkSphereSource::New();
> sphere->SetRadius(radius);
> sphere->SetCenter(pf[0],pf[1],pf[2]);
> vtkPolyDataMapper *mapper_sphere = vtkPolyDataMapper ::New();
> mapper_sphere->SetInput(sphere->GetOutput());
> vtkActor *actor_sphere = vtkActor::New();
> actor_sphere->SetMapper(mapper_sphere);
> actor_sphere->GetProperty()->SetColor(1.,0.,0.);
>
> actor_sphere->PickableOff();
> renderer->AddActor(actor_sphere);
> vtkMapper* map = actor_sphere->GetMapper();
>
> vtkSource* SS = map->GetInput()->GetSource();  SS is already NULL at this
> point!!!!!!!!!
> -----
> Any suggestion?

Try calling
	sphere->Update()
after
	sphere->SetCenter(pf[0],pf[1],pf[2]);

David



More information about the vtkusers mailing list