[Paraview] How to animate the clip plane to remain in the middle of a dataset.

Scott, W Alan wascott at sandia.gov
Tue Jul 12 14:53:37 EDT 2016


My user is trying to clip an object, such as the can, and then animate the clip plane to remain in the middle of the dataset over time.  He then wants to be able to follow data.  Finally, he wants this in a script, so he can run many datasets through this process.  Here is a thread on how it is done.  The trick is to insert a python track in the animation view that keeps the clip centered, and then add a camera track using follow data.  The trace recorder is missing this magic - I will write up a bug.

Alan





<<Start reply from Utkarsh>>
Alan,

Attached is the corrected trace. Yes, it's indeed a bug. We'll need to extend the tracing to trace Python Animation Cue, which it's currently missing.

Utkarsh

On Mon, Jul 11, 2016 at 7:21 PM, Scott, W Alan <wascott at sandia.gov> wrote:
> Utkarsh,
>
> You sent us a bit of Python to use in the Animation View a few weeks ago.
> It keeps a clip centered on the screen.  This is exactly what we 
> wanted, thanks.  What my users actually want (users are cc’d)  is this 
> snippet inserted into a Python script, so that they can batch larger 
> jobs.  So, Richard  and I tried creating a trace with the trace 
> recorder.  Did the
> following:
>
> ·         Trace recorder on.
>
> ·         Can.exo.  All vars on.  Apply.
>
> ·         Clip.  Z normal. Apply.
>
> ·         Animation View/ Python / Cut and pasted in your magic Python.
>
> ·         Animation View/ Camera/ Follow Data.
>
> ·         Trace recorder off.
>
> ·         Play.
>
>
>
> Worked perfectly!  Excellent!
>
>
>
> But, the trace missed the insertion of your magic Python.  How should 
> we modify a Python trace to include your magic Python?
>
>
>
> Here is what you gave us:
>
>
>
>
>
> def start_cue(self): pass
>
>
>
> def tick(self):
>
>   ts = self.GetClockTime()
>
>   from paraview import simple as pvs
>
>   clip = pvs.FindSource("Clip1")
>
>   ip = clip.Input
>
>   ip.UpdatePipeline(ts)
>
>   bds = ip.GetDataInformation().GetBounds()
>
>   center = [ (bds[0] + bds[1]) / 2.0,
>
>              (bds[2] + bds[3]) / 2.0,
>
>              (bds[4] + bds[5]) / 2.0 ]
>
>   clip.ClipType.Origin = center
>
>
>
> def end_cue(self): pass
>
>
>
>
>
> And, attached is the (bad) trace from the steps above.
>
>
>
> Thanks,
>
>
>
> Alan
>
>

-------------- next part --------------
A non-text attachment was scrubbed...
Name: traceMissingClipCenterPython.py
Type: text/x-python
Size: 7541 bytes
Desc: traceMissingClipCenterPython.py
URL: <http://public.kitware.com/pipermail/paraview/attachments/20160712/463c7e93/attachment.py>


More information about the ParaView mailing list