Back to index

salome-paravis  6.5.0
Classes | Functions | Variables
pvsimple Namespace Reference

Classes

class  ActiveObjects
class  _funcs_internals

Functions

def _disconnect
def Connect
def ReverseConnect
def _create_view
def CreateRenderView
def CreateXYPlotView
def CreateBarChartView
def CreateComparativeRenderView
def CreateComparativeXYPlotView
def CreateComparativeBarChartView
def CreateParallelCoordinatesChartView
def Create2DRenderView
def OpenDataFile
def CreateWriter
def GetRenderView
def GetRenderViews
def GetRepresentation
def GetDisplayProperties
def Show
def Hide
def Render
def ResetCamera
def _DisableFirstRenderCameraReset
def SetProperties
def GetProperty
def SetDisplayProperties
def SetViewProperties
def RenameSource
def FindSource
def GetSources
def GetRepresentations
def UpdatePipeline
def Delete
def CreateLookupTable
def CreatePiecewiseFunction
def GetLookupTableForArray
def CreateScalarBar
def MakeBlueToRedLT
def _find_writer
def AddCameraLink
def RemoveCameraLink
def WriteImage
def AnimateReader
def _create_func
def _create_doc
def _func_name_valid
def _add_functions
def GetActiveView
def SetActiveView
def GetActiveSource
def SetActiveSource
def GetActiveCamera
def GetAnimationScene
def WriteAnimation
def _GetRepresentationAnimationHelper
def GetAnimationTrack
def GetCameraTrack
def GetTimeTrack
def LoadXML
def LoadPlugin
def LoadDistributedPlugin
def demo1
def demo2
def PrintTrace
def SaveTrace
def ImportFile

Variables

 servermanager = paravisSM
tuple active_objects = ActiveObjects()

Function Documentation

def pvsimple._add_functions (   g) [private]

Definition at line 657 of file pvsimple.py.

00657 
00658 def _add_functions(g):
00659     for m in [servermanager.filters, servermanager.sources,
00660               servermanager.writers, servermanager.animation]:
00661         dt = m.__dict__
00662         for key in dt.keys():
00663             cl = dt[key]
00664             if not isinstance(cl, str):
00665                 if not key in g and _func_name_valid(key):
00666                     g[key] = _create_func(key, m)
00667                     exec "g[key].__doc__ = _create_doc(m.%s.__doc__, g[key].__doc__)" % key

Here is the call graph for this function:

Here is the caller graph for this function:

def pvsimple._create_doc (   new,
  old 
) [private]
Internal function.

Definition at line 635 of file pvsimple.py.

00635 
00636 def _create_doc(new, old):
00637     """Internal function."""
00638     import string
00639     res = ""
00640     for doc in (new, old):
00641         ts = []
00642         strpd = doc.split('\n')
00643         for s in strpd:
00644             ts.append(s.lstrip())
00645         res += string.join(ts)
00646         res += '\n'
00647     return res
    
def pvsimple._create_func (   key,
  module 
) [private]
Internal function.

Definition at line 568 of file pvsimple.py.

00568 
00569 def _create_func(key, module):
00570     """Internal function."""
00571 
00572     def CreateObject(*input, **params):
00573         """This function creates a new proxy. For pipeline objects that accept inputs,
00574         all non-keyword arguments are assumed to be inputs. All keyword arguments are
00575         assumed to be property,value pairs and are passed to the new proxy."""
00576 
00577         # Instantiate the actual object from the given module.
00578         px = module.__dict__[key]()
00579 
00580         # Make sure non-keyword arguments are valid
00581         for inp in input:
00582             if inp != None and not isinstance(inp, servermanager.Proxy):
00583                 if px.GetProperty("Input") != None:
00584                     raise RuntimeError, "Expecting a proxy as input."
00585                 else:
00586                     raise RuntimeError, "This function does not accept non-keyword arguments."
00587 
00588         # Assign inputs
00589         if px.GetProperty("Input") != None:
00590             if len(input) > 0:
00591                 px.Input = input
00592             else:
00593                 # If no input is specified, try the active pipeline object
00594                 if px.GetProperty("Input").GetRepeatable() and active_objects.get_selected_sources():
00595                     px.Input = active_objects.get_selected_sources()
00596                 elif active_objects.source:
00597                     px.Input = active_objects.source
00598         else:
00599             if len(input) > 0:
00600                 raise RuntimeError, "This function does not expect an input."
00601 
00602         registrationName = None
00603         for nameParam in ['registrationName', 'guiName']:
00604           if nameParam in params:
00605               registrationName = params[nameParam]
00606               del params[nameParam]
00607 
00608         # Pass all the named arguments as property,value pairs
00609         for param in params.keys():
00610             setattr(px, param, params[param])
00611 
00612         try:
00613             # Register the proxy with the proxy manager.
00614             if registrationName:
00615                 group, name = servermanager.Register(px, registrationName=registrationName)
00616             else:
00617                 group, name = servermanager.Register(px)
00618 
00619 
00620             # Register pipeline objects with the time keeper. This is used to extract time values
00621             # from sources. NOTE: This should really be in the servermanager controller layer.
00622             if group == "sources":
00623                 tk = servermanager.ProxyManager().GetProxiesInGroup("timekeeper").values()[0]
00624                 sources = tk.TimeSources
00625                 if not px in sources:
00626                     sources.append(px)
00627 
00628                 active_objects.source = px
00629         except servermanager.MissingRegistrationInformation:
00630             pass
00631 
00632         return px
00633 
00634     return CreateObject

Here is the caller graph for this function:

def pvsimple._create_view (   view_xml_name) [private]

Definition at line 81 of file pvsimple.py.

00081 
00082 def _create_view(view_xml_name):
00083     "Creates and returns a 3D render view."
00084     view = servermanager._create_view(view_xml_name)
00085     servermanager.ProxyManager().RegisterProxy("views", \
00086       "my_view%d" % _funcs_internals.view_counter, view)
00087     active_objects.view = view
00088     _funcs_internals.view_counter += 1
00089     
00090     tk = servermanager.ProxyManager().GetProxiesInGroup("timekeeper").values()[0]
00091     views = tk.Views
00092     if not view in views:
00093         views.append(view)
00094     try:
00095         scene = GetAnimationScene()
00096         if not view in scene.ViewModules:
00097             scene.ViewModules.append(view)
00098     except servermanager.MissingProxy:
00099         pass
00100     return view

Here is the call graph for this function:

Here is the caller graph for this function:

Disable the first render camera reset.  Normally a ResetCamera is called
automatically when Render is called for the first time after importing
this module.

Definition at line 251 of file pvsimple.py.

00251 
00252 def _DisableFirstRenderCameraReset():
00253     """Disable the first render camera reset.  Normally a ResetCamera is called
00254     automatically when Render is called for the first time after importing
00255     this module."""
00256     _funcs_internals.first_render = False

def pvsimple._disconnect ( ) [private]

Definition at line 45 of file pvsimple.py.

00045 
00046 def _disconnect():
00047     if servermanager.ActiveConnection:
00048         servermanager.ProxyManager().UnRegisterProxies()
00049         active_objects.view = None
00050         active_objects.source = None
00051         import gc
00052         gc.collect()
00053         servermanager.Disconnect()

Here is the caller graph for this function:

def pvsimple._find_writer (   filename) [private]
Internal function.

Definition at line 492 of file pvsimple.py.

00492 
00493 def _find_writer(filename):
00494     """Internal function."""
00495     extension = None
00496     parts = filename.split('.')
00497     if len(parts) > 1:
00498         extension = parts[-1]
00499     else:
00500         raise RuntimeError, "Filename has no extension, please specify a write"
00501         
00502     if extension == 'png':
00503         return 'vtkPNGWriter'
00504     elif extension == 'bmp':
00505         return 'vtkBMPWriter'
00506     elif extension == 'ppm':
00507         return 'vtkPNMWriter'
00508     elif extension == 'tif' or extension == 'tiff':
00509         return 'vtkTIFFWriter'
00510     elif extension == 'jpg' or extension == 'jpeg':
00511         return 'vtkJPEGWriter'
00512     else:
00513         raise RuntimeError, "Cannot infer filetype from extension:", extension

Here is the caller graph for this function:

def pvsimple._func_name_valid (   name) [private]
Internal function.

Definition at line 648 of file pvsimple.py.

00648 
00649 def _func_name_valid(name):
00650     """Internal function."""
00651     valid = True
00652     for c in name:
00653         if c == '(' or c ==')':
00654             valid = False
00655             break
00656     return valid

Here is the caller graph for this function:

def pvsimple._GetRepresentationAnimationHelper (   sourceproxy) [private]
Internal method that returns the representation animation helper for a
   source proxy. It creates a new one if none exists.

Definition at line 737 of file pvsimple.py.

00737 
00738 def _GetRepresentationAnimationHelper(sourceproxy):
00739     """Internal method that returns the representation animation helper for a
00740        source proxy. It creates a new one if none exists."""
00741     # ascertain that proxy is a source proxy
00742     if not sourceproxy in GetSources().values():
00743         return None
00744     for proxy in servermanager.ProxyManager():
00745         if proxy.GetXMLName() == "RepresentationAnimationHelper" and\
00746            proxy.GetProperty("Source").IsProxyAdded(sourceproxy.SMProxy):
00747              return proxy
00748     # create a new helper
00749     proxy = servermanager.misc.RepresentationAnimationHelper(
00750       Source=sourceproxy)
00751     servermanager.ProxyManager().RegisterProxy(
00752       "pq_helper_proxies.%s" % sourceproxy.GetGlobalIDAsString(),
00753       "RepresentationAnimationHelper", proxy)
00754     return proxy

Here is the call graph for this function:

Here is the caller graph for this function:

def pvsimple.AddCameraLink (   viewProxy,
  viewProxyOther,
  linkName 
)
Create a camera link between two view proxies.  A name must be given
so that the link can be referred to by name.  If a link with the given
name already exists it will be removed first.

Definition at line 514 of file pvsimple.py.

00514 
00515 def AddCameraLink(viewProxy, viewProxyOther, linkName):
00516     """Create a camera link between two view proxies.  A name must be given
00517     so that the link can be referred to by name.  If a link with the given
00518     name already exists it will be removed first."""
00519     if not viewProxyOther: viewProxyOther = GetActiveView()
00520     link = servermanager.vtkSMCameraLink()
00521     link.AddLinkedProxy(viewProxy.SMProxy, 1)
00522     link.AddLinkedProxy(viewProxyOther.SMProxy, 2)
00523     link.AddLinkedProxy(viewProxyOther.SMProxy, 1)
00524     link.AddLinkedProxy(viewProxy.SMProxy, 2)
00525     RemoveCameraLink(linkName)
00526     servermanager.ProxyManager().RegisterLink(linkName, link)

Here is the call graph for this function:

def pvsimple.AnimateReader (   reader = None,
  view = None,
  filename = None 
)
This is a utility function that, given a reader and a view
animates over all time steps of the reader. If the optional
filename is provided, a movie is created (type depends on the
extension of the filename.

Definition at line 555 of file pvsimple.py.

00555 
00556 def AnimateReader(reader=None, view=None, filename=None):
00557     """This is a utility function that, given a reader and a view
00558     animates over all time steps of the reader. If the optional
00559     filename is provided, a movie is created (type depends on the
00560     extension of the filename."""
00561     if not reader:
00562         reader = active_objects.source
00563     if not view:
00564         view = active_objects.view
00565         
00566     return servermanager.AnimateReader(reader, view, filename)
00567 

def pvsimple.Connect (   ds_host = None,
  ds_port = 11111,
  rs_host = None,
  rs_port = 11111 
)
Creates a connection to a server. Example usage:
> Connect("amber") # Connect to a single server at default port
> Connect("amber", 12345) # Connect to a single server at port 12345
> Connect("amber", 11111, "vis_cluster", 11111) # connect to data server, render server pair

Definition at line 54 of file pvsimple.py.

00054 
00055 def Connect(ds_host=None, ds_port=11111, rs_host=None, rs_port=11111):
00056     """Creates a connection to a server. Example usage:
00057     > Connect("amber") # Connect to a single server at default port
00058     > Connect("amber", 12345) # Connect to a single server at port 12345
00059     > Connect("amber", 11111, "vis_cluster", 11111) # connect to data server, render server pair"""
00060     _disconnect()
00061     session = servermanager.Connect(ds_host, ds_port, rs_host, rs_port)
00062     _add_functions(globals())
00063 
00064     tk =  servermanager.misc.TimeKeeper()
00065     servermanager.ProxyManager().RegisterProxy("timekeeper", "tk", tk)
00066     scene = AnimationScene()
00067     scene.TimeKeeper = tk
00068     return session

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 122 of file pvsimple.py.

00122 
00123 def Create2DRenderView():
00124     return _create_view("2DRenderView")

Here is the call graph for this function:

Definition at line 107 of file pvsimple.py.

00107 
00108 def CreateBarChartView():
00109     return _create_view("XYBarChartView")

Here is the call graph for this function:

Definition at line 116 of file pvsimple.py.

00116 
00117 def CreateComparativeBarChartView():
00118     return _create_view("ComparativeBarChartView")

Here is the call graph for this function:

Definition at line 110 of file pvsimple.py.

00110 
00111 def CreateComparativeRenderView():
00112     return _create_view("ComparativeRenderView")

Here is the call graph for this function:

Definition at line 113 of file pvsimple.py.

00113 
00114 def CreateComparativeXYPlotView():
00115     return _create_view("ComparativeXYPlotView")
 

Here is the call graph for this function:

def pvsimple.CreateLookupTable (   params)
Create and return a lookup table.  Optionally, parameters can be given
to assign to the lookup table.

Definition at line 426 of file pvsimple.py.

00426 
00427 def CreateLookupTable(**params):
00428     """Create and return a lookup table.  Optionally, parameters can be given
00429     to assign to the lookup table.
00430     """
00431     lt = servermanager.rendering.PVLookupTable()
00432     servermanager.Register(lt)
00433     SetProperties(lt, **params)
00434     return lt

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 119 of file pvsimple.py.

00119 
00120 def CreateParallelCoordinatesChartView():
00121     return _create_view("ParallelCoordinatesChartView")

Here is the call graph for this function:

Create and return a piecewise function.  Optionally, parameters can be
given to assign to the piecewise function.

Definition at line 435 of file pvsimple.py.

00435 
00436 def CreatePiecewiseFunction(**params):
00437     """Create and return a piecewise function.  Optionally, parameters can be
00438     given to assign to the piecewise function.
00439     """
00440     pfunc = servermanager.piecewise_functions.PiecewiseFunction()
00441     servermanager.Register(pfunc)
00442     SetProperties(pfunc, **params)
00443     return pfunc

Here is the call graph for this function:

Definition at line 101 of file pvsimple.py.

00101 
00102 def CreateRenderView():
00103     return _create_view("RenderView")

Here is the call graph for this function:

Here is the caller graph for this function:

def pvsimple.CreateScalarBar (   params)
Create and return a scalar bar widget.  The returned widget may
be added to a render view by appending it to the view's representations
The widget must have a valid lookup table before it is added to a view.
It is possible to pass the lookup table (and other properties) as arguments
to this method:

lt = MakeBlueToRedLt(3.5, 7.5)
bar = CreateScalarBar(LookupTable=lt, Title="Velocity")
GetRenderView().Representations.append(bar)

By default the returned widget is selectable and resizable.

Definition at line 462 of file pvsimple.py.

00462 
00463 def CreateScalarBar(**params):
00464     """Create and return a scalar bar widget.  The returned widget may
00465     be added to a render view by appending it to the view's representations
00466     The widget must have a valid lookup table before it is added to a view.
00467     It is possible to pass the lookup table (and other properties) as arguments
00468     to this method:
00469     
00470     lt = MakeBlueToRedLt(3.5, 7.5)
00471     bar = CreateScalarBar(LookupTable=lt, Title="Velocity")
00472     GetRenderView().Representations.append(bar)
00473     
00474     By default the returned widget is selectable and resizable.
00475     """
00476     sb = servermanager.rendering.ScalarBarWidgetRepresentation()
00477     servermanager.Register(sb)
00478     sb.Selectable = 1
00479     sb.Resizable = 1
00480     sb.Enabled = 1
00481     sb.Title = "Scalars"
00482     SetProperties(sb, **params)
00483     return sb
00484 
00485 # TODO: Change this to take the array name and number of components. Register 
# the lt under the name ncomp.array_name

Here is the call graph for this function:

def pvsimple.CreateWriter (   filename,
  proxy = None,
  extraArgs 
)
Creates a writer that can write the data produced by the source proxy in
   the given file format (identified by the extension). If no source is
   provided, then the active source is used. This doesn't actually write the
   data, it simply creates the writer and returns it.

Definition at line 150 of file pvsimple.py.

00150 
00151 def CreateWriter(filename, proxy=None, **extraArgs):
00152     """Creates a writer that can write the data produced by the source proxy in
00153        the given file format (identified by the extension). If no source is
00154        provided, then the active source is used. This doesn't actually write the
00155        data, it simply creates the writer and returns it."""
00156     if not filename:
00157        raise RuntimeError, "filename must be specified"
00158     writer_factory = servermanager.ProxyManager().GetWriterFactory()
00159     if writer_factory.GetNumberOfRegisteredPrototypes() == 0:
00160         writer_factory.RegisterPrototypes("writers")
00161     if not proxy:
00162         proxy = GetActiveSource()
00163     if not proxy:
00164         raise RuntimeError, "Could not locate source to write"
00165     writer_proxy = writer_factory.CreateWriter(filename, proxy.SMProxy, proxy.Port)
00166     return servermanager._getPyProxy(writer_proxy)

Here is the call graph for this function:

Definition at line 104 of file pvsimple.py.

00104 
00105 def CreateXYPlotView():
00106     return _create_view("XYChartView")

Here is the call graph for this function:

def pvsimple.Delete (   proxy = None)
Deletes the given pipeline object or the active source if no argument
is specified.

Definition at line 357 of file pvsimple.py.

00357 
00358 def Delete(proxy=None):
00359     """Deletes the given pipeline object or the active source if no argument
00360     is specified."""
00361     if not proxy:
00362         proxy = active_objects.source
00363     # Unregister any helper proxies stored by a vtkSMProxyListDomain
00364     for prop in proxy:
00365         listdomain = prop.GetDomain('proxy_list')
00366         if listdomain:
00367             if listdomain.GetClassName() != 'vtkSMProxyListDomain':
00368                 continue
00369             group = "pq_helper_proxies." + proxy.GetGlobalIDAsString()
00370             for i in xrange(listdomain.GetNumberOfProxies()):
00371                 pm = servermanager.ProxyManager()
00372                 iproxy = listdomain.GetProxy(i)
00373                 name = pm.GetProxyName(group, iproxy)
00374                 if iproxy and name:
00375                     pm.UnRegisterProxy(group, name, iproxy)
00376                     
00377     # Remove source/view from time keeper
00378     tk = servermanager.ProxyManager().GetProxiesInGroup("timekeeper").values()[0]
00379     if isinstance(proxy, servermanager.SourceProxy):
00380         try:
00381             idx = tk.TimeSources.index(proxy)
00382             del tk.TimeSources[idx]
00383         except ValueError:
00384             pass
00385     else:
00386         try:
00387             idx = tk.Views.index(proxy)
00388             del tk.Views[idx]
00389         except ValueError:
00390             pass
00391     servermanager.UnRegister(proxy)
00392     
00393     # If this is a representation, remove it from all views.
00394     if proxy.SMProxy.IsA("vtkSMRepresentationProxy") or \
00395         proxy.SMProxy.IsA("vtkSMNewWidgetRepresentationProxy"):
00396         for view in GetRenderViews():
00397             view.Representations.remove(proxy)
00398     # If this is a source, remove the representation iff it has no consumers
00399     # Also change the active source if necessary
00400     elif proxy.SMProxy.IsA("vtkSMSourceProxy"):
00401         sources = servermanager.ProxyManager().GetProxiesInGroup("sources")
00402         for i in range(proxy.GetNumberOfConsumers()):
00403             if proxy.GetConsumerProxy(i) in sources:
00404                 raise RuntimeError("Source has consumers. It cannot be deleted " +
00405                   "until all consumers are deleted.")
00406         #VSV:==
00407         if proxy.IsSame(GetActiveSource()):
00408             if hasattr(proxy, "Input") and proxy.Input:
00409                 if isinstance(proxy.Input, servermanager.Proxy):
00410                     SetActiveSource(proxy.Input)
00411                 else:
00412                     SetActiveSource(proxy.Input[0])
00413             else: SetActiveSource(None)
00414         for rep in GetRepresentations().values():
00415             #VSV:==
00416             if rep.Input.IsSame(proxy):
00417                 Delete(rep)
00418     # Change the active view if necessary
00419     elif proxy.SMProxy.IsA("vtkSMRenderViewProxy"):
00420         ##VSV:==
00421         if proxy.IsSame(GetActiveView()):
00422             if len(GetRenderViews()) > 0:
00423                 SetActiveView(GetRenderViews()[0])
00424             else:
00425                 SetActiveView(None)

Here is the call graph for this function:

Here is the caller graph for this function:

def pvsimple.demo1 ( )
Simple demo that create the following pipeline
sphere - shrink - \
                   - append
cone            - /

Definition at line 961 of file pvsimple.py.

00961 
00962 def demo1():
00963     """Simple demo that create the following pipeline
00964     sphere - shrink - \
00965                        - append
00966     cone            - /
00967     """
00968     # Create a sphere of radius = 2, theta res. = 32
00969     # This object becomes the active source.
00970     ss = Sphere(Radius=2, ThetaResolution=32)
00971     # Apply the shrink filter. The Input property is optional. If Input
00972     # is not specified, the filter is applied to the active source.
00973     shr = Shrink(Input=ss)
00974     # Create a cone source.
00975     cs = Cone()
00976     # Append cone and shrink
00977     app = AppendDatasets()
00978     app.Input = [shr, cs]
00979     # Show the output of the append filter. The argument is optional
00980     # as the app filter is now the active object.
00981     Show(app)
00982     # Render the default view.
00983     Render()

Here is the call graph for this function:

def pvsimple.demo2 (   fname = "/Users/berk/Work/ParaView/ParaViewData/Data/disk_out_ref.ex2")
This demo shows the use of readers, data information and display
properties.

Definition at line 984 of file pvsimple.py.

00984 
00985 def demo2(fname="/Users/berk/Work/ParaView/ParaViewData/Data/disk_out_ref.ex2"):
00986     """This demo shows the use of readers, data information and display
00987     properties."""
00988     
00989     # Create the exodus reader and specify a file name
00990     reader = ExodusIIReader(FileName=fname)
00991     # Get the list of point arrays.
00992     avail = reader.PointVariables.Available
00993     print avail
00994     # Select all arrays
00995     reader.PointVariables = avail
00996 
00997     # Turn on the visibility of the reader
00998     Show(reader)
00999     # Set representation to wireframe
01000     SetDisplayProperties(Representation = "Wireframe")
01001     # Black background is not pretty
01002     SetViewProperties(Background = [0.4, 0.4, 0.6])
01003     Render()
01004     # Change the elevation of the camera. See VTK documentation of vtkCamera
01005     # for camera parameters.
01006     # NOTE: THIS WILL BE SIMPLER
01007     GetActiveCamera().Elevation(45)
01008     Render()
01009     # Now that the reader executed, let's get some information about it's
01010     # output.
01011     pdi = reader[0].PointData
01012     # This prints a list of all read point data arrays as well as their
01013     # value ranges.
01014     print 'Number of point arrays:', len(pdi)
01015     for i in range(len(pdi)):
01016         ai = pdi[i]
01017         print "----------------"
01018         print "Array:", i, " ", ai.Name, ":"
01019         numComps = ai.GetNumberOfComponents()
01020         print "Number of components:", numComps
01021         for j in range(numComps):
01022             print "Range:", ai.GetRange(j)
01023     # White is boring. Let's color the geometry using a variable.
01024     # First create a lookup table. This object controls how scalar
01025     # values are mapped to colors. See VTK documentation for
01026     # details.
01027     # Map min (0.00678) to blue, max (0.0288) to red
01028     SetDisplayProperties(LookupTable = MakeBlueToRedLT(0.00678, 0.0288))
01029     # Color by point array called Pres
01030     SetDisplayProperties(ColorAttributeType = "POINT_DATA")
01031     SetDisplayProperties(ColorArrayName = "Pres")
01032     Render()

Here is the call graph for this function:

def pvsimple.FindSource (   name)

Definition at line 335 of file pvsimple.py.

00335 
00336 def FindSource(name):
00337     return servermanager.ProxyManager().GetProxy("sources", name)

Returns the active camera for the active view. The returned object
is an instance of vtkCamera.

Definition at line 684 of file pvsimple.py.

00684 
00685 def GetActiveCamera():
00686     """Returns the active camera for the active view. The returned object
00687     is an instance of vtkCamera."""
00688     return GetActiveView().GetActiveCamera()

Here is the call graph for this function:

Here is the caller graph for this function:

Returns the active source.

Definition at line 676 of file pvsimple.py.

00676 
00677 def GetActiveSource():
00678     """Returns the active source."""
00679     return active_objects.source
    

Here is the caller graph for this function:

Returns the active view.

Definition at line 668 of file pvsimple.py.

00668 
00669 def GetActiveView():
00670     """Returns the active view."""
00671     return active_objects.view
    

Here is the caller graph for this function:

Returns the application-wide animation scene. ParaView has only one
global animation scene. This method provides access to that. Users are
free to create additional animation scenes directly, but those scenes
won't be shown in the ParaView GUI.

Definition at line 689 of file pvsimple.py.

00689 
00690 def GetAnimationScene():
00691     """Returns the application-wide animation scene. ParaView has only one
00692     global animation scene. This method provides access to that. Users are
00693     free to create additional animation scenes directly, but those scenes
00694     won't be shown in the ParaView GUI."""
00695     animation_proxies = servermanager.ProxyManager().GetProxiesInGroup("animation")
00696     scene = None
00697     for aProxy in animation_proxies.values():
00698         if aProxy.GetXMLName() == "AnimationScene":
00699             scene = aProxy
00700             break
00701     if not scene:
00702         raise servermanager.MissingProxy, "Could not locate global AnimationScene."
00703     return scene

Here is the caller graph for this function:

def pvsimple.GetAnimationTrack (   propertyname_or_property,
  index = None,
  proxy = None 
)
Returns an animation cue for the property. If one doesn't exist then a
new one will be created.
Typical usage:
    track = GetAnimationTrack("Center", 0, sphere) or
    track = GetAnimationTrack(sphere.GetProperty("Radius")) or

    # this returns the track to animate visibility of the active source in
    # all views.
    track = GetAnimationTrack("Visibility")

 For animating properties on implicit planes etc., use the following
 signatures:
    track = GetAnimationTrack(slice.SliceType.GetProperty("Origin"), 0) or
    track = GetAnimationTrack("Origin", 0, slice.SliceType)

Definition at line 755 of file pvsimple.py.

00755 
00756 def GetAnimationTrack(propertyname_or_property, index=None, proxy=None):
00757     """Returns an animation cue for the property. If one doesn't exist then a
00758     new one will be created.
00759     Typical usage:
00760         track = GetAnimationTrack("Center", 0, sphere) or
00761         track = GetAnimationTrack(sphere.GetProperty("Radius")) or
00762 
00763         # this returns the track to animate visibility of the active source in
00764         # all views.
00765         track = GetAnimationTrack("Visibility")
00766 
00767      For animating properties on implicit planes etc., use the following
00768      signatures:
00769         track = GetAnimationTrack(slice.SliceType.GetProperty("Origin"), 0) or
00770         track = GetAnimationTrack("Origin", 0, slice.SliceType)
00771 
00772     """
00773     if not proxy:
00774         proxy = GetActiveSource()
00775     if not isinstance(proxy, servermanager.Proxy):
00776         raise TypeError, "proxy must be a servermanager.Proxy instance"
00777     if isinstance(propertyname_or_property, str):
00778         propertyname = propertyname_or_property
00779     elif isinstance(propertyname_or_property, servermanager.Property):
00780         prop = propertyname_or_property
00781         propertyname = prop.Name
00782         proxy = prop.Proxy
00783     else:
00784         raise TypeError, "propertyname_or_property must be a string or servermanager.Property"
00785 
00786     # To handle the case where the property is actually a "display" property, in
00787     # which case we are actually animating the "RepresentationAnimationHelper"
00788     # associated with the source.
00789     if propertyname in ["Visibility", "Opacity"]:
00790         proxy = _GetRepresentationAnimationHelper(proxy)
00791     if not proxy or not proxy.GetProperty(propertyname):
00792         raise AttributeError, "Failed to locate property %s" % propertyname
00793 
00794     scene = GetAnimationScene()
00795     for cue in scene.Cues:
00796         try:
00797             if cue.AnimatedProxy.IsSame(proxy) and\
00798                cue.AnimatedPropertyName == propertyname:
00799                 if index == None or index.IsSame(cue.AnimatedElement): ##index == cue.AnimatedElement:
00800                     return cue
00801         except AttributeError:
00802             pass
00803 
00804     # matching animation track wasn't found, create a new one.
00805     cue = KeyFrameAnimationCue()
00806     cue.AnimatedProxy = proxy
00807     cue.AnimatedPropertyName = propertyname
00808     if index != None:
00809         cue.AnimatedElement = index
00810     scene.Cues.append(cue)
00811     return cue

Here is the call graph for this function:

def pvsimple.GetCameraTrack (   view = None)
Returns the camera animation track for the given view. If no view is
specified, active view will be used. If no exisiting camera animation track
is found, a new one will be created.

Definition at line 812 of file pvsimple.py.

00812 
00813 def GetCameraTrack(view=None):
00814     """Returns the camera animation track for the given view. If no view is
00815     specified, active view will be used. If no exisiting camera animation track
00816     is found, a new one will be created."""
00817     if not view:
00818         view = GetActiveView()
00819     if not view:
00820         raise ValueError, "No view specified"
00821     scene = GetAnimationScene()
00822     for cue in scene.Cues:
00823         if cue.AnimatedProxy.IsSame(view) and\
00824            cue.GetXMLName() == "CameraAnimationCue":
00825             return cue
00826     # no cue was found, create a new one.
00827     cue = CameraAnimationCue()
00828     cue.AnimatedProxy = view
00829     scene.Cues.append(cue)
00830     return cue

Here is the call graph for this function:

def pvsimple.GetDisplayProperties (   proxy = None,
  view = None 
)
Given a pipeline object and view, returns the corresponding representation object.
If pipeline object and/or view are not specified, active objects are used.

Definition at line 197 of file pvsimple.py.

00197 
00198 def GetDisplayProperties(proxy=None, view=None):
00199     """Given a pipeline object and view, returns the corresponding representation object.
00200     If pipeline object and/or view are not specified, active objects are used."""
00201     return GetRepresentation(proxy, view)
    

Here is the call graph for this function:

Here is the caller graph for this function:

def pvsimple.GetLookupTableForArray (   arrayname,
  num_components,
  params 
)
Used to get an existing lookuptable for a array or to create one if none
exists. Keyword arguments can be passed in to initialize the LUT if a new
one is created.

Definition at line 444 of file pvsimple.py.

00444 
00445 def GetLookupTableForArray(arrayname, num_components, **params):
00446     """Used to get an existing lookuptable for a array or to create one if none
00447     exists. Keyword arguments can be passed in to initialize the LUT if a new
00448     one is created."""
00449     proxyName = "%d.%s.PVLookupTable" % (int(num_components), arrayname)
00450     lut = servermanager.ProxyManager().GetProxy("lookup_tables", proxyName)
00451     if lut:
00452         return lut
00453     # No LUT exists for this array, create a new one.
00454     # TODO: Change this to go a LookupTableManager that is shared with the GUI,
00455     # so that the GUI and python end up create same type of LUTs. For now,
00456     # python will create a Blue-Red LUT, unless overridden by params.
00457     lut = servermanager.rendering.PVLookupTable(
00458             ColorSpace="HSV", RGBPoints=[0, 0, 0, 1, 1, 1, 0, 0])
00459     SetProperties(lut, **params)
00460     servermanager.Register(lut, registrationName=proxyName)
00461     return lut

Here is the call graph for this function:

def pvsimple.GetProperty (   arguments,
  keywords 
)
Get one property of the given pipeline object. If keywords are used,
   you can set the proxy and the name of the property that you want to get
   like in the following example :
        GetProperty({proxy=sphere, name="Radius"})
   If it's arguments that are used, then you have two case:
     - if only one argument is used that argument will be
       the property name.
     - if two arguments are used then the first one will be
       the proxy and the second one the property name.
   Several example are given below:
       GetProperty({name="Radius"})
       GetProperty({proxy=sphereProxy, name="Radius"})
       GetProperty( sphereProxy, "Radius" )
       GetProperty( "Radius" )

Definition at line 270 of file pvsimple.py.

00270 
00271 def GetProperty(*arguments, **keywords):
00272     """Get one property of the given pipeline object. If keywords are used,
00273        you can set the proxy and the name of the property that you want to get
00274        like in the following example :
00275             GetProperty({proxy=sphere, name="Radius"})
00276        If it's arguments that are used, then you have two case:
00277          - if only one argument is used that argument will be
00278            the property name.
00279          - if two arguments are used then the first one will be
00280            the proxy and the second one the property name.
00281        Several example are given below:
00282            GetProperty({name="Radius"})
00283            GetProperty({proxy=sphereProxy, name="Radius"})
00284            GetProperty( sphereProxy, "Radius" )
00285            GetProperty( "Radius" )
00286     """
00287     name = None
00288     proxy = None
00289     for key in keywords:
00290         if key == "name":
00291             name = keywords[key]
00292         if key == "proxy":
00293             proxy = keywords[key]
00294     if len(arguments) == 1 :
00295         name = arguments[0]
00296     if len(arguments) == 2 :
00297         proxy = arguments[0]
00298         name  = arguments[1]
00299     if not name:
00300         raise RuntimeError, "Expecting at least a property name as input. Otherwise keyword could be used to set 'proxy' and property 'name'"
00301     if not proxy:
00302         proxy = active_objects.source
00303     return proxy.GetProperty(name)

Here is the caller graph for this function:

Returns the active view if there is one. Else creates and returns a new view.

Definition at line 167 of file pvsimple.py.

00167 
00168 def GetRenderView():
00169     """Returns the active view if there is one. Else creates and returns a new view."""
00170     view = active_objects.view
00171     if not view:
00172         # it's possible that there's no active view, but a render view exists.
00173         # If so, locate that and return it (before trying to create a new one).
00174         view = servermanager.GetRenderView()
00175     if not view:
00176         view = CreateRenderView()
00177     return view

Here is the call graph for this function:

Returns all render views as a list.

Definition at line 178 of file pvsimple.py.

00178 
00179 def GetRenderViews():
00180     """Returns all render views as a list."""
00181     return servermanager.GetRenderViews()

Here is the caller graph for this function:

def pvsimple.GetRepresentation (   proxy = None,
  view = None 
)
Given a pipeline object and view, returns the corresponding representation object.
If pipeline object and view are not specified, active objects are used.

Definition at line 182 of file pvsimple.py.

00182 
00183 def GetRepresentation(proxy=None, view=None):
00184     """Given a pipeline object and view, returns the corresponding representation object.
00185     If pipeline object and view are not specified, active objects are used."""
00186     if not view:
00187         view = active_objects.view
00188     if not proxy:
00189         proxy = active_objects.source
00190     rep = servermanager.GetRepresentation(proxy, view)
00191     if not rep:
00192         rep = servermanager.CreateRepresentation(proxy, view)
00193         servermanager.ProxyManager().RegisterProxy("representations", \
00194           "my_representation%d" % _funcs_internals.rep_counter, rep)
00195         _funcs_internals.rep_counter += 1
00196     return rep
    

Here is the caller graph for this function:

Returns all representations (display properties).

Definition at line 342 of file pvsimple.py.

00342 
00343 def GetRepresentations():
00344     """Returns all representations (display properties)."""
00345     return servermanager.ProxyManager().GetProxiesInGroup("representations")

Here is the caller graph for this function:

Given the name of a source, return its Python object.

Definition at line 338 of file pvsimple.py.

00338 
00339 def GetSources():
00340     """Given the name of a source, return its Python object."""
00341     return servermanager.ProxyManager().GetProxiesInGroup("sources")

Here is the caller graph for this function:

Returns the animation track used to control the time requested from all
readers/filters during playback.
This is the "TimeKeeper - Time" track shown in ParaView's 'Animation View'.
If none exists, a new one will be created.

Definition at line 831 of file pvsimple.py.

00831 
00832 def GetTimeTrack():
00833     """Returns the animation track used to control the time requested from all
00834     readers/filters during playback.
00835     This is the "TimeKeeper - Time" track shown in ParaView's 'Animation View'.
00836     If none exists, a new one will be created."""
00837     scene = GetAnimationScene()
00838     tk = scene.TimeKeeper
00839     for cue in scene.Cues:
00840         if cue.GetXMLName() == "TimeAnimationCue" and cue.AnimatedProxy.IsSame(tk)\
00841             and cue.AnimatedPropertyName == "Time":
00842             return cue
00843     # no cue was found, create a new one.
00844     cue = TimeAnimationCue()
00845     cue.AnimatedProxy = tk
00846     cue.AnimatedPropertyName = "Time"
00847     scene.Cues.append(cue)
00848     return cue

Here is the call graph for this function:

Here is the caller graph for this function:

def pvsimple.Hide (   proxy = None,
  view = None 
)
Turns the visibility of a given pipeline object off in the given view.
If pipeline object and/or view are not specified, active objects are used.

Definition at line 219 of file pvsimple.py.

00219 
00220 def Hide(proxy=None, view=None):
00221     """Turns the visibility of a given pipeline object off in the given view.
00222     If pipeline object and/or view are not specified, active objects are used."""
00223     rep = GetDisplayProperties(proxy, view)
00224     rep.Visibility = 0

Here is the call graph for this function:

Here is the caller graph for this function:

def pvsimple.ImportFile (   theFileName)

Definition at line 1045 of file pvsimple.py.

01045 
01046 def ImportFile(theFileName):
01047     paravisSM.ImportFile(theFileName)

def pvsimple.LoadDistributedPlugin (   pluginname,
  remote = True,
  ns = None 
)
Loads a plugin that's distributed with the executable. This uses the
information known about plugins distributed with ParaView to locate the
shared library for the plugin to load. Raises a RuntimeError if the plugin
was not found.

Definition at line 876 of file pvsimple.py.

00876 
00877 def LoadDistributedPlugin(pluginname, remote=True, ns=None):
00878     """Loads a plugin that's distributed with the executable. This uses the
00879     information known about plugins distributed with ParaView to locate the
00880     shared library for the plugin to load. Raises a RuntimeError if the plugin
00881     was not found."""
00882     plm = servermanager.ProxyManager().GetSession().GetPluginManager()
00883     if remote:
00884         info = plm.GetRemoteInformation()
00885     else:
00886         info = plm.GetLocalInformation()
00887     for cc in range(0, info.GetNumberOfPlugins()):
00888         if info.GetPluginName(cc) == pluginname:
00889             return LoadPlugin(info.GetPluginFileName(cc), remote, ns)
00890     raise RuntimeError, "Plugin '%s' not found" % pluginname
00891 

Here is the call graph for this function:

def pvsimple.LoadPlugin (   filename,
  remote = True,
  ns = None 
)
Loads a ParaView plugin and updates this module with new constructors
if any. The remote argument (default to True) is to specify whether 
the plugin will be loaded on client (remote=False) or on server (remote=True).
If you loaded the simple module with from paraview.simple import *,
make sure to pass globals() as an argument:
LoadPlugin("myplugin", False, globals()), to load on client;
LoadPlugin("myplugin", True, globals()), to load on server; 
LoadPlugin("myplugin", ns=globals()), to load on server.
Otherwise, the new functions will not appear in the global namespace.

Definition at line 860 of file pvsimple.py.

00860 
00861 def LoadPlugin(filename, remote=True, ns=None):
00862     """Loads a ParaView plugin and updates this module with new constructors
00863     if any. The remote argument (default to True) is to specify whether 
00864     the plugin will be loaded on client (remote=False) or on server (remote=True).
00865     If you loaded the simple module with from paraview.simple import *,
00866     make sure to pass globals() as an argument:
00867     LoadPlugin("myplugin", False, globals()), to load on client;
00868     LoadPlugin("myplugin", True, globals()), to load on server; 
00869     LoadPlugin("myplugin", ns=globals()), to load on server.
00870     Otherwise, the new functions will not appear in the global namespace."""
00871     
00872     if not ns:
00873         ns = globals()
00874     servermanager.LoadPlugin(filename, remote)
00875     _add_functions(ns)

Here is the call graph for this function:

Here is the caller graph for this function:

def pvsimple.LoadXML (   xmlstring,
  ns = None 
)
Given a server manager XML as a string, parse and process it.
If you loaded the simple module with from paraview.simple import *,
make sure to pass globals() as the second arguments:
LoadXML(xmlstring, globals())
Otherwise, the new functions will not appear in the global namespace.

Definition at line 849 of file pvsimple.py.

00849 
00850 def LoadXML(xmlstring, ns=None):
00851     """Given a server manager XML as a string, parse and process it.
00852     If you loaded the simple module with from paraview.simple import *,
00853     make sure to pass globals() as the second arguments:
00854     LoadXML(xmlstring, globals())
00855     Otherwise, the new functions will not appear in the global namespace."""
00856     if not ns:
00857         ns = globals()
00858     servermanager.LoadXML(xmlstring)
00859     _add_functions(ns)

Here is the call graph for this function:

def pvsimple.MakeBlueToRedLT (   min,
  max 
)

Definition at line 486 of file pvsimple.py.

00486 
00487 def MakeBlueToRedLT(min, max):
00488     # Define RGB points. These are tuples of 4 values. First one is
00489     # the scalar values, the other 3 the RGB values. 
00490     rgbPoints = [min, 0, 0, 1, max, 1, 0, 0]
00491     return CreateLookupTable(RGBPoints=rgbPoints, ColorSpace="HSV")
    

Here is the call graph for this function:

Here is the caller graph for this function:

def pvsimple.OpenDataFile (   filename,
  extraArgs 
)
Creates a reader to read the give file, if possible.
   This uses extension matching to determine the best reader possible.
   If a reader cannot be identified, then this returns None.

Definition at line 125 of file pvsimple.py.

00125 
00126 def OpenDataFile(filename, **extraArgs):
00127     """Creates a reader to read the give file, if possible.
00128        This uses extension matching to determine the best reader possible.
00129        If a reader cannot be identified, then this returns None."""
00130     reader_factor = servermanager.ProxyManager().GetReaderFactory()
00131     if  reader_factor.GetNumberOfRegisteredPrototypes() == 0:
00132       reader_factor.RegisterPrototypes("sources")
00133     session = servermanager.ActiveConnection.Session
00134     first_file = filename
00135     if type(filename) == list:
00136         first_file = filename[0]
00137     if not reader_factor.TestFileReadability(first_file, session):
00138         raise RuntimeError, "File not readable: %s " % first_file
00139     if not reader_factor.CanReadFile(first_file, session):
00140         raise RuntimeError, "File not readable. No reader found for '%s' " % first_file
00141     prototype = servermanager.ProxyManager().GetPrototypeProxy(
00142       reader_factor.GetReaderGroup(), reader_factor.GetReaderName())
00143     xml_name = paraview.make_name_valid(prototype.GetXMLLabel())
00144     reader_func = _create_func(xml_name, servermanager.sources)
00145     if prototype.GetProperty("FileNames"):
00146       reader = reader_func(FileNames=filename, **extraArgs)
00147     else :
00148       reader = reader_func(FileName=filename, **extraArgs)
00149     return reader

Here is the call graph for this function:

Definition at line 1033 of file pvsimple.py.

01033 
01034 def PrintTrace():
01035     print paravisSM.myParavis.GetTrace()

def pvsimple.RemoveCameraLink (   linkName)
Remove a camera link with the given name.

Definition at line 527 of file pvsimple.py.

00527 
00528 def RemoveCameraLink(linkName):
00529     """Remove a camera link with the given name."""
00530     servermanager.ProxyManager().UnRegisterLink(linkName)

Here is the caller graph for this function:

def pvsimple.RenameSource (   newName,
  proxy = None 
)
Renames the given source.  If the given proxy is not registered
in the sources group this method will have no effect.  If no source is
provided, the active source is used.

Definition at line 323 of file pvsimple.py.

00323 
00324 def RenameSource(newName, proxy=None):
00325     """Renames the given source.  If the given proxy is not registered
00326     in the sources group this method will have no effect.  If no source is
00327     provided, the active source is used."""
00328     if not proxy:
00329         proxy = active_objects.source
00330     pxm = servermanager.ProxyManager()
00331     oldName = pxm.GetProxyName("sources", proxy)
00332     if oldName:
00333       pxm.RegisterProxy("sources", newName, proxy)
00334       pxm.UnRegisterProxy("sources", oldName, proxy)

def pvsimple.Render (   view = None)
Renders the given view (default value is active view)

Definition at line 225 of file pvsimple.py.

00225 
00226 def Render(view=None):
00227     """Renders the given view (default value is active view)"""
00228     if not view:
00229         view = active_objects.view
00230     view.StillRender()
00231     if _funcs_internals.first_render:
00232         # Not all views have a ResetCamera method
00233         try:
00234             view.ResetCamera()
00235             view.StillRender()
00236         except AttributeError: pass
00237         _funcs_internals.first_render = False
00238     return view
        

Here is the caller graph for this function:

def pvsimple.ResetCamera (   view = None)
Resets the settings of the camera to preserver orientation but include
the whole scene. If an argument is not provided, the active view is
used.

Definition at line 239 of file pvsimple.py.

00239 
00240 def ResetCamera(view=None):
00241     """Resets the settings of the camera to preserver orientation but include
00242     the whole scene. If an argument is not provided, the active view is
00243     used."""
00244     if not view:
00245         view = active_objects.view
00246     if hasattr(view, "ResetCamera"):
00247         view.ResetCamera()
00248     if hasattr(view, "ResetDisplay"):
00249         view.ResetDisplay()
00250     Render(view)

Here is the call graph for this function:

def pvsimple.ReverseConnect (   port = 11111)
Create a reverse connection to a server.  Listens on port and waits for
an incoming connection from the server.

Definition at line 69 of file pvsimple.py.

00069 
00070 def ReverseConnect(port=11111):
00071     """Create a reverse connection to a server.  Listens on port and waits for
00072     an incoming connection from the server."""
00073     _disconnect()
00074     session = servermanager.ReverseConnect(port)
00075     _add_functions(globals())
00076     tk =  servermanager.misc.TimeKeeper()
00077     servermanager.ProxyManager().RegisterProxy("timekeeper", "tk", tk)
00078     scene = AnimationScene()
00079     scene.TimeKeeper = tk
00080     return session

Here is the call graph for this function:

def pvsimple.SaveTrace (   fileName)

Definition at line 1036 of file pvsimple.py.

01036 
01037 def SaveTrace(fileName):
01038     paravisSM.myParavis.SaveTrace(fileName)
01039 
01040 
01041 _add_functions(globals())

Here is the call graph for this function:

def pvsimple.SetActiveSource (   source)
Sets the active source.

Definition at line 680 of file pvsimple.py.

00680 
00681 def SetActiveSource(source):
00682     """Sets the active source."""
00683     active_objects.source = source
    

Here is the caller graph for this function:

def pvsimple.SetActiveView (   view)
Sets the active view.

Definition at line 672 of file pvsimple.py.

00672 
00673 def SetActiveView(view):
00674     """Sets the active view."""
00675     active_objects.view = view
    

Here is the caller graph for this function:

def pvsimple.SetDisplayProperties (   proxy = None,
  view = None,
  params 
)
Sets one or more display properties of the given pipeline object. If an argument
is not provided, the active source is used. Pass a list of property_name=value
pairs to this function to set property values. For example:
 SetProperties(Color=[1, 0, 0], LineWidth=2)

Definition at line 304 of file pvsimple.py.

00304 
00305 def SetDisplayProperties(proxy=None, view=None, **params):
00306     """Sets one or more display properties of the given pipeline object. If an argument
00307     is not provided, the active source is used. Pass a list of property_name=value
00308     pairs to this function to set property values. For example:
00309      SetProperties(Color=[1, 0, 0], LineWidth=2)
00310     """
00311     rep = GetDisplayProperties(proxy, view)
00312     SetProperties(rep, **params)

Here is the call graph for this function:

Here is the caller graph for this function:

def pvsimple.SetProperties (   proxy = None,
  params 
)
Sets one or more properties of the given pipeline object. If an argument
is not provided, the active source is used. Pass a list of property_name=value
pairs to this function to set property values. For example:
 SetProperties(Center=[1, 2, 3], Radius=3.5)

Definition at line 257 of file pvsimple.py.

00257 
00258 def SetProperties(proxy=None, **params):
00259     """Sets one or more properties of the given pipeline object. If an argument
00260     is not provided, the active source is used. Pass a list of property_name=value
00261     pairs to this function to set property values. For example:
00262      SetProperties(Center=[1, 2, 3], Radius=3.5)
00263     """
00264     if not proxy:
00265         proxy = active_objects.source
00266     for param in params.keys():
00267         if not hasattr(proxy, param):
00268             raise AttributeError("object has no property %s" % param)
00269         setattr(proxy, param, params[param])

Here is the caller graph for this function:

def pvsimple.SetViewProperties (   view = None,
  params 
)
Sets one or more properties of the given view. If an argument
is not provided, the active view is used. Pass a list of property_name=value
pairs to this function to set property values. For example:
 SetProperties(Background=[1, 0, 0], UseImmediateMode=0)

Definition at line 313 of file pvsimple.py.

00313 
00314 def SetViewProperties(view=None, **params):
00315     """Sets one or more properties of the given view. If an argument
00316     is not provided, the active view is used. Pass a list of property_name=value
00317     pairs to this function to set property values. For example:
00318      SetProperties(Background=[1, 0, 0], UseImmediateMode=0)
00319     """
00320     if not view:
00321         view = active_objects.view
00322     SetProperties(view, **params)

Here is the call graph for this function:

Here is the caller graph for this function:

def pvsimple.Show (   proxy = None,
  view = None,
  params 
)
Turns the visibility of a given pipeline object on in the given view.
If pipeline object and/or view are not specified, active objects are used.

Definition at line 202 of file pvsimple.py.

00202 
00203 def Show(proxy=None, view=None, **params):
00204     """Turns the visibility of a given pipeline object on in the given view.
00205     If pipeline object and/or view are not specified, active objects are used."""
00206     if proxy == None:
00207         proxy = GetActiveSource()
00208     if proxy == None:
00209         raise RuntimeError, "Show() needs a proxy argument or that an active source is set."
00210     if not view and not active_objects.view:
00211         CreateRenderView()
00212     rep = GetDisplayProperties(proxy, view)
00213     if rep == None:
00214         raise RuntimeError, "Could not create a representation object for proxy %s" % proxy.GetXMLLabel()
00215     for param in params.keys():
00216         setattr(rep, param, params[param])
00217     rep.Visibility = 1
00218     return rep

Here is the call graph for this function:

Here is the caller graph for this function:

def pvsimple.UpdatePipeline (   time = None,
  proxy = None 
)
Updates (executes) the given pipeline object for the given time as
necessary (i.e. if it did not already execute). If no source is provided,
the active source is used instead.

Definition at line 346 of file pvsimple.py.

00346 
00347 def UpdatePipeline(time=None, proxy=None):
00348     """Updates (executes) the given pipeline object for the given time as
00349     necessary (i.e. if it did not already execute). If no source is provided,
00350     the active source is used instead."""
00351     if not proxy:
00352         proxy = active_objects.source
00353     if time:
00354         proxy.UpdatePipeline(time)
00355     else:
00356         proxy.UpdatePipeline()

Here is the caller graph for this function:

def pvsimple.WriteAnimation (   filename,
  params 
)
Writes the current animation as a file. Optionally one can specify
arguments that qualify the saved animation files as keyword arguments.
Accepted options are as follows:
* Magnification (integer) : set the maginification factor for the saved
  animation.
* Quality (0 [worst] or 1 or 2 [best]) : set the quality of the generated
  movie (if applicable).
* Subsampling (integer) : setting whether the movie encoder should use
  subsampling of the chrome planes or not, if applicable. Since the human
  eye is more sensitive to brightness than color variations, subsampling
  can be useful to reduce the bitrate. Default value is 0.
* BackgroundColor (3-tuple of doubles) : set the RGB background color to
  use to fill empty spaces in the image.
* FrameRate (double): set the frame rate (if applicable).

Definition at line 704 of file pvsimple.py.

00704 
00705 def WriteAnimation(filename, **params):
00706     """Writes the current animation as a file. Optionally one can specify
00707     arguments that qualify the saved animation files as keyword arguments.
00708     Accepted options are as follows:
00709     * Magnification (integer) : set the maginification factor for the saved
00710       animation.
00711     * Quality (0 [worst] or 1 or 2 [best]) : set the quality of the generated
00712       movie (if applicable).
00713     * Subsampling (integer) : setting whether the movie encoder should use
00714       subsampling of the chrome planes or not, if applicable. Since the human
00715       eye is more sensitive to brightness than color variations, subsampling
00716       can be useful to reduce the bitrate. Default value is 0.
00717     * BackgroundColor (3-tuple of doubles) : set the RGB background color to
00718       use to fill empty spaces in the image.
00719     * FrameRate (double): set the frame rate (if applicable)."""
00720     scene = GetAnimationScene()
00721     # ensures that the TimeKeeper track is created.
00722     GetTimeTrack()
00723     iw = servermanager.vtkSMAnimationSceneImageWriter()
00724     iw.SetAnimationScene(scene.SMProxy)
00725     iw.SetFileName(filename)
00726     if params.has_key("Magnification"):
00727         iw.SetMagnification(int(params["Magnification"]))
00728     if params.has_key("Quality"):
00729         iw.SetQuality(int(params["Quality"]))
00730     if params.has_key("Subsampling"):
00731         iw.SetSubsampling(int(params["Subsampling"]))
00732     if params.has_key("BackgroundColor"):
00733         iw.SetBackgroundColor(params["BackgroundColor"])
00734     if params.has_key("FrameRate"):
00735         iw.SetFrameRate(float(params["FrameRate"]))
00736     iw.Save()

Here is the call graph for this function:

def pvsimple.WriteImage (   filename,
  view = None,
  params 
)
Saves the given view (or the active one if none is given) as an
image. Optionally, you can specify the writer and the magnification
using the Writer and Magnification named arguments. For example:
 WriteImage("foo.mypng", aview, Writer=vtkPNGWriter, Magnification=2)
If no writer is provided, the type is determined from the file extension.
Currently supported extensions are png, bmp, ppm, tif, tiff, jpg and jpeg.
The writer is a VTK class that is capable of writing images.
Magnification is used to determine the size of the written image. The size
is obtained by multiplying the size of the view with the magnification.
Rendering may be done using tiling to obtain the correct size without
resizing the view.

Definition at line 531 of file pvsimple.py.

00531 
00532 def WriteImage(filename, view=None, **params):
00533     """Saves the given view (or the active one if none is given) as an
00534     image. Optionally, you can specify the writer and the magnification
00535     using the Writer and Magnification named arguments. For example:
00536      WriteImage("foo.mypng", aview, Writer=vtkPNGWriter, Magnification=2)
00537     If no writer is provided, the type is determined from the file extension.
00538     Currently supported extensions are png, bmp, ppm, tif, tiff, jpg and jpeg.
00539     The writer is a VTK class that is capable of writing images.
00540     Magnification is used to determine the size of the written image. The size
00541     is obtained by multiplying the size of the view with the magnification.
00542     Rendering may be done using tiling to obtain the correct size without
00543     resizing the view."""
00544     if not view:
00545         view = active_objects.view
00546     writer = None
00547     if params.has_key('Writer'):
00548         writer = params['Writer']
00549     mag = 1
00550     if params.has_key('Magnification'):
00551         mag = int(params['Magnification'])
00552     if not writer:
00553         writer = _find_writer(filename)
00554     view.WriteImage(filename, writer, mag)

Here is the call graph for this function:

Here is the caller graph for this function:


Variable Documentation

Definition at line 1048 of file pvsimple.py.

Definition at line 43 of file pvsimple.py.