[Paraview] Does servermanager.sources.TextSource Work?
Utkarsh Ayachit
utkarsh.ayachit at kitware.com
Mon Mar 24 15:37:54 EDT 2008
Kent,
I've just commited a fix to the CVS (patch for the same is also attached).
With this fix, you can optionally specify which representation proxy to
create for the source.
Hence for text source the script will become:
...
> text = servermanager.sources.TextSource()
> text.Text = "Hello World"
> textRep = servermanager.CreateRepresentation( text, view, \
proxyName="TextSourceRepresentation")
> view.StillRender()
...
PATCH <<<===========================================================
Index: Utilities/VTKPythonWrapping/paraview/servermanager.py
===================================================================
RCS file:
/cvsroot/ParaView3/ParaView3/Utilities/VTKPythonWrapping/paraview/servermanager.py,v
retrieving revision 1.26
diff -u -3 -p -r1.26 servermanager.py
--- Utilities/VTKPythonWrapping/paraview/servermanager.py 29 Feb
2008 20:55:32 -00001.26
+++ Utilities/VTKPythonWrapping/paraview/servermanager.py 24 Mar
2008 19:32:08 -0000
@@ -1250,18 +1250,27 @@ def CreateRepresentation(aProxy, view, *
keyword arguments where the key is the name of the property.In
addition
registrationGroup and registrationName (optional) can be specified (as
keyword arguments) to automatically register the proxy with the proxy
- manager."""
+ manager.
+
+ This method tries to create the best possible representation for
the given
+ proxy in the given view. Additionally, the user can specify proxyName
+ (optional) to create a representation of a particular type."""
global rendering
if not aProxy:
raise exceptions.RuntimeError, "proxy argument cannot be None."
if not view:
raise exceptions.RuntimeError, "render module argument cannot
be None."
- display = view.SMProxy.CreateDefaultRepresentation(aProxy.SMProxy, 0)
+ if "proxyName" in extraArgs:
+ display = CreateProxy("representations", extraArgs['proxyName'],
None)
+ del extraArgs['proxyName']
+ else:
+ display = view.SMProxy.CreateDefaultRepresentation(aProxy.SMProxy, 0)
+ if display:
+ display.UnRegister(None)
if not display:
return None
display.SetConnectionID(aProxy.GetConnectionID())
- display.UnRegister(None)
extraArgs['proxy'] = display
proxy = rendering.__dict__[display.GetXMLName()](**extraArgs)
proxy.Input = aProxy
============================================================>>>>
Kent Eschenberg wrote:
> Here's the test case (3.2.1 on CentOS 5);
>
> ===
> servermanager.Connect()
> view = servermanager.CreateRenderView()
> sphere = servermanager.sources.SphereSource()
> sphereRep = servermanager.CreateRepresentation( sphere, view )
> text = servermanager.sources.TextSource()
> text.Text = "Hello World"
> textRep = servermanager.CreateRepresentation( text, view )
> view.StillRender()
> view.ResetCamera()
> view.StillRender()
> raw_input("Exit: ")
> ---
>
> and here is the first part from running this from pvpython:
>
> ===
> vtkSphereSource : [ ...........]
> vtkPVTextSource : [ ...........]
> ERROR: In .../VTK/Filtering/vtkExecutive.cxx, line 757
> vtkCompositeDataPipeline (0x8be1a10): Algorithm
> vtkPVExtractSelection(0x8bdec78) returned failure for request:
> vtkInformation (0x8be4798)
> Debug: Off
> Modified Time: 105440
> Reference Count: 1
> Registered Events: (none)
> Request: REQUEST_DATA_OBJECT
> FROM_OUTPUT_PORT: 0
> ALGORITHM_AFTER_FORWARD: 1
> FORWARD_DIRECTION: 0
> <more>
> ---
>
> This seems to be the only way to put text on the image; I cannot find
> any alternative. Help!
>
> Kent
> Pittsburgh Supercomputing Center
> _______________________________________________
> ParaView mailing list
> ParaView at paraview.org
> http://www.paraview.org/mailman/listinfo/paraview
>
More information about the ParaView
mailing list