[Paraview] adding axes via python scripting
Michael Müller
Michael.Mueller at ivd.uni-stuttgart.de
Thu Apr 9 03:41:48 EDT 2009
I just tried to add the CubeAxesRepresentation via python scripting using Paraview 3.4. Within the script I read some VTK-file, get its cell data, add a color legend and save the screenshot as png-file. It looks like the following:
from paraview import servermanager as sm
reader = sm.sources.LegacyVTKFileReader(FileNames=fname)
reader.UpdatePipeline()
rv = sm.CreateRenderView()
rep = sm.CreateRepresentation(reader, rv)
rep.Representation = 2 # 0 (Points), 1 (Wireframe), 2 (Surface), 3 (Outline)
...
lt = sm.rendering.PVLookupTable()
rep.LookupTable = lt
...
bar = sm.rendering.ScalarBarWidgetRepresentation()
bar.LookupTable = lt # assign the lookup table to the color bar
...
axes = sm.rendering.CubeAxesRepresentation()
axes.Visibility = 1
axes.Color = [0,0,0] # get it in black
...
rv.Representations.append(bar)
rv.Representations.append(axes)
rv.WriteImage(fname_out,"vtkPNGWriter",1)
I get the following messages:
ERROR: In /home/berk/Work/ReleaseBuilds/ParaView3/Servers/ServerManager/vtkSMDataRepresentationProxy.cxx, line 118
vtkSMCubeAxesRepresentationProxy (0xa485748): CreateVTKObjects() must be called before AddToView.This typically implies that the input to the representation was not set before adding it to the view.
ERROR: In /home/berk/Work/ReleaseBuilds/ParaView3/Servers/ServerManager/vtkSMViewProxy.cxx, line 261
vtkSMRenderViewProxy (0xa117020): vtkSMCubeAxesRepresentationProxy cannot be added to view of type vtkSMRenderViewProxy
I just don't know which 'Input' I have to set (must be sth like 'axes.Input = ...').
Any hints will be helpful. Thanks in advance...
More information about the ParaView
mailing list