Extract block selectors fails when dash is in selector name

I am trying to debug a rather difficult issue in 5.10.1 when using ExtractBlock on an OpenFOAM dataset.

In previous versions, extractBlock worked very reliably by setting the BlockIndices to extract. However, I am finding unstable, inconsistent behavior with the new “Selectors” method.

I am using a python script to extract all blocks starting with w, but this fails when there is a dash in the name. So the scripts executes:

extractBlockFilter.Selectors = [‘/Root/boundary/w_l_body-dash’, ‘/Root/boundary/w_l_body_medium’]

But w_body-dash is NOT extracted. When I generate a python trace in the GUI, it works, and it says:

So it seems there is a bug in the Selector itself? Any ideas on how to work around this? Why was the block indices method dropped?

1 Like

Hi, I know this an old question, but as the topic is still relevant and I have a workaround, I wanted to respond.

ParaView represents multiblock and partitioned dataset collection hierarchies with XML. The problem with the ‘-’ is an invalid character for a node name in an XML tree according to pugixml, the XML processing library ParaView uses. So while the selectors that use the paths based on XML element names might not work when a ‘-’ or other non-numeric character are included, as in your case, you can instead use XSLT 1.0 expressions to make the selection you want. In your case, use the selector

//*[starts-with(@label, 'w')]

This will pick all XML elements with the label attribute that starts with w.