<div dir="ltr">Hi,<div><br></div><div><br></div><div>I create a sphere like this:</div><div><br></div><div><pre style="margin-top:0px;margin-bottom:0px">VTK_CREATE<span style="color:rgb(0,0,0)">(</span><span style="color:rgb(128,0,128)">vtkSphereSource</span><span style="color:rgb(0,0,0)">,</span><span style="color:rgb(192,192,192)"> </span>sphereSource<span style="color:rgb(0,0,0)">);</span></pre>

<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span>sphereSource<span style="color:rgb(0,0,0)">-&gt;</span>SetCenter<span style="color:rgb(0,0,0)">(</span><span style="color:rgb(0,0,0)">pos</span><span style="color:rgb(0,0,0)">[</span><span style="color:rgb(0,0,128)">0</span><span style="color:rgb(0,0,0)">],</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">pos</span><span style="color:rgb(0,0,0)">[</span><span style="color:rgb(0,0,128)">1</span><span style="color:rgb(0,0,0)">],</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">pos</span><span style="color:rgb(0,0,0)">[</span><span style="color:rgb(0,0,128)">2</span><span style="color:rgb(0,0,0)">]);</span></pre>

<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span>sphereSource<span style="color:rgb(0,0,0)">-&gt;</span>SetRadius<span style="color:rgb(0,0,0)">(</span><span style="color:rgb(0,0,128)">10.0</span><span style="color:rgb(0,0,0)">);</span></pre>

<pre style="margin-top:0px;margin-bottom:0px"></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span><span style="color:rgb(0,128,0)">//Create</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">a</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">mapper</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">and</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">actor</span></pre>

<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span><span style="color:rgb(128,0,128)">vtkSmartPointer</span><span style="color:rgb(0,0,0)">&lt;</span><span style="color:rgb(128,0,128)">vtkPolyDataMapper</span><span style="color:rgb(0,0,0)">&gt;</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">mapper</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">=</span></pre>

<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">            </span><span style="color:rgb(128,0,128)">vtkSmartPointer</span><span style="color:rgb(0,0,0)">&lt;</span><span style="color:rgb(128,0,128)">vtkPolyDataMapper</span><span style="color:rgb(0,0,0)">&gt;::</span>New<span style="color:rgb(0,0,0)">();</span></pre>

<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span><span style="color:rgb(0,0,0)">mapper</span><span style="color:rgb(0,0,0)">-&gt;</span><span style="font-style:italic;color:rgb(0,0,0)">SetInputConnection</span><span style="color:rgb(0,0,0)">(</span>sphereSource<span style="color:rgb(0,0,0)">-&gt;</span>GetOutputPort<span style="color:rgb(0,0,0)">());</span></pre>

<pre style="margin-top:0px;margin-bottom:0px"></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span><span style="color:rgb(128,0,128)">vtkSmartPointer</span><span style="color:rgb(0,0,0)">&lt;</span><span style="color:rgb(128,0,128)">vtkActor</span><span style="color:rgb(0,0,0)">&gt;</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">actor</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">=</span></pre>

<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">            </span><span style="color:rgb(128,0,128)">vtkSmartPointer</span><span style="color:rgb(0,0,0)">&lt;</span><span style="color:rgb(128,0,128)">vtkActor</span><span style="color:rgb(0,0,0)">&gt;::</span>New<span style="color:rgb(0,0,0)">();</span></pre>

<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span><span style="color:rgb(0,0,0)">actor</span><span style="color:rgb(0,0,0)">-&gt;</span><span style="font-style:italic;color:rgb(0,0,0)">SetMapper</span><span style="color:rgb(0,0,0)">(</span><span style="color:rgb(0,0,0)">mapper</span><span style="color:rgb(0,0,0)">);</span></pre>

<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span><span style="color:rgb(0,0,0)">actor</span><span style="color:rgb(0,0,0)">-&gt;</span>GetProperty<span style="color:rgb(0,0,0)">()-&gt;</span>SetColor<span style="color:rgb(0,0,0)">(</span><span style="color:rgb(0,0,128)">0</span><span style="color:rgb(0,0,0)">,</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,128)">0</span><span style="color:rgb(0,0,0)">,</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,128)">1</span><span style="color:rgb(0,0,0)">);</span></pre>

<pre style="margin-top:0px;margin-bottom:0px"></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span><span style="color:rgb(0,128,0)">//this-&gt;GetInteractor()-&gt;GetRenderWindow()-&gt;GetRenderers()-&gt;GetDefaultRenderer()-&gt;AddActor(actor);</span></pre>

<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span><span style="color:rgb(128,128,0)">this</span><span style="color:rgb(0,0,0)">-&gt;</span><span style="color:rgb(128,0,0)">m_viewer2</span><span style="color:rgb(0,0,0)">-&gt;</span><span style="font-style:italic;color:rgb(0,0,0)">GetRenderer</span><span style="color:rgb(0,0,0)">()-&gt;</span>AddActor<span style="color:rgb(0,0,0)">(</span><span style="color:rgb(0,0,0)">actor</span><span style="color:rgb(0,0,0)">);</span></pre>

<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span><span style="color:rgb(128,128,0)">this</span><span style="color:rgb(0,0,0)">-&gt;</span><span style="color:rgb(128,0,0)">m_viewer2</span><span style="color:rgb(0,0,0)">-&gt;</span><span style="font-style:italic;color:rgb(0,0,0)">Render</span><span style="color:rgb(0,0,0)">();</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(0,0,0)"><br></span></pre><pre style="margin-top:0px;margin-bottom:0px"><font color="#000000" face="arial, helvetica, sans-serif">Later I want to find this sphere in another function and delete it. How can I do that? I saw vtkPolyDataCollection, is this the right one I need to get?</font></pre>
<pre style="margin-top:0px;margin-bottom:0px"><font color="#000000" face="arial, helvetica, sans-serif"><br></font></pre><pre style="margin-top:0px;margin-bottom:0px"><font color="#000000" face="arial, helvetica, sans-serif"><br>
</font></pre><pre style="margin-top:0px;margin-bottom:0px"><font color="#000000" face="arial, helvetica, sans-serif">Thanks,</font></pre><pre style="margin-top:0px;margin-bottom:0px"><font color="#000000" face="arial, helvetica, sans-serif">Julio</font></pre>
</div></div>