Personal tools
You are here: Home Forum Use Automate Array Renamer in python

Automate Array Renamer in python

Up to Use

Automate Array Renamer in python

Posted by Oliver Fischer at November 15. 2021

Hello altogether,

After asking this question in the ParaView forum, I learned that they are not the developers of the ArrayRenamer filter. From the API doucumentation I think Roman Nikolaev, who is present in this forum, is the developer. 

My problem:

I am trying to automate the ArrayRenamer Filter with python and cannot get it working.

From an FEA calculation with Code_Aster I have got a result file with multiple arrays each consisting of two or more components representing POINTS data from a user defined failure criterion. The first component represents the failure indices (default name “X1”), the second component represents a failure mode (default name “X2”).

For replacing the ugly default component names by more meaningful ones (e.g.: “X1” ==> “failure_index”, “X2” ==> “failure_mode”) , the Array Renamer filter does a good job - but only in the GUI. When I try to automate this, based on the recorded python code with the command “arrayRenamer1.ComponentInfo = […]”, the components are not updated.

Code:

# -*- coding: iso-8859-1 -*- import pvsimple pvsimple.ShowParaviewView() # trace generated using paraview version 5.6.0-RC1 from pvsimple import * pvsimple._DisableFirstRenderCameraReset() renderView1 = FindViewOrCreate('RenderView1', viewtype='RenderView') SetActiveView(renderView1) source = GetActiveSource() print("Verwende source =",source.FileName) # create a new 'Array Renamer' arrayRenamer1 = ArrayRenamer(Input=source) # show data in view arrayRenamer1Display = Show(arrayRenamer1, renderView1) # trace defaults for the display properties. arrayRenamer1Display.Representation = 'Surface' # show color bar/color legend arrayRenamer1Display.SetScalarBarVisibility(renderView1, True) # update the view to ensure updated data information renderView1.Update() # Properties modified on arrayRenamer1 # '0' stands for the first component with the default name X1 # '1' stands for the second component with the default name X2 arrayRenamer1.ComponentInfo = ['FF_L01u_UT01_NOEU', '0', 'failure_index', \ 'FF_L01u_UT01_NOEU', '1', 'failure_mode', \ ...] renderView1.Update()

I have tried to run this code as Macro and from the ParaVis MenuBar / Tools / Python Shell / Run Script command. Neither works as hoped. I suspect that it might have to do with clicking the Apply button in the GUI. Maybe some …Update() function is missing in my code?

Does anybody know what I’m missing or doing wrong? Is this a bug fixed in a later version?

Thank you very much for any help,
o.w.fischer

I am working with ParaVis 5.6.0 in Salome-Meca 9.3.0 for Windows.

Re: Automate Array Renamer in python

Posted by Oliver Fischer at November 15. 2021

Sorry for the unreadable code section. I attach it as a file here:

Attachments

Re: Automate Array Renamer in python

Posted by Oliver Fischer at January 08. 2022

Hello, 

is there nobody out there using the array renamer with python scripting who can help me?

Happy new year and kind regards,

Oliver Fischer

Powered by Ploneboard
Document Actions