<div class="gmail_quote">2011/3/16 David Doria <span dir="ltr"><<a href="mailto:daviddoria@gmail.com">daviddoria@gmail.com</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div class="gmail_quote"><div><div></div><div class="h5">2011/3/16 Dženan Zukić <span dir="ltr"><<a href="mailto:dzenanz@gmail.com" target="_blank">dzenanz@gmail.com</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<font size="2"><font face="verdana,sans-serif"><div>Hi all,</div><div><br></div><div>I want to remove (and delete to free the memory) all polygonal actors, but leaving the volume in the scene. This is my attempt:</div><div>
<br></div><div><div>void MainWindow::on_actionClear_polygonal_data_activated()</div><div>{</div><div> vtkPropCollection *props=vis->GetRenderWindow()->GetRenderers()->GetFirstRenderer()->GetViewProps();</div>
<div> for (int i=props->GetNumberOfItems()-1; i>=0; i--)</div><div> if (!props[i].IsTypeOf("vtkVolume")) //vtkObjectBase both volume and polyogonal</div><div> props->RemoveItem(i);</div>
<div> vis->GetRenderWindow()->Render();</div><div>}</div></div><div><br></div><div>However this also removes the volume. I have a feeling the problem is in some small detail. Do you have any suggestions?</div><div>
<br></div><div>Regards,</div><div>Dženan</div><div><br></div></font></font></blockquote><div><br></div></div></div><div>Did you try outputting GetClassName() for the props that are deleted?</div><div><br></div><div>You could also try the IsA() function.</div>
<div><br></div><div>Even better, try to downcast (SafeDownCast()) to a vtkVolume. If the cast succeeds, do not delete the object.</div><div class="gmail_quote"><br></div>Let us know how it goes.</div><div class="gmail_quote">
<br><font color="#888888">David</font></div>
</blockquote></div>Executing GetClassName() crashes the program. I will try IsA() tomorrow when I get back to university.<div><br></div><div>Thanks for taking interest.</div>