<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
  <title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
Charles-Andr&eacute; wrote:
<blockquote cite="mid:49775DE7.4040506@tufts.edu" type="cite">I would
need your lights on a small but annoying problem that I have with
Paraview 3.4.0.
I use a python script to load and display a preformatted state. It all
works
fine except that the color scale doesn't automatically rescale to fit
data
range, even though the corresponding checkbox is selected.
I would like to find the python command equivalent to a simple click on
the
icon "Rescale data to range". Does anyone know such command ?</blockquote>
<br>
This is not "a simple click", but the following python code works for
me:<br>
<br>
<meta name="qrichtext" content="1">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<style type="text/css">
p, li { white-space: pre-wrap; }
</style>
<p style="margin: 0px; text-indent: 0px;"><!--StartFragment--><span
 style="font-family: 'Courier'; font-size: 9pt; color: rgb(0, 0, 0);">#get
the proxy to your object, example</span></p>
<p style="margin: 0px; text-indent: 0px;"><span
 style="font-family: 'Courier'; font-size: 9pt; color: rgb(0, 0, 0);">pm
= servermanager.ProxyManager()<br>
slice = pm.GetProxy('sources', 'Slice1')</span></p>
#get the data range<br>
<p
 style="margin: 0px; text-indent: 0px; font-family: 'Courier'; font-size: 9pt; color: rgb(0, 0, 0);">range
=
slice.GetDataInformation().GetPointDataInformation().GetArrayInformation(0).GetComponentRange(0)<!--EndFragment--></p>
# find a proxy to the representation of your object<br>
# iterate until you find the right one, e.g.<br>
<meta name="qrichtext" content="1">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<style type="text/css">
p, li { white-space: pre-wrap; }
</style>
<p style="margin: 0px; text-indent: 0px;"><!--StartFragment--><span
 style="font-family: 'Courier'; font-size: 9pt; color: rgb(0, 0, 0);">print
</span>
<meta name="qrichtext" content="1">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<style type="text/css">
p, li { white-space: pre-wrap;</style><span
 style="font-family: 'Courier'; font-size: 9pt; color: rgb(0, 0, 0);">pm.GetProxiesInGroup("representations")<br>
</span>#&nbsp; once you know your proxy, e.g.<br>
<meta name="qrichtext" content="1">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<style type="text/css">
p, li { white-space: pre-wrap; }
</style>
<p style="margin: 0px; text-indent: 0px;"><!--StartFragment--><span
 style="font-family: 'Courier'; font-size: 9pt; color: rgb(0, 0, 0);">rep
= pm.GetProxy("representations", "DataRepresentation4")</span><!--EndFragment--></p>
</p>
<p style="margin: 0px; text-indent: 0px;"># get its lookuptable and the
RGBpoints array<br>
<meta name="qrichtext" content="1">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<style type="text/css">
p, li { white-space: pre-wrap; }
</style>
<p style="margin: 0px; text-indent: 0px;"><!--StartFragment--><span
 style="font-family: 'Courier'; font-size: 9pt; color: rgb(0, 0, 0);">table
= rep.LookupTable.GetData().RGBPoints<br>
# you can now set it to your data range</span></p>
<p style="margin: 0px; text-indent: 0px;"><span
 style="font-family: 'Courier'; font-size: 9pt; color: rgb(0, 0, 0);">table[0]
= range[0]<br>
table[4] = range[1]<br>
</span></p>
<p style="margin: 0px; text-indent: 0px;"><span
 style="font-family: 'Courier'; font-size: 9pt; color: rgb(0, 0, 0);"><br>
</span><!--EndFragment--></p>
<br>
</p>
<p style="margin: 0px; text-indent: 0px;">Your mileage will vary. Error
checking is left as an exercise<br>
<meta name="qrichtext" content="1">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<style type="text/css">
p, li { white-space: pre-wrap; 




</style>
<p style="margin: 0px; text-indent: 0px;"><!--EndFragment--></p>
<span
 style="font-family: 'Courier'; font-size: 9pt; color: rgb(0, 0, 0);"></span><!--EndFragment--></p>
--<br>
Jean<br>
Swiss National Supercomputing Centre
</body>
</html>