vtkXMLMultiBlockDataWriter does not appear to export field data


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.SetValue(0, "Assembly")
    field_data = assembly.GetFieldData().GetAbstractArray("blocktype")

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,


OK - I just looked at the implementation of vtkXMLMultiBlockDataWriter and it’s clearly only looking for the NAME metadata.

So I’m guessing this is a bust.

Can anyone suggest alternate strategies? I guess I could write a companion file, or encode the additional information into the name string…