grabbing loaded data from shell

python

(Kurt Sansom) #1

in 3d slicer there is a way to grab data that is already loaded with the grabNode() function, is there a similar function in paraview where you can interactively grab a loaded dataset and apply other vtk filters to it?

this in the context of using the python shell along with the gui.


(Mathieu Westphal) #2

This is a task for servermanager.Fetch, be aware that it can be expansive to call it in some cases.

from vtk import *
s=Cone()
object = servermanager.Fetch(s)
writer = vtkXMLPolyDataWriter()
writer.SetInputData(object)
writer.SetFilename("test.vtp")
writer.Write()

(Kurt Sansom) #3

this is helpful but when I say loaded I mean loaded via the gui. not the python shell.

an example would be to access the origin of a triangle surface that was already loaded via the gui and get the object as a python object in the shell.


(Mathieu Westphal) #4

The python shell is compatible with the GUI.

In the GUI, in the Pipeline Browsser, click on the source you want to examine, then :

s = GetActiveSource()
object = servermanager.Fetch(s)