[Paraview] Problem with vtkStringData in Composite dataset
Jan Brezina
jan.brezina at tul.cz
Wed Nov 19 09:43:11 EST 2014
Dear paraview users,
I have a MultiBlock Dataset
containing a single leaf (vktPolyData) with PointData having a
vtkStringArray named "labels". I try to display these labels selection
the block and setting label format "%s". This approach works if
that leaf block is treated out of the composite dataset, but within
composite dataset I get a warning:
Warning: In
/home/kitware/Dashboards/MyTests/NightlyMaster/ParaViewSuperbuild-Release/paraview/src/paraview/VTK/Rendering/Label/vtkLabeledDataMapper.cxx,
line 442
vtkLabeledDataMapper (0x597e640): Could not find label array (labels) in
input.
and no labels are shown.
Then I tried to use ExtractBlock + MergeBlocks and apply selection
there, but MergeBlocks simply drops the "labels" array.
Is it an error or should I do something special to make such an
AbstractArray work.
Below you find a ProgrammableSource script to generate a sample
MultiblockDataset for reproduction of the problem. Here I set "labels"
array to all leaf blocks with the same result.
Thank you for help
Jan
=============================
import vtk
def make_rect(coords):
xmin,ymin,xmax,ymax=coords
pts = vtk.vtkPoints()
pts.InsertPoint(0, xmin, ymin, 0)
pts.InsertPoint(1, xmax, ymin, 0)
pts.InsertPoint(2, xmax, ymax, 0)
pts.InsertPoint(3, xmin, ymax, 0)
rect = vtk.vtkCellArray()
rect.InsertNextCell(5)
rect.InsertCellPoint(0)
rect.InsertCellPoint(1)
rect.InsertCellPoint(2)
rect.InsertCellPoint(3)
rect.InsertCellPoint(0)
output = vtk.vtkPolyData()
output.SetPoints(pts)
output.SetLines(rect)
labels=vtk.vtkStringArray()
labels.InsertNextValue("one")
labels.InsertNextValue("two")
labels.InsertNextValue("three")
labels.InsertNextValue("four")
labels.SetName("labels")
output.GetPointData().AddArray(labels)
tenths=vtk.vtkIntArray()
tenths.InsertNextValue(10)
tenths.InsertNextValue(20)
tenths.InsertNextValue(30)
tenths.InsertNextValue(40)
tenths.SetName("tenths")
output.GetPointData().AddArray(tenths)
return output
output.SetBlock(0, make_rect( (0,0,1,1) ) )
output.SetBlock(1, make_rect( (1,1,2,2) ) )
which
--
------------------------
Mgr. Jan Brezina, Ph. D.
Technical University in Liberec, New technologies institute
http://www.nti.tul.cz/cz/WikiUser:Jan.Brezina
More information about the ParaView
mailing list