# How to get the source properties programmatically

**URL:** https://discourse.paraview.org/t/how-to-get-the-source-properties-programmatically/3398
**Category:** Development
**Tags:** python, vtk
**Created:** [January 24, 2020, 3:26pm UTC](https://discourse.paraview.org/t/how-to-get-the-source-properties-programmatically/3398 "2020-01-24T15:26:40Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![majo\_vlas](https://discourse.paraview.org/user_avatar/discourse.paraview.org/majo_vlas/32/2567_2.png) [@majo\_vlas](https://discourse.paraview.org/u/majo_vlas)
#### Post date: [January 24, 2020, 3:26pm UTC](https://discourse.paraview.org/t/how-to-get-the-source-properties-programmatically/3398/1 "2020-01-24T15:26:40Z")

</div>

If I obtain a source programmatically, is there a way to get the name of the source, if it is in “show” or “hide” mode, and the properties in general.

Example, I have

```auto
activeSource = GetActiveSource()
print(activeSource) 

```

I get  
`<paraview.servermanager.Transform object at 0x14c2d1d50>`

How do I extract info from the object?

---

<div class="post-metadata">

### Author: ![cory.quammen](https://discourse.paraview.org/user_avatar/discourse.paraview.org/cory.quammen/32/11193_2.png) [@cory.quammen](https://discourse.paraview.org/u/cory.quammen)
#### Post date: [January 24, 2020, 3:58pm UTC](https://discourse.paraview.org/t/how-to-get-the-source-properties-programmatically/3398/2 "2020-01-24T15:58:14Z")

</div>

Here is a one-liner to do this:

```python
[k for (k, v) in GetSources().items() if v == GetActiveSource()][0][0]

```

Background: The name is not an information property of the source - the server manager in ParaView keeps a dictionary from name/id to sources (and other proxies). This expression queries that dictionary.

---

<div class="post-metadata">

### Author: ![majo\_vlas](https://discourse.paraview.org/user_avatar/discourse.paraview.org/majo_vlas/32/2567_2.png) [@majo\_vlas](https://discourse.paraview.org/u/majo_vlas)
#### Post date: [January 24, 2020, 4:27pm UTC](https://discourse.paraview.org/t/how-to-get-the-source-properties-programmatically/3398/3 "2020-01-24T16:27:16Z")

</div>

Thanks a lot! That worked for getting the name.

But how can I get more info if a have an object like this:

`<paraview.servermanager.Transform object at 0x14c2d1d50>` ?

Info like for example, if the source is visible, it’s translate values, etc?

---

<div class="post-metadata">

### Author: ![cory.quammen](https://discourse.paraview.org/user_avatar/discourse.paraview.org/cory.quammen/32/11193_2.png) [@cory.quammen](https://discourse.paraview.org/u/cory.quammen)
#### Post date: [January 24, 2020, 4:51pm UTC](https://discourse.paraview.org/t/how-to-get-the-source-properties-programmatically/3398/4 "2020-01-24T16:51:33Z")

</div>

For properties of the source itself, you can use

```python
s = GetActiveSource()
s.ListProperties()

```

The property names are returned in a list of strings. Each property can be accessed as an attribute of the source, e.g.

```python
print(s.Radius)

```

To get display properties such as visibility, you have to get the representation of the source. You can list its properties the same way:

```python
d = Show(s)
d.ListProperties()

```

Those properties are accessible as attributes as well.

The [ParaView Guide](https://www.paraview.org/paraview-guide/) covers a lot of this. For reference of specific source types, see the [Python API docs](https://kitware.github.io/paraview-docs/latest/python/) and list of [Available readers, sources, writers, filters and animation cues](https://kitware.github.io/paraview-docs/latest/python/paraview.servermanager_proxies.html).

---

<div class="post-metadata">

### Author: ![majo\_vlas](https://discourse.paraview.org/user_avatar/discourse.paraview.org/majo_vlas/32/2567_2.png) [@majo\_vlas](https://discourse.paraview.org/u/majo_vlas)
#### Post date: [January 24, 2020, 5:01pm UTC](https://discourse.paraview.org/t/how-to-get-the-source-properties-programmatically/3398/5 "2020-01-24T17:01:52Z")

</div>

Great! Thanks.
