Property listing inconsistency between python and C++ ?

For a Glyph filter added in the pipeline browser of paraview, I am able to list all properties including the “GlyphType” property using the python interactive shell using the following two commands:

>>> glyph = FindSource("Glyph1")
>>> glyph.ListProperties()
['ComponentSelection', 'GlyphMode', 'GlyphTransform', 'Input', 'MaximumNumberOfSamplePoints', 'OrientationArray', 'ScaleArray', 'ScaleFactor', 'Seed', 'GlyphType', 'Stride', 'VectorScaleMode']

In my paraview plugin code in C++, when I tried to print the properties of glyphProxy using a vtkSMPropertyIterator, I dont get to see the “GlyphType” property.

debug: Property Name:  ComponentSelection
debug: Property Type:  vtkSMIntVectorProperty
debug: Property Name:  GlyphMode
debug: Property Type:  vtkSMIntVectorProperty
debug: Property Name:  GlyphTransform
debug: Property Type:  vtkSMProxyProperty
debug: Property Name:  Input
debug: Property Type:  vtkSMInputProperty
debug: Property Name:  MaximumNumberOfSamplePoints
debug: Property Type:  vtkSMIntVectorProperty
debug: Property Name:  OrientationArray
debug: Property Type:  vtkSMStringVectorProperty
debug: Property Name:  ScaleArray
debug: Property Type:  vtkSMStringVectorProperty
debug: Property Name:  ScaleFactor
debug: Property Type:  vtkSMDoubleVectorProperty
debug: Property Name:  Seed
debug: Property Type:  vtkSMIntVectorProperty
debug: Property Name:  Source
debug: Property Type:  vtkSMInputProperty
debug: Property Name:  Stride
debug: Property Type:  vtkSMIntVectorProperty
debug: Property Name:  VectorScaleMode
debug: Property Type:  vtkSMIntVectorProperty

Can anyone comment why does this happen? Not sure, but I guess the “GlyphType” is embedded inside the “Source” property? How can I set the “GlyphType” combobox to a certain selection?
Tried setting the property blindly using

vtkSMPropertyHelper(glyphProxy, "GlyphType").Set("Sphere");

but I get a failed to locate property error.

This is because the property you are looking is Source. check the xml where the proxy is defined:
(VTKExtensions/FiltersGeneral/Resources/general_filters.xml)

1449       <PropertyGroup label="Glyph Source">
1450         <Property name="Source" />
1451       </PropertyGroup>

This means that the Glyph Source panel holds the properties of the vtkSMInputProperty Source.
Indeed, in the same file:

1232       <InputProperty command="SetSourceConnection"
1233                      label="Glyph Type"
1234                      name="Source">

This mean that the source property is labeled Glyph Type .

The properties you see in this group they come from the properties of each of the possible values of the dropdown.
Which are listed few lines below:

1242         <ProxyListDomain name="proxy_list">
1243           <Proxy group="sources" name="ArrowSource" />
1244           <Proxy group="sources" name="ConeSource" />
1245           <Proxy group="sources" name="CubeSource" />
1246           <Proxy group="sources" name="CylinderSource" /> 
1247           <Proxy group="sources" name="LineSource" />
1248           <Proxy group="sources" name="SphereSource" />
1249           <Proxy group="sources" name="GlyphSource2D" />
1250         </ProxyListDomain>

In your case you are using a sphere source.

So back to your original question:

>>> glyph.GlyphType
<paraview.servermanager.Sphere object at 0x7f764aeb5430>
>>> glyph.GlyphType.ListProperties()
['Center', 'EndPhi', 'EndTheta', 'PhiResolution', 'Radius', 'StartPhi', 'StartTheta', 'ThetaResolution']
>>> glyph.GlyphType.ThetaResolution = 20
>>> Render()
1 Like

To add on to what Christos said, try listing the property “label” (GetPropertyLabel() in the iterator) instead of the “name”. Python uses property labels instead of names because the label is what you see in the GUI. In the case of the “GlyphType” property in Python, that is the label for the “Source” property.

1 Like

Thank you all! :slightly_smiling_face: