Hi Hal, thanks for your quick reply and the example code. That's very helpful. I do have these remaining questions that perhaps you could help me with:<div><ul><li>In your experience, is a programmable source a suitable place to call a potentially long running finite element code?</li>
<li>Is it possible to update the data structure while it is already being displayed, that is, before the script finishes?</li>
<li>And is it possible to have a programmable source output multiple data sets if necessary?</li></ul>
<div>Thanks again!</div><div>Gertjan</div><br><br><div class="gmail_quote">On Tue, Jun 19, 2012 at 12:44 PM, Hal Canary <span dir="ltr"><<a href="mailto:hal@cs.unc.edu" target="_blank">hal@cs.unc.edu</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On 06/19/2012 06:10 AM, Gertjan van Zwieten wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
[...]<div><br>
So my question is simply if it is possible to inject objects from python<br>
into an already running or separately spawned paraview instance? If so,<br>
any pointers in that direction (an example script?) would of course be<br>
enormously helpful.<br>
</div></blockquote>
<br>
I use a programmable source. Here's a macro to create an image:<br>
<br>
#####################<br>
script="""<br>
image = self.GetImageDataOutput()<br>
image.SetSpacing(0.01,0.01,0.<u></u>01)<br>
image.SetOrigin(0,0,0)<br>
image.SetDimensions(101,101,<u></u>101)<br>
array = numpy.zeros((101,101,101,), dtype=numpy.float32)<br>
space = numpy.linspace(0,1,101)<br>
for i,x in enumerate(space):<br>
for j,y in enumerate(space):<br>
for k,z in enumerate(space):<br>
array[i,j,k] = (math.sin(4*x)<br>
+ math.sin(4*y) + math.sin(4*z))<br>
image.GetPointData().AddArray(<br>
paraview.vtk.dataset_adapter.<u></u>numpyTovtkDataArray(<br>
array.reshape(101*101*101), name="myarray"))<br>
"""<br>
script_request_information = """<br>
from paraview import util<br>
util.SetOutputWholeExtent(<u></u>self, [0, 100, 0, 100, 0, 100])<br>
"""<br>
ps = ProgrammableSource(<br>
guiName="My Source",<br>
Script=script,<br>
ScriptRequestInformation=<u></u>script_request_information,<br>
OutputDataSetType='<u></u>vtkImageData' )<br>
Show(ps)<br>
##############################<u></u>#####<br>
______________________________<u></u>_________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/<u></u>opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the ParaView Wiki at: <a href="http://paraview.org/Wiki/ParaView" target="_blank">http://paraview.org/Wiki/<u></u>ParaView</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.paraview.org/mailman/listinfo/paraview" target="_blank">http://www.paraview.org/<u></u>mailman/listinfo/paraview</a><br>
</blockquote></div><br>
</div>