Compound proxies in ParaQ

From ParaQ Wiki
Revision as of 18:56, 23 January 2006 by Clinton (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

How to make and use compound filters in ParaQ

1. ParaQ doesn't have support yet for making compound filter definitions. Using the python client (pvpython) is currently the easiest way. An example script is:

# load paraview
from libvtkPVServerManagerPython import *
from libvtkPVServerCommonPython import *

# get proxy manager
pm = vtkSMObject.GetProxyManager()
# create elevation
elevation = pm.NewProxy("filters", "ElevationFilter")
pm.RegisterProxy("filters", "MyElevationFilter", elevation)

#create compound proxy
compound = vtkSMCompoundProxy()
# add elevation to compound proxy
compound.AddProxy("first", elevation)
# expose high point
compound.ExposeProperty("first", "HighPoint", "HighPoint")
# expose input for convenience in connecting pipeline
compound.ExposeProperty("first", "Input", "Input")
# write it out to stdout
definition = compound.SaveDefinition(None)
definition.PrintXML()

The result of that in a valid .xml file is:

<MyCompoundProxies>
  <CompoundProxyDefinition name="MyElevation">
    <CompoundProxy id="4">
      <ExposedProperties>
        <Property name="HighPoint" proxy_name="first" exposed_name="HighPoint"/>
        <Property name="Input" proxy_name="first" exposed_name="Input"/>
      </ExposedProperties>
      <Proxy group="filters" type="ElevationFilter" id="5" compound_name="first">
        <Property name="HighPoint" id="5.HighPoint" number_of_elements="3">
          <Element index="0" value="0"/>
          <Element index="1" value="0"/>
          <Element index="2" value="1"/>
        </Property>
        <Property name="Input" id="5.Input" number_of_elements="0">
          <Domain name="groups" id="5.Input.groups">
            <Group value="sources"/>
            <Group value="filters"/>
          </Domain>
          <Domain name="input_type" id="5.Input.input_type">
            <DataType value="vtkDataSet"/>
          </Domain>
        </Property>
        <Property name="LowPoint" id="5.LowPoint" number_of_elements="3">
          <Element index="0" value="0"/>
          <Element index="1" value="0"/>
          <Element index="2" value="0"/>
        </Property>
        <Property name="ScalarRange" id="5.ScalarRange" number_of_elements="2">
          <Element index="0" value="0"/>
          <Element index="1" value="1"/>
          <Domain name="range" id="5.ScalarRange.range"/>
        </Property>
      </Proxy>
    </CompoundProxy>
  </CompoundProxyDefinition>
</MyCompoundProxies>

2. Startup ParaQ and connect to a server.
3. Open the compound filter dialog from the tools menu.
4. Load an xml file and it shows up in the toolbar.
5. Use the toolbar items as the menu items for sources and filters is used.