[Paraview] Programmable Source
Aurélien Marsan
aur.marsan at gmail.com
Fri Sep 24 05:58:57 EDT 2010
Hello David,
I am in the same situation.
Here is what I have done :
1. Create the reader in python, that works with pvpython, and returns (in
my case) a vtkMultiBlockDataSet
2. Then create a "MyReader.xml" file.
That calls a vtkPythonProgrammableFilter, in which I import my reader and
execute it.
Here is the contents of this file
<ServerManagerConfiguration>
<ProxyGroup name="sources">
<!-- server manager xml for a python script that reads a file
the auto generated panel for this exposes everything more than we
want so
a custom panel would be good -->
<SourceProxy name="ReaderV3D" class="vtkPythonProgrammableFilter"
label="ReaderV3D">
<Documentation
long_help=""
short_help="">
</Documentation>
<!-- data set type -->
<IntVectorProperty
name="OutputDataSetType"
command="SetOutputDataSetType"
number_of_elements="1"
default_values="13">
<!-- value of 13 means MultiBlockDataSet -->
</IntVectorProperty>
<!-- the script -->
<StringVectorProperty
name="Script"
command="SetScript"
number_of_elements="1"
default_values="import pyturbo; pdo = self.GetOutput();data =
pyturbo.read(file);pdo.DeepCopy(data);">
<!--
<Hints>
<Widget type="multi_line"/>
</Hints>
-->
</StringVectorProperty>
<!-- python script references a variable "file"
we expose this as a property allowing the user to set it -->
<StringVectorProperty
name="file"
command="SetParameter"
number_of_elements="2"
default_values_delimiter=";"
default_values="file;'give_the_path_of_the_file'">
</StringVectorProperty>
</SourceProxy>
</ProxyGroup>
</ServerManagerConfiguration>
Note that if you want to give a string as argument, you have to use the
quotation marks.
At this point, you just have to import the .xml as a plugin in Paraview
That may correspond to what you want to do.
Regards,
A.Marsan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.paraview.org/pipermail/paraview/attachments/20100924/f604472a/attachment.htm>
More information about the ParaView
mailing list