[Paraview] problem with Glyph filter using Python scripting

Utkarsh Ayachit utkarsh.ayachit at kitware.com
Thu Mar 20 09:32:39 EDT 2008


Hello Sylvester/Roland,

Oepn at Servers/ServerManager/filters.xml and look at the xml for the 
"Glyph" filter. You'll notice that the "Source" property has a domain 
named "proxy_list" which lists the names of the proxy types the GUI can 
allow the user to choose. When the glyph filter is created by the GUI, 
the GUI iterates over all these types, create new proxy instances for 
each and adds then to the domain using 
"vtkSMProxyListDomain::AddProxy()". The panel the simply goes through 
the list and shows them in the "Glyph Type" combo box.

So here the fix your python script:

...

source = servermanager.sources.GlyphSource2D(GlyphType=8)
glyph = servermanager.filters.Glyph(Input=elev,
Source=source,registrationGroup="sources",registrationName="glyph")
sourceProperty = glyph.GetProperty("Source")
domain = sourceProperty.GetDomain("proxy_list");
domain.AddProxy(source.SMProxy)

...

Utkarsh

Sylvester Gerardson wrote:
> Hi!
> 
> I have a problem applying the Glyph filter using Python scripting.
> When running the script shown below (taken from Servermanager2.pdf,
> slightly modified), the glyphs are shown correctly but the Output
> Messages Window appears saying: "Selected proxy value not in the list:
>  2D Glyph". Also the "Glyph Type" selection box is empty thus making
> it impossible to change the glyph type using the GUI.
> 
> Am I doing something wrong here, or is this a bug?
> 
> I have tried on both PV3.2.1 (compiled from source) and 3.3cvs on OpenSUSE 10.3.
> 
> Thank you for you time.
> 
> regards,
> Sylvester
> 
> 
> view = servermanager.GetRenderView()
> 
> sphere = servermanager.sources.SphereSource(registrationGroup="sources",registrationName="sphere")
> repSphere = servermanager.CreateRepresentation(sphere,view,registrationGroup='representations')
> 
> elev = servermanager.filters.ElevationFilter(Input=sphere,registrationGroup="sources",registrationName="elev")
> repElev = servermanager.CreateRepresentation(elev,view,registrationGroup='representations')
> 
> source = servermanager.sources.GlyphSource2D(GlyphType=8)
> glyph = servermanager.filters.Glyph(Input=elev,
> Source=source,registrationGroup="sources",registrationName="glyph")
> glyph.SelectInputScalars = [ '0', '0', '0', '0', 'Elevation' ]
> glyph.ScaleMode = 0 # Use scalars
> repGlyph = servermanager.CreateRepresentation(glyph,view,registrationGroup='representations')
> _______________________________________________
> ParaView mailing list
> ParaView at paraview.org
> http://www.paraview.org/mailman/listinfo/paraview
> 


More information about the ParaView mailing list