[vtkusers] Dynamic Object Creation

Helvin Lui helvinlui at gmail.com
Sat Sep 12 18:00:16 EDT 2009


To fellow vtk users,
I am stuck on this, and wonder if anyone has any tricks up their sleeves to
solve this.

I would like to create objects on the fly. Specifically, I want to create
sphere actors on the points that the user picks in my displayed mesh. At the
moment, my EndPickEvent function is a bit like this, where picked_node
stores the picked node number:

dynamicName = 'infoText%s' %picked_node   # Make the name dynamic, and
numbered according to the picked node. E.g label = infoText1
 print 'dynamicNAme before: ',dynamicName
dynamicName = vtk.vtkVectorText()
 print 'dynamicNAme after: ', dynamicName

I want to make an actor with the dynamic name, but when I create the
VectorText, it is called dynamicName, and not the string that I assigned to
dynamicName. I understand why this doesn't work, but how do I make it work?

Do you know how I can achieve this?

Thanks so much!
-- 
Helvin

Tags: dynamically create objects in vtk dynamic actors creation on the fly
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20090913/f5d406d3/attachment.htm>


More information about the vtkusers mailing list