[Paraview] script for moving a sphere

Andy Bauer andy.bauer at kitware.com
Sun Jan 1 17:21:32 EST 2012


On Sun, Jan 1, 2012 at 5:21 PM, Andy Bauer <andy.bauer at kitware.com> wrote:

> Hi Rafael,
>
> Please respond to the list so that everyone can participate in the
> conversation.
>
> Setting the sphere resolution is really a two step process since there is
> both a phi and theta resolution for it.  You can do it either in the
> properties tab of the object inspector or use the python trace to figure
> out the corresponding pyhton commands .
>
> I think you can link the file with the sphere height with the setting some
> of the temporal parameters but I don't know how to do it off the top of my
> head.  There ought to be information in the online users guide to get you
> going with it.
>
> Andy
>
>
> On Sat, Dec 31, 2011 at 12:01 PM, Jose Pacheco <asujrpv at asu.edu> wrote:
>
>> Andy,
>> many thanks, this works, so I can see the cylinder and the sphere falling
>> down.
>>
>> Two questions: 1) how can you add resolution to the sphere? I added the
>> Sphere1.Radius=1 (I scaled with radius). 2) How can you link the position
>> of the sphere with the vtk file? For example, boum001.vtk corresponds to
>> the sphere at z=35, boum002.vtk to z=34.5 etc.
>>
>> Many thanks!
>> Rafael
>>
>>
>> On 31 December 2011 08:47, Andy Bauer <andy.bauer at kitware.com> wrote:
>>
>>> You can try creating a sphere source and then use the animation view to
>>> set the z-value property of the sphere to change with time.  The link for
>>> more information on that is at
>>> http://paraview.org/Wiki/ParaView/Users_Guide/Animation.
>>>
>>> The following python script is a bit long and has extra stuff in it
>>> (like the cylinder to give it perspective) but hopefully demonstrates
>>> this.  I created this script with ParaView 3.12's python trace but
>>> hopefully it works with your version too.
>>> =========================
>>> try: paraview.simple
>>>
>>> except: from paraview.simple import *
>>>
>>> paraview.simple._DisableFirstRenderCameraReset()
>>>
>>> Sphere1 = Sphere()
>>>
>>> Sphere1.Center = [0.0, 0.0, 35.0]
>>>
>>> RenderView1 = GetRenderView()
>>>
>>> DataRepresentation1 = Show()
>>>
>>> DataRepresentation1.EdgeColor = [0.0, 0.0, 0.5000076295109483]
>>>
>>> Cylinder1 = Cylinder()
>>>
>>> RenderView1.CameraPosition = [0.0, 0.0, 38.29037430412229]
>>>
>>> RenderView1.CameraFocalPoint = [0.0, 0.0, 35.0]
>>>
>>> RenderView1.CameraClippingRange = [2.262470561081065, 4.592229918684122]
>>>
>>> RenderView1.CenterOfRotation = [0.0, 0.0, 35.0]
>>>
>>> RenderView1.CameraParallelScale = 0.8516115354228021
>>>
>>> Cylinder1.Height = 10.0
>>>
>>> DataRepresentation2 = Show()
>>>
>>> DataRepresentation2.EdgeColor = [0.0, 0.0, 0.5000076295109483]
>>>
>>> AnimationScene1 = GetAnimationScene()
>>>
>>> SetActiveSource(Sphere1)
>>>
>>> KeyFrameAnimationCue1 = GetAnimationTrack( 'Center', 2 )
>>>
>>> TimeAnimationCue1 = GetTimeTrack()
>>>
>>> KeyFrame294 = CompositeKeyFrame( KeyValues=[35.0] )
>>>
>>> KeyFrame295 = CompositeKeyFrame( KeyTime=1.0, KeyValues=[0.0] )
>>>
>>> Sphere1.Center = [0.0, 0.0, 31.11111111111111]
>>>
>>> RenderView1.CameraViewUp = [0.0, 0.0, 1.0]
>>>
>>> RenderView1.CameraPosition = [0.0, 72.08114679244352, 17.533493652939796]
>>>
>>> RenderView1.CameraClippingRange = [61.41033532451908, 85.68736399433017]
>>>
>>> RenderView1.ViewTime = 0.1111111111111111
>>>
>>> RenderView1.CameraFocalPoint = [0.0, 0.0, 17.533493652939796]
>>>
>>> RenderView1.CameraParallelScale = 18.655973582714857
>>>
>>> RenderView1.CenterOfRotation = [0.0, 0.0, 17.533493652939796]
>>>
>>> AnimationScene1.AnimationTime = 0.1111111111111111
>>>
>>> KeyFrameAnimationCue1.KeyFrames = [ KeyFrame294, KeyFrame295 ]
>>>
>>> Sphere1.Center = [0.0, 0.0, 27.22222222222222]
>>>
>>> RenderView1.ViewTime = 0.2222222222222222
>>>
>>> AnimationScene1.AnimationTime = 0.2222222222222222
>>>
>>> Sphere1.Center = [0.0, 0.0, 23.333333333333336]
>>>
>>> RenderView1.ViewTime = 0.3333333333333333
>>>
>>> AnimationScene1.AnimationTime = 0.3333333333333333
>>>
>>> Sphere1.Center = [0.0, 0.0, 19.444444444444443]
>>>
>>> RenderView1.ViewTime = 0.4444444444444444
>>>
>>> AnimationScene1.AnimationTime = 0.4444444444444444
>>>
>>> Sphere1.Center = [0.0, 0.0, 15.555555555555554]
>>>
>>> RenderView1.ViewTime = 0.5555555555555556
>>>
>>> AnimationScene1.AnimationTime = 0.5555555555555556
>>>
>>> Sphere1.Center = [0.0, 0.0, 11.666666666666668]
>>>
>>> RenderView1.ViewTime = 0.6666666666666666
>>>
>>> AnimationScene1.AnimationTime = 0.6666666666666666
>>>
>>> Sphere1.Center = [0.0, 0.0, 7.777777777777779]
>>>
>>> RenderView1.ViewTime = 0.7777777777777778
>>>
>>> AnimationScene1.AnimationTime = 0.7777777777777778
>>>
>>> Sphere1.Center = [0.0, 0.0, 3.8888888888888893]
>>>
>>> RenderView1.ViewTime = 0.8888888888888888
>>>
>>> AnimationScene1.AnimationTime = 0.8888888888888888
>>>
>>> Sphere1.Center = [0.0, 0.0, 0.0]
>>>
>>> RenderView1.ViewTime = 1.0
>>>
>>> AnimationScene1.AnimationTime = 1.0
>>>
>>> Render()
>>>
>>> ===================
>>>
>>>
>>> On Sat, Dec 31, 2011 at 9:26 AM, Rafael Pacheco <
>>> rpacheco at math.la.asu.edu> wrote:
>>>
>>>>
>>>> Hello everybody,
>>>> I have a sphere being towed down and settling on a horizontal wall as
>>>> shown in the figures attached. The motion is prescribed, so the sphere
>>>> is no
>>>> free-falling. These figures are without rotation. But I also have
>>>> several runs
>>>> with different rates of rotation. What I would like to do is somehow
>>>> automate
>>>> the animation so that I do not have to move manually the sphere and
>>>> take snap
>>>> shots.
>>>>
>>>> For example, in the figures the sphere is located at the bottom of the
>>>> horizontal wall, but at t=0, it is at z=35. so for t=0, z= 35 and the
>>>> name of the flow field is boum000.vtk. For t=0.5, t=34.5 and the name
>>>> of the flow field is boum001.vtk.
>>>>
>>>> What I normally do is to load all the boum*vtk, then move the sphere
>>>> manually and save an image in png file as the sphere is moving down.
>>>>
>>>> For one set of simulations is OK to do this manually, but for 20
>>>> different runs, I think it is going to be a pain in the neck.
>>>>
>>>> I will appreciate your help on this.
>>>>
>>>> thanks
>>>> Rafael
>>>>
>>>> -- Rafael
>>>>   ----------------------------------------
>>>>   Department of Mathematics and Statistics
>>>>   Arizona State University
>>>>   Tempe, Arizona  85287-1804
>>>>   Email: rpacheco at asu.edu
>>>>   http://math.la.asu.edu/~rpacheco
>>>>   ----------------------------------------
>>>>
>>>>
>>>> _______________________________________________
>>>> Powered by www.kitware.com
>>>>
>>>> Visit other Kitware open-source projects at
>>>> http://www.kitware.com/opensource/opensource.html
>>>>
>>>> Please keep messages on-topic and check the ParaView Wiki at:
>>>> http://paraview.org/Wiki/ParaView
>>>>
>>>> Follow this link to subscribe/unsubscribe:
>>>> http://www.paraview.org/mailman/listinfo/paraview
>>>>
>>>>
>>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.paraview.org/pipermail/paraview/attachments/20120101/fd36d7dc/attachment.htm>


More information about the ParaView mailing list