[vtkusers] How to get a pointer to the instance of vtk***Source from vtkActor

ohsuga at nucl.phys.titech.ac.jp ohsuga at nucl.phys.titech.ac.jp
Tue Apr 4 05:07:49 EDT 2006


Hi Kjeld,

Thanks for your answer. But It seems I can not get a pointer to the
instance of vtkSphereSource.

When the following lines are added at the very end of the sample, 
---
vktSphereSource* sphSource =
(vtkSphereSource*)Actor->GetMapper()->GetInputAsDataSet()->GetSource();
    sphSource->SetPhiResolution(10);
---
I encounterd a Null pointer exception.
I did something wrong?

Thanks,
Masa


> hi Masa
> 
> Her you got it
> 
> sphSource = (vtkSphereSource
*)Actor->GetMapper()->GetInputAsDataSet()->GetSource();
> 
> Best regards Kjeld
> 
> > Dear all,
> >
> > In the following example,
> > I'd like to get a pointer to the instance of vtkSphereSource class from a
> > pointer to the instance of vtkActor class.
> > How Can I do this?
> > I mean I only know sphereActor and would like to reset the PhiResolution of
> > sphere.
> > -----------------------------------------------------------
> > vtkSphereSource* sphere = vtkSphereSource::New();
> >     sphere->SetRadius(3);
> >     sphere->SetPhiResolution(10);
> >     sphere->SetThetaResolution(10);
> > vtkPolyDataMapper* sphereMapper = vtkPolyDataMapper::New();
> >     sphereMapper->SetInput(sphere->GetOutput());
> > vtkActor* sphereActor = vtkActor::New();
> >     sphereActor->SetMapper(sphereMapper);
> > ------------------------------------------------------------
> >
> > Thank you very much in advance.
> >
> > Cheers,
> > Masa
> > --
> > ohsuga at nucl.phys.titech.ac.jp
> > _______________________________________________
> > This is the private VTK discussion list.
> > Please keep messages on-topic. Check the FAQ at:
http://www.vtk.org/Wiki/VTK_FAQ
> > Follow this link to subscribe/unsubscribe:
> > http://www.vtk.org/mailman/listinfo/vtkusers
> >
> 
> 
> _______________________________________________
> This is the private VTK discussion list. 
> Please keep messages on-topic. Check the FAQ at:
http://www.vtk.org/Wiki/VTK_FAQ
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
> 

-- 
ohsuga at nucl.phys.titech.ac.jp



More information about the vtkusers mailing list