# Filter with defaults for input array selection

**URL:** https://discourse.paraview.org/t/filter-with-defaults-for-input-array-selection/8343
**Category:** Development
**Tags:** python
**Created:** [November 5, 2021, 8:53pm UTC](https://discourse.paraview.org/t/filter-with-defaults-for-input-array-selection/8343 "2021-11-05T20:53:17Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![vadimcn](https://discourse.paraview.org/user_avatar/discourse.paraview.org/vadimcn/32/995_2.png) [@vadimcn](https://discourse.paraview.org/u/vadimcn)
#### Post date: [November 5, 2021, 8:53pm UTC](https://discourse.paraview.org/t/filter-with-defaults-for-input-array-selection/8343/1 "2021-11-05T20:53:17Z")

</div>

Hi,  
I’d like to create a Python filter that transforms point coordinates of the input dataset using arrays from a secondary dataset. The secondary dataset is virtually always the same, and I’d like my plugin to have a default, so that users don’t need to configure array selection every time.  
Something like: “If dataset xxx.vtk is loaded at filter creation time, use arrays yyy and zzz from that dataset”. Can this be done in ParaView?

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.paraview.org/user_avatar/discourse.paraview.org/mwestphal/32/17_2.png) [@mwestphal](https://discourse.paraview.org/u/mwestphal)
#### Post date: [November 8, 2021, 8:44am UTC](https://discourse.paraview.org/t/filter-with-defaults-for-input-array-selection/8343/2 "2021-11-08T08:44:32Z")

</div>

You can do something similar using a python filter/reader plugin, but what you are actually looking for may actually be a simple pvpython maccro that will look for the dataset and react accordingly.

---

<div class="post-metadata">

### Author: ![vadimcn](https://discourse.paraview.org/user_avatar/discourse.paraview.org/vadimcn/32/995_2.png) [@vadimcn](https://discourse.paraview.org/u/vadimcn)
#### Post date: [November 9, 2021, 5:38pm UTC](https://discourse.paraview.org/t/filter-with-defaults-for-input-array-selection/8343/3 "2021-11-09T17:38:30Z")

</div>

> [@mwestphal](#):
>
> what you are actually looking for may actually be a simple pvpython maccro that will look for the dataset and react accordingly.

Right. What I’m struggling with is “What functions do I need to use to accomplish this?” I spent some time trying to figure out how to enumerate the currently loaded datasets and how to change my filter’s input port bindings via a script, but got lost in ParaView APIs ☹ Are there any examples/tutorials out there? (other than PythonAlgorithmExamples.py)

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.paraview.org/user_avatar/discourse.paraview.org/mwestphal/32/17_2.png) [@mwestphal](https://discourse.paraview.org/u/mwestphal)
#### Post date: [November 10, 2021, 8:58am UTC](https://discourse.paraview.org/t/filter-with-defaults-for-input-array-selection/8343/4 "2021-11-10T08:58:10Z")

</div>

Here is the documentation:  
[https://kitware.github.io/paraview-docs/latest/python/index.html](https://kitware.github.io/paraview-docs/latest/python/index.html)
