[Paraview] ParaView and Python: Position of a slice and pressing the "Rescale to Data Range"-Button

Stefan Kroboth ml at stefan-kroboth.com
Thu Mar 4 09:11:59 EST 2010


At first: thanks for your fast answer!

>> Is there an option to automatically render a slice when it is moved? I basically don't want to press the Apply-button whenever the slice is moved. If this isn't possible, how do i "press" the Apply-button with python?
> 
> Yes, go to Edit | Settings. There's a check box for "Auto Accept" on
> the "General" page -- check that. ParaView then auto-apply.

Thanks, thats exactly what I was looking for!

>> I could read the Origin-values from the Properties field of the Object Inspector and set the Origin-values from the Display field to this values. But how do I get this Origin-values (I only found the ones from the Display field in python).
> 
> I am not sure I understand what you are trying to do here.

Nevermind, I don't need this with the solution you provided above.

>> I also need to press the "Rescale to Data Range" button when the slice is moved. Is this even possible? If so, how?
> 
> Not currently. However, you can always write up a python script that
> achieves the same effect. Let me know if you need help with that.

I guess I have to create a Lookup-Table? It seems that I need the 'scalars' values from the 'Information' page of the Object Inspector (Subsection Data Arrays). How do I get these?

It seems that I'm having another problem now. After creating the Slice, I set the ColorArrayName to 'scalars'. The "Color by" field changes, but the Slice is just red and pressing "Rescale to Data Range" doesn't change anything. When I manually change it to "Solid Color" and then change it back to "scalars", it works fine.

This is the code:

s=Slice()
sdp = GetDisplayProperties(s)
sdp.Input.SliceType.Normal = [0,0,1]
sdp.ColorArrayName = 'scalars'

What am I doing wrong?

Thanks,
   Stefan




More information about the ParaView mailing list