Display Animated Property Value

I am using an animation to change the isosurface value of a contour. How can I add text that displays the current isosurface value (which would change with the animation)?

Hi @markowkes and welcome to ParaView’s discourse !

I would suggest to look at annotations . Annotate Attribute Data and Python Annotation look like a good match for your needs.

Thanks for those suggestions.

The Python Annotation looks promising, but it seems to be tied to an array (Point, Cell, or Field) and allows you to pull values out of these arrays.

I’m trying to display the contour value with something like: 'Contour: %f' % (Contour2.Isosurfaces[1]), which would display Contour: 0.25 if the isosurface value is at 0.25. But this displays (error) since it doesn’t recognize the variable Contour2.Isosurfaces[1]

Right ! You may be able to do it thought Python Console but I am not sure how to keep it up-to-date during animation. Maybe somebody else can shed some light on this. In the meantime you can (ab)use the Programmable Annotation with the following value as Script:

# load the module that allows to query the paraview state
import paraview.simple as simple
# get the element with name Contour1 (substitute for your case)
contour = None
for key,value in simple.GetSources().items():
    if key[0] == "Contour1":
        contour = value
        break

isosurfaces = contour.Isosurfaces

to = self.GetTableOutput()
arr = vtk.vtkStringArray()
arr.SetName("YourString")
arr.SetNumberOfComponents(1)
arr.InsertNextValue(f"isosurfaces {isosurfaces}")
to.AddColumn(arr)
1 Like