Potential bug in vtkDataAssembly?

I’m using Python 3.9 and vtk 9.1.0 on Windows.

vtkDataAssembly.SelectNodes() selects nodes in the vtkDataAssembly using a ‘/’ sperated path of the node names.

This method is supposed to return an empty vector/tuple if no nodes match the path,
however I find that the method always returns the root node if the supplied path has a ‘/’ in it.

In the snippet below I create a data asssembly and then call SelectNodes using two different paths. Since the data assembly is empty, I expect both calls to return an empty tuple.

In fact the first call, using the path ‘test’ does return an empty tuple but the second one returns the index of the root node. Any path that includes a leading ‘/’ returns the root node.

Am I missing something, or is this a bug?

data_assembly = vtk.vtkDataAssembly()
print('test', data_assembly.SelectNodes('test'))
print('/test', data_assembly.SelectNodes('/test'))

Output :

test ()
/test (0,)

Thanks,

Doug

If I use the GetFirstNodeByPath() method instead of SelectNodes() I get the behavior I expect, so I’m not blocked.

But I’m now more certain this is a bug…

data_assembly = vtk.vtkDataAssembly()
print('SelectNodes')
print('test', data_assembly.SelectNodes('test'))
print('/test', data_assembly.SelectNodes('/test'))
print('/', data_assembly.SelectNodes('/'))

print('\nGetFirstNodeByPath')
print('test', data_assembly.GetFirstNodeByPath('test'))
print('/test', data_assembly.GetFirstNodeByPath('/test'))
print('/', data_assembly.GetFirstNodeByPath('/'))

Output

SelectNodes
test ()
/test (0,)
/ (0,)

GetFirstNodeByPath
test -1
/test -1
/ 0