How to rename textures


I’m creating a Python script to load textures and apply them to my model. What I figured out is that every textures I load are automatically named “ImageTexture1”, “ImageTexture2”, etc. Is it possible to rename them with a more significative name using Python? I couldn’t find documentation or examples about this.

The following show a texture loaded manually and others using my script below:

from paraview.simple import *

model = GetActiveSource()
renderView1 = GetActiveViewOrCreate('RenderView')
modelDisplay = GetDisplayProperties(model, view=renderView1)

tex = CreateTexture('<path to my image file>')
modelDisplay.Texture = tex

Thank you

Welcome to the ParaView Discourse, @rpearson1!

You can use

RenameProxy(tex, tex.GetXMLGroup(), "MyTexture")

to rename your textures.

1 Like

Thank you it worked!