Hello!!!
I’m using vtkMultBlockDatasets and I want to attach metadata to some of the Blocks, persist that metadata to disk and then use it when I read the file later.
So far, I’ve been successful using the provided NAME metadata associate a name with the Block
parent.GetMetaData(block_id).Set(vtk.vtkCompositeDataSet.NAME(), assembly_name)
But now I need to add more data and I’m not having any success.
I tried two approach so far,
First, using field data
assembly = vtk.vtkMultiBlockDataSet()
block_type = vtk.vtkStringArray()
block_type.SetNumberOfValues(1)
block_type.SetName("blocktype")
block_type.SetValue(0, "Assembly")
assembly.GetFieldData().AddArray(block_type)
field_data = assembly.GetFieldData().GetAbstractArray("blocktype")
print(field_data.GetValue(0))
The field data is added and recovered but is NOT exported when I write the file to disk using vtkXMLMultiBlockDataWriter()
Then I tried using one of the other standard keys,
parent.GetMetaData(block_id).Set(vtk.vtkCompositeDataSet.DATA_TYPE_NAME(), "Assembly")
But this is not present in the exported file either.
How can I attach metadata to Blocks and have this data exported to disk?
Thanks in advance,
Doug