[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 09:20:47 EDT 2006


Hi Amy,

Thank you very much for your answer!
I'm using VKT 5.0.
Thanks to your help, I can get a pointer to the instance of vtkSphereSource.

Thanks,
Masa

> Hi Masa,
> 
> What version of VTK are you using?  If you are using VTK 5.0 or the 
> current CVS version, GetSource is likely to return NULL since that 
> was part of the old pipeline structure.  Instead try calling the following.
> 
> vktSphereSource* sphSource = 
>
(vtkSphereSource*)(Actor->GetMapper()->GetInput()->GetProducerPort()->GetProducer());
> sphSource->SetPhiResolution(10);
> 
> - Amy
> 
> At 05:07 AM 4/4/2006, ohsuga at nucl.phys.titech.ac.jp wrote:
> >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
> >_______________________________________________
> >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