controlling slices in Slice View

Is it possible to control the Z slice with better control than dragging the mouse? Such as controlling the Z steps in a defined increment. I want to scan through my Z steps looking for anomalies, and sometimes the anomalies are smaller than what I can control with the mouse. Thank you

I would create a macro and click on the button associated to that macro to “scroll” through your slices.

from paraview import simple 

def next_slice(delta=-1):
  view = simple.GetActiveView()
  before = view.GetProperty("ZSlicesValues").GetData()
  view.ZSlicesValues = before + delta

next_slice()

My data is in a volume called “GridICube.vts”
The slice view is called “slice”

how would I modify the macro to get it to run?

No need to modify anything. Just need to make sure the view is the active one when running the macro.

Since your data is structured, it might be much better to use the Slice Representation and update its property to pick the right index value. You can also use the animation panel to bind this property to time so you can use the VCR controls for moving along your data.

Sebastien, thank you for the reply,
I run the macro as is and get this error message

Traceback (most recent call last):
File “”, line 6, in
File “”, line 2, in next_slice
NameError: name ‘simple’ is not defined
Traceback (most recent call last):
File “”, line 6, in
File “”, line 2, in next_slice
NameError: name ‘simple’ is not defined

Hi JoeR,

Sebastien’s macro works for me without any changes. How do you run that macro? I put the code in an empty .py file, use “Import new macro…” and then click on the macro’s name from the list below in the same menu panel (or press button with the macro’s name on the toolbar). Does it help you?

Best Regards,
Pavel