RenderView1 = GetRenderView()
dataRepresentationList = RenderView1.Representations
nonIterableDataArrays = {'epsr', 'materialid', 'sigma', 'cellNormals'}
acceptableReaders = ["XMLPartitionedUnstructuredGridReader"]#to find what to add here:
#1. open paraview's python shell
#2. GetRenderView().Representations[0].Input
#3. add the name that comes after paraview.servermanager.
inputList = []
readers = []
allDataArrays = []
timesteps = []
for object in dataRepresentationList:
inputList.append(object.Input)
#This is where we convert data representations into reader objects so we can grab the timesteps
for data in inputList: # need to ensure I don't ask for Input from an object that doesn't have input...
#such as XMLPartitionedUnstructuredGridReader....
if data.__class__.__name__ not in acceptableReaders:
if data.Input.__class__.__name__ in acceptableReaders:
readers.append(data.Input)
else:
readers.append(data)
allDataArrays = readers[0].GetCellDataInformation().keys()
for key in allDataArrays:
if (key.lower() not in nonIterableDataArrays):
timesteps.append(key)
#once we have the timesteps we iterate over them and reassign the coloration of the data representations
for timestep in timesteps:
for representation in dataRepresentationList:
representation.ColorArrayName = timestep
Render()
Copyright (c) 2014, Brian Zachary Abel
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.