<div dir="ltr">I use this code and it works for that sort of scenario:<div>&nbsp;&nbsp;ren.RemoveAllViewProps()</div><div>&nbsp;&nbsp;ren.ResetCamera()</div><div>&nbsp;&nbsp;renWin.Render()</div><div><br></div><div>&nbsp;&nbsp;# ...code to add all new actors to &quot;ren&quot; omitted...</div>
<div><br></div><div>&nbsp;&nbsp;ren.ResetCamera()</div><div>&nbsp;&nbsp;renWin.Render()<br><br></div><div><br></div><div>ren and renWin are the same all the way through... Are you sure that your self.renderer, self.screen.GetRenderWindow() and self.screen objects are remaining constant throughout this? Is there something else changing state or swapping objects during your self.visitor.load_system() call?? Or is it really just adding new actors to self.renderer??</div>
<div><br></div><div><br></div><div>HTH,</div><div>David</div><div><br></div><div><br><div class="gmail_quote">On Thu, Aug 7, 2008 at 1:00 PM, Deacon Sweeney <span dir="ltr">&lt;<a href="mailto:sweeney.2@wright.edu">sweeney.2@wright.edu</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">Hi all,<br>
<br>
I would like my users to be able to load a visualization then unload it<br>
and load new data. Currently, if a user loads a new file the old<br>
visualization stays up, usually with missing data points, but the<br>
coordinates are the same as the old data. I&#39;ve tried a wide variety of<br>
approaches and all either reload, or they crash the program (Finalize<br>
and None for addRenderer). Here is my current minimalist approach<br>
(doesn&#39;t work but doesn&#39;t crash), with some alternative approaches<br>
commented out. This is all Python, using Enthought&#39;s Python distribution<br>
with VTK <a href="http://5.0.3." target="_blank">5.0.3.</a><br>
<br>
 &nbsp; &nbsp; &nbsp; &nbsp;# manually remove any actors previously created<br>
 &nbsp; &nbsp; &nbsp; &nbsp;#actors = self.renderer.GetActors()<br>
 &nbsp; &nbsp; &nbsp; &nbsp;#actors.InitTraversal()<br>
 &nbsp; &nbsp; &nbsp; &nbsp;#last = actors.GetLastActor()<br>
 &nbsp; &nbsp; &nbsp; &nbsp;#actor = actors.GetNextActor()<br>
 &nbsp; &nbsp; &nbsp; &nbsp;#while actor != last:<br>
 &nbsp; &nbsp; &nbsp; &nbsp;# &nbsp; &nbsp;self.renderer.RemoveActor(actor)<br>
 &nbsp; &nbsp; &nbsp; &nbsp;# &nbsp; &nbsp;actor = actors.GetNextActor()<br>
 &nbsp; &nbsp; &nbsp; &nbsp;#self.renderer.RemoveActor(last)<br>
<br>
 &nbsp; &nbsp; &nbsp; &nbsp;# instead just removeallviewprops.<br>
 &nbsp; &nbsp; &nbsp; &nbsp;#does this do the same thing as above?<br>
 &nbsp; &nbsp; &nbsp; &nbsp;self.renderer.RemoveAllViewProps()<br>
<br>
 &nbsp; &nbsp; &nbsp; &nbsp;# try removing the renderer and re-make it with:<br>
 &nbsp; &nbsp; &nbsp; &nbsp;#self.screen.GetRenderWindow().RemoveRenderer(self.renderer)<br>
<br>
 &nbsp; &nbsp; &nbsp; &nbsp;# &nbsp;a new renderer,<br>
 &nbsp; &nbsp; &nbsp; &nbsp;#del self.renderer<br>
 &nbsp; &nbsp; &nbsp; &nbsp;#self.renderer = vtk.vtkRenderer()<br>
 &nbsp; &nbsp; &nbsp; &nbsp;#self.screen.GetRenderWindow().AddRenderer(self.renderer)<br>
<br>
 &nbsp; &nbsp; &nbsp; &nbsp;# or with no renderer<br>
 &nbsp; &nbsp; &nbsp; &nbsp;#self.screen.GetRenderWindow().AddRenderer(None)<br>
<br>
 &nbsp; &nbsp; &nbsp; &nbsp;# try the Finalize method even though it is virtual in<br>
vtkRenderWindow<br>
 &nbsp; &nbsp; &nbsp; &nbsp;#self.screen.GetRenderWindow().Finalize()<br>
<br>
 &nbsp; &nbsp; &nbsp; &nbsp;# try Clear()?<br>
 &nbsp; &nbsp; &nbsp; &nbsp;#self.renderer.Clear()<br>
<br>
 &nbsp; &nbsp; &nbsp; &nbsp;# remake if needed<br>
 &nbsp; &nbsp; &nbsp; &nbsp;#self.renderer = vtk.vtkRenderer()<br>
 &nbsp; &nbsp; &nbsp; &nbsp;#self.screen.GetRenderWindow().AddRenderer(self.renderer)<br>
<br>
 &nbsp; &nbsp; &nbsp; &nbsp;self.visitor.load_system(system, 0) &nbsp; # creates new Actors for<br>
renderer<br>
 &nbsp; &nbsp; &nbsp; &nbsp;self.renderer.ResetCamera()<br>
 &nbsp; &nbsp; &nbsp; &nbsp;self.screen.Render()<br>
<br>
And nothing works.<br>
<br>
I&#39;m surprised that I can&#39;t find anything on this apparent bug online<br>
(aside for the RemoveAllViewProps suggestion which doesn&#39;t work), and I<br>
hope its just a simple omission on my part and not a real bug. Thanks.<br>
<br>
Deacon<br>
_______________________________________________<br>
This is the private VTK discussion list.<br>
Please keep messages on-topic. Check the FAQ at: <a href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.vtk.org/mailman/listinfo/vtkusers" target="_blank">http://www.vtk.org/mailman/listinfo/vtkusers</a><br>
</blockquote></div><br></div></div>