[Paraview] create scalar bar using Python
Sylvester Gerardson
sylvester.gerardson at gmail.com
Thu Jan 31 07:46:24 EST 2008
Hi All,
How do I create a scalar bar using Python scripting? I can create a
ScalarBarWidgetRepresentation with this script:
#################
view = servermanager.GetRenderView()
sph = servermanager.sources.SphereSource(registrationGroup='sources',registrationName='sphere1')
elev = servermanager.filters.ElevationFilter(Input=sph,registrationGroup='sources',registrationName='elevation1')
elev.UpdatePipeline()
elevRange=elev.GetDataInformation().GetPointDataInformation().GetArrayInformation(1).GetComponentRange(0)
lTable1 = servermanager.rendering.PVLookupTable(registrationGroup='lookup_tables')
lTable1.RGBPoints = [elevRange[0], 0, 0, 1, elevRange[1], 1, 0, 0]
lTable1.ColorSpace = 1 # HSV
rep = servermanager.CreateRepresentation(elev,view,registrationGroup='representations')
rep.LookupTable = lTable1
rep.ColorAttributeType = 0 # point data
rep.ColorArrayName = 'Elevation' # color by Elevation
sBar1 = servermanager.rendering.ScalarBarWidgetRepresentation(registrationGroup='scalar_bars',registrationName="ScalarBarWidgetRepresentation1")
sBar1.Title = 'elevation'
sBar1.LookupTable = lTable1
view.ResetCamera()
view.StillRender()
#################
But whenever I try to create a representation for it (for example:
rep2 = servermanager.CreateRepresentation(sBar1,view,registrationGroup='representations'))
ParaView crashes with the following message:
Representation could not locate the pqPipelineSource object for the
input proxy.
ERROR: In /home/sylvester/paraview/ParaView3.2.1/Servers/Common/vtkProcessModule.cxx,
line 1001
vtkProcessModule (0x77a7a0): Object type: vtkSMPVRepresentationProxy,
could not find requested method: "AddInput"
or the method was called with incorrect arguments.
while processing
Message 0 = Invoke
Argument 0 = id_value {329}
Argument 1 = string_value {AddInput}
Argument 2 = int32_value {0}
Argument 3 = vtk_object_pointer
{vtkSMScalarBarWidgetRepresentationProxy (0x2001920)}
Argument 4 = uint32_value {0}
Argument 5 = string_value {NotUsed}
ERROR: In /home/sylvester/paraview/ParaView3.2.1/Servers/Common/vtkProcessModule.cxx,
line 1002
vtkProcessModule (0x77a7a0): Aborting execution for debugging purposes.
Aborted
Any ideas?
Thanks!
Sylvester
More information about the ParaView
mailing list