ArrowGlyphFilter from Python Shell in PV 6.0.0

Hi,
I get an error when I want to use the ArrowGlyphFilter in the Python Shell in ParaView 6.0.0:

Traceback (most recent call last):
  File "<console>", line 1, in <module>
NameError: name 'ArrowGlyphFilter' is not defined

The plugin is loaded and I use the same command that is shown in the trace. I have used the phython-code before in PV 5.12 without errors. What am I missing (or is it a bug)?

import_invapts.xyz (1.2 KB)
I am including the data I am using in this post, if anybody wants to test my code with it. Here is the code I use up to the error:

import re
myfile = VisItXYZReader(FileName='C:/path_to_datafile/import_invapts.xyz')
myfile.Meshes = ['mesh']
myfile.PointArrays.SelectAll()
rv1 = GetActiveViewOrCreate('RenderView')
Disp = Show(myfile, rv1,'GeometryRepresentation')
calc = Calculator(registrationName='calc',Input=myfile)
calc.Function = '(var0-coordsX)*iHat+(var1-coordsY)*jHat+(var2-coordsZ)*kHat'
calc2 = Calculator(registrationName='calc2',Input=calc)
calc2.Function = '1/sqrt(Result_X^2+Result_Y^2+Result_Z^2)'
calc2.ResultArrayName = 'Invscale'
glyphstr='Arrow/0.1/0.35/10/0.03/10'
glyphprops=list(map(str,glyphstr.split('/')))
arrowGlyphFilter1 = ArrowGlyphFilter(registrationName='ArrowGlyphFilter1', Input=calc2)

Cheers,
Venke

It seems like this is a function of event ordering.

This works:

  • Tools → Manage Plugins… Load the ArrowGlyph plugin.
  • View → Python Shell. Click in it.
  • Write ArrowGlyphFilter, the symbol will be available.

However, if you click in the Python Shell before loading the plugin, Python initialization and the from paraview.simple import * will be executed, and the ArrowGlyphFilter will not have been imported from the paraview.simple namespace because it isn’t yet in paraview.simple when the initial import occurs. Therefore, always load the plugin before you access the Python Shell to access ArrowGlyphFilter. You can make it an Auto Load plugin in the Plugin Manager to avoid having to load it manually each time.

Lastly, you can always access the filter after the plugin has been loaded with its full name, paraview.simple.ArrowGlyphFilter.

1 Like