ParaView quit when displaying Glyph in a Python scripting
Hi,
I am trying to script a visualisation into Python.
I want to display the data extracted from a CSV file as vector field. To do it, I am using TableToPoint, Calculator and Glyph filters. At the end, I want to display only the the Glyph.
Playing with the script, I understood that I necessarily need to display the Calculator unless ParaView quit. See lines 18 and 19:
from paraview.simple import *
paraview.simple._DisableFirstRenderCameraReset()
# create a new 'CSV Reader'
a2D2edited2tcsv = CSVReader(FileName=['.../data.csv']) #TODO: Set correctly
a2D2edited2tcsv.HaveHeaders = 0
tableToPoints1 = TableToPoints(Input=a2D2edited2tcsv)
tableToPoints1.a2DPoints = 1
tableToPoints1.XColumn = 'Field 0'
tableToPoints1.YColumn = 'Field 1'
renderView1 = FindViewOrCreate('RenderView1', viewtype='RenderView')
calculator1 = Calculator(Input=tableToPoints1)
calculator1.Function = 'Field 2*iHat+Field 3*jHat'
calculator1Display = Show(calculator1, renderView1) #Required
calculator1Display = Hide(calculator1) #Can be used to undo previous command effect
glyph1 = Glyph(Input=calculator1, GlyphType='Arrow')
glyph1Display = Show(glyph1, renderView1)
glyph1Display.SetScalarBarVisibility(renderView1, True)
renderView1.Update()
renderView1.ResetCamera()
If needed, you can use the following CSV file (make sure to set the path accordingly, line 5): data.csv.
I am using:
Mac OSX: 10.11.2
ParaView: 5.4.0 64 bits
Thanks for your help