We had looked at the programmable source, but we didn't know how to access the 
XDMFReader. But, with what you pointed out, it looks like that isn't hard so 
I'll give it a shot. 

Out of curiosity, what is wrong with the approach I was trying? Is it possible 
to completely copy information from one source in a pipeline into another 
source in a pipeline and delete the original source? Why does Fetch() show data 
inside the DataObjectGenerator but no filter can seem to access it? 

Thanks for the help, 

Tim 

----- Original Message -----
From: "pat marion" <pat.mar...@kitware.com> 
To: gtg0...@mail.gatech.edu 
Cc: paraview@paraview.org 
Sent: Wednesday, February 9, 2011 4:55:05 PM 
Subject: Re: [Paraview] Scripting and new VTK objects 

Hi Tim, 

Have you looked at the python programmable source? With the python programmable 
source you can specify python code to run on the server side. You won't be able 
to use paraview python api though. Instead of 

XDMFReader(FileName=...) 

it would look like: 

reader = vtkXDMFReader() 
reader.SetFileName(...) 
reader.Update() 
data = reader.GetOutput() 

You can find examples of the python programmable source: 

http://www.paraview.org/Wiki/Python_Programmable_Filter#Generating_Data_.28Programmable_Source.29
 
http://www.paraview.org/Wiki/Here_are_some_more_examples_of_simple_ParaView_3_python_filters
 . 

Pat 


On Wed, Feb 9, 2011 at 4:20 PM, Tim Gallagher < tim.gallag...@gatech.edu > 
wrote: 


Hi, 

I've searched online at length for this and couldn't find the answer, so 
hopefully somebody here can help me. 

I am trying to create a new VTK object (vtkMultiBlockDataSet) composed of 
portions of manipulated data from some other VTK object (in this case, a 
vtkStructuredGrid). I then want to delete the vtkStructuredGrid object and 
visualize the new vtkMultiBlockDataSet. 

So, here's the general outline of what I do in a python script: 

newSource = DataGeneratorObject(Program="MB{}") 
newSource.UpdatePipeline() 

newData = servermanager.Fetch(newSource) 
newData.SetNumberOfBlocks(64) 

for n in range(0,64): 
myData = XDMFReader(FileName=...) 
myData.UpdatePipeline() 

localData = servermanager.Fetch(myData) 

<manipulate the data> 

newData.SetBlock(n,vtk.vtkStructuredGrid()) 
newData.GetBlock(n).DeepCopy(localData) 

Delete(localData) 
Delete(myData) 

newData.DataHasBeenGenerated() 
newSource.UpdatePipelineInformation() 
newSource.UpdatePipeline() 

With all that done, if I try to apply a filter to newSource, it doesn't work. 
The data is definitely inside newData -- I can print it out and such, even 
after I delete the localData (which is why I used DeepCopy). 

But I don't know how to send that data back to the server. Or, maybe I don't 
need the DataObjectGenerator -- if that's the case, how do I create a local VTK 
object and then send it to the server to visualize? 

Hopefully that example is clear... I appreciate any help you guys can provide. 
It would be easiest if I could create my own custom reader, but I can't do that 
because we use Paraview on a lot of machines that we can't recompile to include 
the new plugin. 

Thanks, 

Tim 
_______________________________________________ 
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 

_______________________________________________
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

Reply via email to