[Paraview] Scripting and new VTK objects

Tim Gallagher tim.gallagher at gatech.edu
Wed Feb 9 16:20:51 EST 2011


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


More information about the ParaView mailing list