<DIV>Just so let you know. I finally derived my own actor class with your method. </DIV>
<DIV>&nbsp;</DIV>
<DIV>However, I made some changes to your class to make it compile in my application(VC6.0&amp;MFC)</DIV>
<DIV>&nbsp;</DIV>
<DIV>1) I have to change the super class from vtkActor to vtkOpenGLActor. Otherwise, the render window won't render. I don't know why.</DIV>
<DIV>&nbsp;</DIV>
<DIV>2) I change the new method to</DIV>
<DIV>vtkMyActor* vtkMyActor::New() {<BR>&nbsp;vtkObject* ret = vtkObjectFactory::CreateInstance("vtkActor");<BR>&nbsp;if(ret)<BR>&nbsp;&nbsp;{<BR>&nbsp;&nbsp;return (vtkMyActor*)ret;<BR>&nbsp;&nbsp;}<BR>&nbsp;return (vtkMyActor*) new vtkMyActor;<BR>}</DIV>
<DIV>&nbsp;</DIV>
<DIV>Thank for your help!</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Luke</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>On 08.03.2004, at 21:19, Luke Hua wrote:<BR><BR>&gt; Is there any way to retrieve actor by ID or properties? My renderer <BR>&gt; has various kind of actors and I need to delete and add them <BR>&gt; dynamically. It's very difficult to track the position of actors using <BR>&gt; Initialtraversal().<BR>&gt; <BR>&gt; There is no return values for addActor(). Could vtk make some changes <BR>&gt; so that the addActor() can return a ID for each actor therefore easier <BR>&gt; to retrieve actors?<BR>&gt; <BR>&gt; Or there is any other way to retrieve actors?<BR><BR>You can extend vtkActor to have an ID. Did that and it works <BR>flawlessly. Just use the extended vtkActor instead of the original. <BR>When your picker/renderer returns an actor you can get the ID easily. <BR>If you don't want to set that ID yourself you can add a static variable <BR>that "counts" actors, i.e. it has to be incremented inside the New() <BR>method, then set the ID accordingly.<BR><BR><BR>vtkMyActor.h looks
 like this:<BR><BR>#ifndef MYACT_H<BR>#define MYACT_H<BR><BR>#include &lt;vtkActor.h&gt;<BR><BR>class vtkMyActor : public vtkActor {<BR>&nbsp;&nbsp;&nbsp; public:<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; int GetID();<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; void SetID(int id);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; static vtkMyActor* New();<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; void Delete();<BR><BR>&nbsp;&nbsp;&nbsp; private:<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; int id;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // id of this glyph's actor<BR><BR>};<BR>#endif<BR><BR><BR><BR>vtkMyActor.cc looks like this:<BR><BR>#include "vtkMyActor.h"<BR><BR>vtkMyActor* vtkMyActor::New() {<BR>&nbsp;&nbsp;&nbsp; vtkActor::New();<BR>}<BR><BR>void vtkMyActor::Delete() {<BR>&nbsp;&nbsp;&nbsp; vtkActor::Delete();<BR>}<BR><BR>int vtkMyActor::GetID() {<BR>&nbsp;&nbsp;&nbsp; return this-&gt;id;<BR>}<BR><BR>void vtkMyActor::SetID(int id) {<BR>&nbsp;&nbsp;&nbsp; this-&gt;id = id;<BR>}<BR><BR><BR>Hope
 that helps...<BR><BR>Ciao!<BR>&nbsp;&nbsp;&nbsp; Wiebke<BR><BR>_______________________________________________<BR>This is the private VTK discussion list. <BR>Please keep messages on-topic. Check the FAQ at: &lt;<A href="http://public.kitware.com/cgi-bin/vtkfaq">http://public.kitware.com/cgi-bin/vtkfaq</A>&gt;<BR>Follow this link to subscribe/unsubscribe:<BR><A href="http://www.vtk.org/mailman/listinfo/vtkusers">http://www.vtk.org/mailman/listinfo/vtkusers</A></DIV><p><font face=arial size=-1>Do you Yahoo!?<br>
<a href="http://taxes.yahoo.com/filing.html"><b>Yahoo! Finance Tax Center</a></b> - File online. File on time.