On 06/19/2012 06:10 AM, Gertjan van Zwieten wrote:
[...]
So my question is simply if it is possible to inject objects from python
into an already running or separately spawned paraview instance? If so,
any pointers in that direction (an example script?) would of course be
enormously helpful.
I use a programmable source. Here's a macro to create an image:
#####################
script="""
image = self.GetImageDataOutput()
image.SetSpacing(0.01,0.01,0.01)
image.SetOrigin(0,0,0)
image.SetDimensions(101,101,101)
array = numpy.zeros((101,101,101,), dtype=numpy.float32)
space = numpy.linspace(0,1,101)
for i,x in enumerate(space):
for j,y in enumerate(space):
for k,z in enumerate(space):
array[i,j,k] = (math.sin(4*x)
+ math.sin(4*y) + math.sin(4*z))
image.GetPointData().AddArray(
paraview.vtk.dataset_adapter.numpyTovtkDataArray(
array.reshape(101*101*101), name="myarray"))
"""
script_request_information = """
from paraview import util
util.SetOutputWholeExtent(self, [0, 100, 0, 100, 0, 100])
"""
ps = ProgrammableSource(
guiName="My Source",
Script=script,
ScriptRequestInformation=script_request_information,
OutputDataSetType='vtkImageData' )
Show(ps)
###################################
_______________________________________________
Powered by www.kitware.com
Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html
Please keep messages on-topic and check the ParaView Wiki at:
http://paraview.org/Wiki/ParaView
Follow this link to subscribe/unsubscribe:
http://www.paraview.org/mailman/listinfo/paraview