When using pvpython, the glyph plots I generate are being improperly scaled. The plots always come in with a scale factor of 0.00025. To get the correct scale, the rescale button must be manually clicked in the GUI after the script is run. I am using Paraview 5.7.0 under Ubuntu 20.04.2.0 LTS. Here is a stripped-down test snippet that demonstrates the issue:
from paraview.simple import *
paraview.simple._DisableFirstRenderCameraReset()
EM2Dpvd = GetActiveSource()
EM2Dpvd.CellArrays = ['attribute']
EM2Dpvd.PointArrays = ['Et_im', 'Et_re', 'Ez_im', 'Ez_re', 'Ht_im', 'Ht_re', 'Hz_im', 'Hz_re', 'Pz_re', 'Pz_im']
EM2DView = GetActiveViewOrCreate('RenderView')
Hide(EM2Dpvd, EM2DView)
Et_calculator = Calculator(Input=EM2Dpvd)
Et_calculatorDisplay = Show(Et_calculator, EM2DView)
Et_calculator.Function = 'Et_re_X*iHat+Et_re_Y*jHat'
Et_glyph = Glyph(Input=Et_calculator,GlyphType='2D Glyph')
RenameSource("Et real vector",Et_glyph)
Et_glyphDisplay = Show(Et_glyph, EM2DView)
Et_glyph.OrientationArray = ['POINTS', 'Result']
Et_glyph.ScaleArray = ['POINTS', 'Result']
EM2DView.Update()
I can certainly scale the plot within the script with
Et_glyph.ScaleFactor = some number
but the question is what number to use? I have successfully and separately used Python Calculator and Programmable Filter to calculate the needed scale factor, but I cannot find a way to get the number into the code above to set Et_glyph.ScaleFactor.
In the end, I’m just looking for a way that the glyphs are plotted from pvpython with the correct scale factor for a nice-looking plot.