[Paraview] python programmable filter via xml with multiple input

Fraser Callaghan fraser.callaghan at sydney.edu.au
Sat Sep 27 08:10:48 EDT 2014


Hi, 

I am able to run a python programmable filter accessing multiple inputs selected from the pipe line e.g:
#
numInputs = self.GetNumberOfInputConnections(0)
for i in range(numInputs):
	 print self.GetInputDataObject(0,i).GetNumberOfPoints()
##

I am able to use the xml format to define multiple inputs in a cleaner way, but can not access the input data (example below). 
Changing "command" value does not help. 
How should I be accessing the inputs available from the xml setup? 

Thanks for the help,
Fraser

xml file:

<ServerManagerConfiguration>
  <ProxyGroup name="filters">
    <!-- ================================================================== -->
    <SourceProxy name="MyFilter" class="vtkPythonProgrammableFilter" label="MyFilter">
      <Documentation
         long_help="long help."
         short_help="short help.">
      </Documentation>
 
      <InputProperty
         name="Input0"
	       port_index="0"
         command="SetInputConnection">
        <ProxyGroupDomain name="groups">
          <Group name="sources"/>
          <Group name="filters"/>
        </ProxyGroupDomain>
        <DataTypeDomain name="input_type">
          <DataType value="vtkPolyData"/>
        </DataTypeDomain>
        <Documentation>
          Input data 0.
        </Documentation>
      </InputProperty>
 
      <InputProperty
         name="Input1"
	       port_index="1"
         command="SetInputConnection">
        <ProxyGroupDomain name="groups">
          <Group name="sources"/>
          <Group name="filters"/>
        </ProxyGroupDomain>
        <DataTypeDomain name="input_type">
          <DataType value="vtkPolyData"/>
        </DataTypeDomain>
        <Documentation>
          Input data 1
        </Documentation>
      </InputProperty>

      <!-- Output data type: "vtkPolyData" -->
      <StringVectorProperty
        name="Script"
        command="SetScript"
        number_of_elements="1"
        default_values="print 'Filter Working'&#xA;print self.GetInputDataObject(0,0)&#xA;#prints polydata&#xA;print self.GetInputDataObject(0,1)&#xA;#prints None&#xA;&#xA;"
        panel_visibility="advanced">
        <Hints>
         <Widget type="multi_line"/>
       </Hints>
      <Documentation>This property contains the text of a python program that
      the programmable source runs.</Documentation>
      </StringVectorProperty>

    </SourceProxy>
    <!-- End LandmarkTransformFilter -->
  </ProxyGroup>
  <!-- End Filters Group -->
</ServerManagerConfiguration>



Error on loading:

ERROR: In /home/utkarsh/Dashboards/MyTests/NightlyMaster/ParaViewSuperbuild-Release/paraview/src/paraview/VTK/Common/ExecutionModel/vtkAlgorithm.cxx, line 893
vtkPythonProgrammableFilter (0x56aff30): Attempt to connect input port index 1 for an algorithm with 1 input ports.


More information about the ParaView mailing list