[Paraview] Python Script: "Rescale to Data Range"

Kisler Roman.Kisler at tnt.tu-berlin.de
Fri Feb 15 03:40:23 EST 2013


Hi Magician, hi Andy,

thanks a lot for your responses. The code which Magician suggested worked 
perfectly. Thanks for the different possibilities you offered (indeed I 
needed GetPointData).

Kind Regards
Roman

On 2013/02/11, at 06:15:42, Magician <f_magician at mac.com> wrote:
> Hi Roman,
>
>
> I have an other solution about this problem using Python.
>
> The code takes you the ranges of any values:
> > sm = servermanager.Fetch(your_source)
> > sm.GetCellData().GetArray(your_value).GetRange(0)
>
> ...and you can apply them to your Color Maps.
>
> You should apply your source's and value's name (ex. 'Slice1' 'Velocity').
> If you want to get point data, change GetCellData() to GetPointData().
> And if your sources have high-dimensional value (such as vectors)
> and want to get the range of n-th component, change n value of GetRange(n).
>
> If your sources are MultiBlock dataset, you should get only one block
>
> before getting value as below:
> > sm.GetBlock(N).GetCellData().GetArray(your_value).GetRange(0)
>
> N is the number of blocks.
>
>
> # Now I have not enough samples, perhaps the codes couldn't work, sorry.
>
>
> Magician


More information about the ParaView mailing list