【正文】
n simply call Play() on it. animation_map = (animation) animation_scene = None for proxy in (): if () == AnimationScene: animation_scene = proxy if animation_scene: () Scripting for pvbatch ? Same as pvpython except ? It can be run in parallel ? One cannot connect to remote server (only () calls are supported) ? The python script is run on the 0th node Scripting from within GUI ? Things to remember ? Don?t use () or (). All connection related operation have to be done using the GUI ? is automatically setup to refer to the connection made by the GUI ? The python shell and the GUI are both working on the same engine hence changes in one will have effects on the other Scripting from within GUI () Create a sphere sphere = (PhiResolution=20, ThetaResolution=20) Register the sphere so that the GUI can access it through the proxy manager. (sphere, registrationName=SphereFromPython) Get the first render view in the GUI. gui_view = () Show the sphere in that view. repr1 = (sphere, gui_view) Make the GUI aware of this representation. (repr1) = Wireframe“ Create a new view view2 = () (view2) repr2 = (sphere, view2) (repr2) () Register/UnRegister ? Register(object, [registrationGroup=“..”, registrationName=“…”) ? Registers an object so that the GUI bees aware of it ? registrationName is the name with which the object appears in the GUI ? If registrationGroup is not specified, the group is inferred from the type of the object ? Returns a tuple (group, name) which which the object is registered on success ? UnRegister(object, [registrationGroup=“...”, registrationName=“…”) ? Unregisters a previously registered object ? The GUI treats the object as if it were deleted Saving state from python ? State of all those objects that are registered can be saved ? Objects not registered are ignored ? To be able to load saved state from GUI it is essential that default explicit registrationGroup is not specified. () Set up pipeline, views etc. …. Register all objects (source, ..) (view, …) Save state (“…/”) Python Programmable Filter ? Used to write custom filters using Python ? Python is used to data processing ? servermanager module is not accesible either use or vtk for creating VTK filters etc. Python Programmable Filter pdi = () pdo = () newPoints = () numPoints = () for i in range(0, numPoints): coord = (i) x, y, z = coord[:3] x = x * 1 y = y * 1 z = 1 + z* (i, x, y, z) (newPoints) Additional Resources ? Python scripting: ? Python programmable filter: Conclusion ? Python is the main scripting language for ParaView ? Python can be used to write pure client side code as well as for server side data processing (using programmable filter) ? module provides ponents used for clientside programming. It also has several demo*() functions which can be used as guidelines for writing custom scripts ? or simply vtk modules are provided for server side python programming. These provide access to VTK classes through python ? We are constantly working on improving the scripting API to make is easier to use and more python friendly