[Paraview] Some paraview python questions

David Doria daviddoria at gmail.com
Tue May 5 12:51:01 EDT 2009


Perfect, thanks Eric. I've added a couple of examples from this to the wiki.

Thanks,

David


On Tue, May 5, 2009 at 11:15 AM, Eric E. Monson <emonson at cs.duke.edu> wrote:

> Hey David,
> 1.) When you create a new source, to get it to render you also need to
> create a "Representation" for it in the "View". If you're running from the
> python shell inside the paraview gui, you need to do something like this:
>
> sphere = servermanager.sources.Sphere()
> pm = servermanager.ProxyManager()
> pm.RegisterProxy('sources','mysource',sphere)
> view = servermanager.GetRenderView()
> sphereRep = servermanager.CreateRepresentation(sphere,view)
> pm.RegisterProxy('representations','mysourceRep',sphereRep)
>
> After that last step the "eye" should show up (and the sphere should show
> up in the main render view.
>
> 2.) I'm not sure why the arrows don't work any more for the command
> history. In PV 3.4 it works for me, but not in CVS. It's very irritating...
>
> 3.) It's the Representation Proxy that contains things like visibility, not
> the source proxy itself. dir(sphereRep) will show you the options.
>
> sphereRep.Visibility = 0
>
> To iterate through all the representations you can do something like this:
>
> for k, v in pm.GetProxiesInGroup('representations').iteritems():
>     v.Visibility = 0
>
> Hope this helps,
> -Eric
>
> ------------------------------------------------------
> Eric E Monson
> Duke Visualization Technology Group
>
>
> On May 2, 2009, at 5:01 PM, David Doria wrote:
>
> 1) Adding a view after adding a source with python
> I have the following script which adds a sphere to the pipeline browser
>
> #!/usr/bin/pvpython
> #must be run from inside paraview!
>
> from paraview import servermanager
>
> sphere = servermanager.sources.Sphere()
> pm=servermanager.ProxyManager()
> pm.RegisterProxy("sources","mysource",sphere)
>
> This adds "mysource" to the pipeline browser. According to the wiki, it
> sounds like the default visibility should be off, but you should just be
> able to click the "eye" next to it to actually display the object. However,
> I am not seeing an eye at all, not even a disabled one. (
> http://rpi.edu/~doriad/NoEye.jpg <http://rpi.edu/%7Edoriad/NoEye.jpg>)
>
> 2) The command history (ie. pressing the up arrow to get to previous
> commands) does not seem to work in the python shell inside paraview. Can it
> be enabled?
>
> 3) I can access all of the open sources with this:
> p=pm.GetProxiesInGroup("sources").items()
> then get a single source with
> a=p[0] #up to p[len(p)-1]
>
> When I dir(a), there are no properties (such as visibility) listed. How do
> you change that type of property? (the idea would be to something such as
> iterate through all of the open items one at a time and save screen shots).
>
> Any help would be great!
>
> Thanks,
>
> David
> _______________________________________________
> 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://www.paraview.org/mailman/listinfo/paraview
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.paraview.org/pipermail/paraview/attachments/20090505/165d4602/attachment.htm>


More information about the ParaView mailing list