# How to add filename as text in the renderview?

**URL:** https://discourse.paraview.org/t/how-to-add-filename-as-text-in-the-renderview/9179
**Category:** ParaView Support
**Created:** [March 14, 2022, 11:48pm UTC](https://discourse.paraview.org/t/how-to-add-filename-as-text-in-the-renderview/9179 "2022-03-14T23:48:15Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![Ying](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/y/fbc32d/32.png) [@Ying](https://discourse.paraview.org/u/Ying)
#### Post date: [March 14, 2022, 11:48pm UTC](https://discourse.paraview.org/t/how-to-add-filename-as-text-in-the-renderview/9179/1 "2022-03-14T23:48:15Z")

</div>

Hi, I have a bunch of vtk files named by simulation time: U\_0.05.vtk, U\_0.10.vtk, U\_0.15.vtk, …

Now I want to extract the time in filename, i.e, 0.05, 0.10, 0.15, …, and source → text to renderview, like time=0.05, time=0.10, time=0.15, … Is there anyway in paraview to identify the filename in text panel? Thanks!

---

<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: [March 15, 2022, 8:25am UTC](https://discourse.paraview.org/t/how-to-add-filename-as-text-in-the-renderview/9179/2 "2022-03-15T08:25:54Z")

</div>

Afaik ParaView does not read the time value from the filename. You will need to use a .series file.

---

<div class="post-metadata">

### Author: ![flow\_zhang](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/f/2bfe46/32.png) [@flow\_zhang](https://discourse.paraview.org/u/flow_zhang)
#### Post date: [March 15, 2022, 9:41am UTC](https://discourse.paraview.org/t/how-to-add-filename-as-text-in-the-renderview/9179/3 "2022-03-15T09:41:32Z")

</div>

I have the same question. How to get the file path and file name of the file that has been read in, and whether there are relevant function interfaces that can be used?

---

<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: [March 15, 2022, 9:45am UTC](https://discourse.paraview.org/t/how-to-add-filename-as-text-in-the-renderview/9179/4 "2022-03-15T09:45:50Z")

</div>

Filename property will give you this information.

---

<div class="post-metadata">

### Author: ![flow\_zhang](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/f/2bfe46/32.png) [@flow\_zhang](https://discourse.paraview.org/u/flow_zhang)
#### Post date: [March 15, 2022, 9:49am UTC](https://discourse.paraview.org/t/how-to-add-filename-as-text-in-the-renderview/9179/5 "2022-03-15T09:49:10Z")

</div>

Thank you a thousand time

---

<div class="post-metadata">

### Author: ![Ying](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/y/fbc32d/32.png) [@Ying](https://discourse.paraview.org/u/Ying)
#### Post date: [March 15, 2022, 8:28pm UTC](https://discourse.paraview.org/t/how-to-add-filename-as-text-in-the-renderview/9179/6 "2022-03-15T20:28:07Z")

</div>

Hi Mathieu, thanks for your information! Now I have another logic to solve this problem. Now I obtain “time” as a dictionary, which looks like:

```auto
{0: '1250.0', 1: '1250.5', 2: '1251.0', 3: '1251.5', 4: '1252.0', 5: '1252.5', 6: '1253.0', 7: '1253.5', 8: '1254.0', 9: '1254.5'}

```

And as [this post](https://discourse.paraview.org/t/show-text-field-changing-every-time-step-from-programmable-filter/1469/5) suggested, I use **Python Annotation** filter to add a timestep-varying text in render\_view:

```auto
pythonAnnotation1 = PythonAnnotation(Input=velocity)
pythonAnnotation1.Expression = time[t_index]
pythonAnnotation1Display = Show(pythonAnnotation1, renderView1)

```

But I received the error “name ‘t\_index’ is not defined”. It seems that I need to **get the current time step** used in active view. Do you know how to do that 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: [March 16, 2022, 8:28am UTC](https://discourse.paraview.org/t/how-to-add-filename-as-text-in-the-renderview/9179/7 "2022-03-16T08:28:14Z")

</div>

t\_index works great here with my data.
