<meta http-equiv="content-type" content="text/html; charset=utf-8"><div class="gmail_quote">2011/3/16 Dženan Zukić <span dir="ltr"><<a href="mailto:dzenanz@gmail.com">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>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>David</div>