[Paraview] Use of Python declared variables inside new scripts from ProgrammableSource and/or ProgrammableFilter.

Guillaume Jacquenot guillaume.jacquenot at gmail.com
Wed Dec 30 09:03:34 EST 2015


I would like to use Python declared variables inside new scripts from
ProgrammableSource and/or ProgrammableFilter.

Why do I want such a thing? I could simply declared these variables in the
code of the script.
But what if these variables are to be used by several scripts from
ProgrammableSource and/or ProgrammableFilter?

Of course, I can serialize variables and pass the serialized data to the
scripts, taking special care for float. But, what if I have large data,
that are difficult to serialize?

So, here is my question:
Is there a mechanism to access already defined data inside the scripts of
ProgrammableSource and/or ProgrammableFilter? For example, a global scope
dict?
Do I have to use an external file to store and access data?
Below is the example of the Python file I would like to run , where I have
defined a 'data' that I want to access inside the script. If I try to
directly access 'data', I have a "NameError: global name 'data' is not
defined"

My data are in fact transformation matrices that will be used to move
objects from a ProgrammableFilter. Using the Animation Keyframes are
terribly slow.

Guillaume



Python script:

    data = ....

    script="""
    instructions to access "data" at run time
    ...
    """

    scriptRequestInformation="""
    ...
    """

    source = ProgrammableSource()
    source.OutputDataSetType = 'vtkStructuredGrid'
    source.Script = script
    source.ScriptRequestInformation = scriptRequestInformation
    source.PythonPath = ''
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/paraview/attachments/20151230/180d08ae/attachment.html>


More information about the ParaView mailing list