[vtkusers] renderer.GetActors() returning 3d actors, but not 2d actors.

Greg Schussman greg.schussman at gmail.com
Fri Sep 12 20:04:25 EDT 2014


Hi.

I'm using python-2.6 and vtk-5.10.1.

I have a renderer, to which I'm adding actors.  Some are 3d actors
(surfaces, sets of cones), and some are 2d actors (filename text,
scalarbar).  To add them, I'm calling:

  self.renderer.AddActor(my_actor)  #  Also tried AddViewProp(my_actor)

They seem to add in ok, and they do get rendered.

However, based on user input, sometimes actors need to be removed and new
ones added.  So I need to take a look at what's already there, which I do
this way:

  c = self.renderer.GetActors()
  c.InitTraversal()
  num_items = c.GetNumberOfItems()
  result = []
  for i in xrange(num_items):
      result.append(c.GetNextActor())

I notice that when I add a 3d actor and I check before/adter, the num_items
increments as expected.

However, when I add 2d actors (ScalarBar, Text), although they also render,
when I check before/after, the num_items does not increment, and they are
not returned in the GetActors() list.

How do I find out which 2d actors are in the renderer, so that I can
optionally remove some of them?

Should I be doing something different?

Thanks.

Greg

p.s.  I've tried calling renderer.GetActors2D(), but then when i try to
call GetNextActor() on that, I get "AttributeError: GetNextActor".
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20140912/5264ccd1/attachment.html>


More information about the vtkusers mailing list