[vtkusers] Naming blocks in a multiblock dataset
Marco Nawijn
nawijn at gmail.com
Fri Oct 21 16:35:20 EDT 2011
Dear All,
I have a question about naming individual blocks in a multiblock dataset.
In python, I have the following:
multiblock = vtkMultiBlockDataSet()
multiblock.SetNumberOfBlocks(self.ninstances)
for idx,instance in enumerate(self.instances):
multiblock.SetBlock(idx, instance.grid)
writer = vtkXMLMultiBlockDataWriter()
writer.SetDataModeToAscii()
writer.SetFileName(filename)
writer.SetInput(multiblock)
writer.Write()
After the writer has finished I get a VTM file and a directory with
each of the blocks as a VTU file.
When importing the VTM file in Paraview, I can use the "extract block"
filter to get the individual
blocks from the multiblock dataset. The problem is that a generic name
"Dataset X" is shown
for each of the blocks. My question is if it is possible to set the
name of the individual blocks
in VTK? If so, can someone provide an example on how to achieve this.
I have tried to work with
a vtkInformation object like this:
info = multiblock.GetMetaData(0)
info.Set(multiblock.NAME(), 'hello')
But although the code runs fine, the "hello" string cannot be found in
the VTM and VTU files.
Kind regards,
Marco
More information about the vtkusers
mailing list