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:
- In your experience, is a programmable source a suitable place to call a potentially long running finite element code? - Is it possible to update the data structure while it is already being displayed, that is, before the script finishes? - And is it possible to have a programmable source output multiple data sets if necessary? Thanks again! Gertjan On Tue, Jun 19, 2012 at 12:44 PM, Hal Canary <[email protected]> wrote: > 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<http://www.kitware.com/opensource/opensource.html> > > Please keep messages on-topic and check the ParaView Wiki at: > http://paraview.org/Wiki/**ParaView <http://paraview.org/Wiki/ParaView> > > Follow this link to subscribe/unsubscribe: > http://www.paraview.org/**mailman/listinfo/paraview<http://www.paraview.org/mailman/listinfo/paraview> >
_______________________________________________ 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
