[Paraview] Generating data on the client side - a development environment
Berk Geveci
berk.geveci at kitware.com
Thu Dec 18 12:12:34 EST 2008
Easily done as I found out recently:
sm = servermanager
f = open('trivialproducer.xml', 'r')
parser = sm.vtkSMXMLParser()
parser.Parse(f.read())
parser.ProcessConfiguration(sm.vtkSMObject.GetProxyManager())
# Update the modules
sm.updateModules()
tp = sm.sources.TrivialProducer()
obj = tp.GetClientSideObject()
obj.SetOutput(pd)
# use tp as any other source proxy
trivialproducer.xml:
<ServerManagerConfiguration>
<ProxyGroup name="sources">
<SourceProxy name="TrivialProducer"
class="vtkPVTrivialProducer">
</SourceProxy>
</ProxyGroup>
</ServerManagerConfiguration>
You probably need cvs ParaView for the code above to work.
-berk
On Thu, Dec 18, 2008 at 4:28 AM, Louis Le Grange
<llg at mtechindustrial.com> wrote:
> Hallo
>
> I have a question regarding a requirement that seems a bit out of line with
> the client-server architecture of Paraview;
>
> Let me start off by giving the bigger picture of the application that I have
> in mind;
>
> I want to use Paraview in a development environment. The development
> environment will operate in a standard Python console. As I develope (build
> up) my data I want to visualize it periodically. I don't want to regenerate
> the data from sratch everytime I want to visualize it. I basically want to
> work with live data that persists on the client side.
>
> A typical example Python script that I envisage using Python wrapped VTK and
> Paraview objects to display vtkPolydata would look something like this:
>
> =========================================================================================
> # Initialize Paraview pipeline
> mySource = InitializePV()
>
> # Create poly data and plot it
> import vtk
> pts=vtk.vtkPoints()
> pts.InsertNextPoint(0,0,0)
> pts.InsertNextPoint(1,0,.0)
> pts.InsertNextPoint(2,1,0)
> pts.InsertNextPoint(3,3,0.)
>
> cel=vtk.vtkCellArray()
> cel.InsertNextCell(4)
> cel.InsertCellPoint(0)
> cel.InsertCellPoint(1)
> cel.InsertCellPoint(2)
> cel.InsertCellPoint(3)
>
> pd = vtk.vtkPolyData()
> pd.SetPoints(pts)
> pd.SetPolys(cel)
> plotPolys(mySource,pd)
>
>
> ##### Change the points and plot
> pd.GetPoints().SetPoint(2, 1,2,3)
> plotPolys(mySource,pd)
>
> ##### Change the points and plot
> pd.GetPoints().SetPoint(2, 4,5,4)
> plotPolys(mySource,pd)
>
>
> # etc
> ====================
>
>
> The Python functions initializePV() and plotPoints can typically look like
> the following:
>
> initializePV():
> =========
> pxm = servermanager.ProxyManager()
> sph=servermanager.sources.SphereSource()
> pxm.RegisterProxy("sources", "mysource", sph)
> view = pxm.GetProxy("views", "RenderView1")
> rep = servermanager.CreateRepresentation(sph, view)
> return sph
>
> plotPoints(sourceObject,vtkObject):
> ===============
> # Although this example currently generates vtkPoints I actually want to
> send vtkPolyData to the Paraview source - but this
> # is only to demonstrate the development environment I have in mind...
> # The current vtk and proxy source classes needs to be updated to take a
> vtkPolyData pointer...
> sourceObject.SetMyPolyData(vtkObject)
> sourceObject.Update()
>
>
>
> =========================================================================================
>
> In the example above the vtk data (pd) is a live object on the client side.
>
> In short I want to generate vtk data on the client side and send a data
> pointer (typically a vtkPolyData pointer) to the visualization pipeline in
> Paraview. I thought of modifying a source object in Paraview to take my data
> instead of generating the data on the server side.
>
> I don't want to work with the programmable source using a script for that
> implies that the data is again generated on the server side.
>
> According to the Paraview documentation it seems that the only way to
> manipulate the Paraview source objects is through Property objects
> (VectorProperty, ProxyProperty and InputProperty). Does this imply that
> according to the current architecture that I will not be able to send a
> vtkObject (vtkPolyData) pointer to the server? If so what are the options
> with regards to the Paraview architecture so that I can use Paraview in the
> above demonstrated manner - i.e. generating data on the client side and let
> Paraview operate on such data?
>
> Thanks in advancxe,
> Louis
>
>
>
>
>
>
>
> _______________________________________________
> ParaView mailing list
> ParaView at paraview.org
> http://www.paraview.org/mailman/listinfo/paraview
>
>
More information about the ParaView
mailing list