Can different scalar fields be displayed on different blocks of a vtkPartitioned DataSetCollection?

Hello!!!,

I’m using VTK9.4 and Python 3.12.

I have a vtkPartitionedDataSetCollection and I’m trying to display some of the blocks in constant colors and others using scalar point field data.

I was hoping to achieve this using a vtkCompositeDataDisplayAttributes since I’m already using this for visibility, block color etc. So my vtkCompositeDataDisplayAttributes instance does this for the blocks thta I want to color by scalar

                display_attributes.RemoveBlockColor(dset)
                display_attributes.SetBlockArrayName(dset, 'ScalarsX')
                display_attributes.SetBlockScalarVisibility(dset, True)

But this yields no scalar based coloring :frowning:

The only way that I can actually display scalars is to set the active scalar on the dataset associated with the block - poly.GetPointData().SetActiveScalars('ScalarsX')

So my question is - should I be able to enable/disable scalar based coloring of blocks in a vtkPartitionedDataSetCollection using vtkCompositeDataDisplayAttributes or not?

If so, guidance on how to do this would be apreciated.

If not - what is the purpose of the SetBlockArrayName() method?

I’ve attached some example code that demonstrates the above.

Thanks in advance for any help,

Edit : Example updated with corrections and now rns as expected

Doug
test_pdsc_display_attributes.py (5.2 KB)

Have you taken a look at https://gitlab.kitware.com/vtk/vtk/-/blob/master/Rendering/Core/Testing/Cxx/TestCompositePolyDataMapperOverrideScalarArray.cxx ?

It may point out something missing from your code.

Thanks Cory,

In fact I looked at a bunch of the Tests that I found by following the “Tests” link in the nightly docs for vtkCompositeDataDisplayAttributes and didn’y have any success.

Strangely, the test you linked was NOT included in the tests linked to the docs…

Nonetheless, using your link I was able to determine what was missing from my script and all is now well.

In summary, what was missing was setting the ScalarMode. I found tjat I can see that directy on the mapper and it applies to all blocks, or I can set it per block with SetBlockScalarMode()

I’ll update the example in case anyone else runs into this.

Thanks!!!

1 Like