[vtkusers] Extract block from Multi-block data by name?

Berk Geveci berk.geveci at kitware.com
Wed Oct 8 14:29:25 EDT 2014

In Python, you can do this:

iter = mb.NewIterator()

while not iter.IsDoneWithTraversal():
    print iter.GetCurrentMetaData().Get(vtk.vtkCompositeDataSet.NAME())

The C++ code is almost identical. The name is stored in the MetaData of
each block with the vtkCompositeDataSet::NAME() key.


On Wed, Oct 8, 2014 at 11:53 AM, Evan Kao <tossin at gmail.com> wrote:

> Is there a way to get the name of a block when iterating (with
> ExtractBlock I assume)?  It wasn't clear to me in the documentation what
> method or sequence of methods I could use to get the name of the data
> itself.
> Thanks,
> Evan Kao
> On Wed, Oct 8, 2014 at 4:45 AM, Berk Geveci <berk.geveci at kitware.com>
> wrote:
>> There is still no specific method. You have to iterate over the blocks
>> and do a linear search.
>> Best,
>> -berk
>> On Tue, Oct 7, 2014 at 11:21 PM, Evan Kao <tossin at gmail.com> wrote:
>>> Hello vtkusers,
>>> I want to extract a block from a Multi-block dataset (read in using the
>>> Ensight reader) using the block's name, but I had trouble finding such a
>>> method in the documentation.  I found this thread
>>> <http://public.kitware.com/pipermail/paraview/2011-March/020435.html>
>>> about the same topic (but in Paraview), which suggested there was no method
>>> at the time, but since it's from 3-4 years ago, I was wondering if
>>> something in vtk had been written by now.
>>> Thanks,
>>> Evan Kao
>>> _______________________________________________
>>> Powered by www.kitware.com
>>> Visit other Kitware open-source projects at
>>> http://www.kitware.com/opensource/opensource.html
>>> Please keep messages on-topic and check the VTK FAQ at:
>>> http://www.vtk.org/Wiki/VTK_FAQ
>>> Follow this link to subscribe/unsubscribe:
>>> http://public.kitware.com/mailman/listinfo/vtkusers
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20141008/3444f30b/attachment.html>

More information about the vtkusers mailing list