[vtkusers] Modifying sphere radius from actor

Kenneth Evans, Jr. evans at aps.anl.gov
Sat May 17 09:01:51 EDT 2008


Andrea,

>> If you are on Windows, you should see something printed in the command
window when you press whatever key you want.

Nothing happened when I pressed any keys.  I noticed later that I got all
the output when the program closes.  I am not experienced with events in VTK
(but wouldn't mind learning).  It turned out this was actually because
stdout wasn't being flushed, not the events.  (I wasn't running it directly
from a console.)  My fault, but I haven't had trouble before with printing
debug statements.

However, in looking at things now that I can print, what I find is that:

vtkPloyDataMapper.GetInput is a vtkPolyData which is a vtkDataObject
which has a GetSouce which returns a vtkSource
but a vtkSphereSource is not a vtkSource

So I would not expect this to work, or at least not be surprised that it
isn't.  (Assuming I did all the tracing right ;-)

In any event, if you print the vtkPolyDataMapper.GetInput() when it is
created, then the source is None at that time.  You can't even use SetSource
because the vtkSphereSource is not a vtkSource.

>> The main problem is not the colour, ...

I understand.  However, I don't then know exactly what you are trying to
accomplish.  It looks as though you are trying to change the sphere.  Why
not keep a reference to the sphere (which you have to do anyway to keep it
from being garbage collected) instead of (or in addition to) the
sphereMapper?  It does look to me as though this approach won't work.

        -Ken




More information about the vtkusers mailing list