[Paraview] howto move an object depending on actual time
Florian Bruckner
e0425375 at gmail.com
Tue Sep 16 09:24:28 EDT 2014
hi, thanks alot for the fast reply. DATA_TIME_STEP was the variable that
i was looking for.
here is my "Programmable Filter Script" that is able to translate an
object into a given direction depending on the actual timestep.
### paraview programmable filter script for translation of object
depending on timestep
from vtk import vtkDataObject
from paraview.vtk import dataset_adapter as DA
speed = [0.0004, 0.000, 0.000]
# define input and output
pdi = self.GetInputDataObject(0,0)
pdo = self.GetOutputDataObject(0)
pdo.CopyAttributes(pdi)
# get current time-step
step = pdi.GetInformation().Get(vtkDataObject.DATA_TIME_STEP())
# move object
old_pts = inputs[0].Points
new_pts = old_pts
for i in range(3):
new_pts[:,i] = old_pts[:,i] + step * speed[i]
arr = DA.numpyTovtkDataArray(new_pts, 'newpts')
pdo.GetPoints().SetData(arr)
greetings
FloB
On 09/16/2014 02:41 PM, Utkarsh Ayachit wrote:
> I'd suggest using "Programmable Filter" instead of "Python
> Calculator". Refer to vtkTimeToTexConvertor::RequestData() [1] for how
> to access DATA_TIME_STEP value. You can write an equivalent script in
> "Script" part for the Programmable Filter to access the time value.
>
> Utkarsh
>
> [1] https://github.com/Kitware/ParaView/blob/ad70367102a1d9779435e9949d84a576e68a6ee8/ParaViewCore/VTKExtensions/Default/vtkTimeToTextConvertor.cxx
>
>
> On Tue, Sep 16, 2014 at 6:33 AM, Florian Bruckner <e0425375 at gmail.com> wrote:
>> hello,
>>
>> i would like to create an animation of moving objects using the animation
>> view. unfortunately the positions of the objects stored within the data file
>> are stationary, so i have to manually define the movement anyhow.
>>
>> is there a simple method to archive this using the animation inspector? (i
>> am using paraview 4.1.0)
>>
>> alternatively i found a method to use the python calculator to translate the
>> object. if i could access the actual time it would be possible to define the
>> trajectory of the moving particle. is this possible?
>>
>> thanks
>> FloB
>>
>> _______________________________________________
>> 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://public.kitware.com/mailman/listinfo/paraview
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/paraview/attachments/20140916/29423b4e/attachment.html>
More information about the ParaView
mailing list