# Multi geometry interaction

**URL:** https://discourse.vtk.org/t/multi-geometry-interaction/9276
**Category:** Support
**Tags:** proposal
**Created:** [September 4, 2022, 9:02am UTC](https://discourse.vtk.org/t/multi-geometry-interaction/9276 "2022-09-04T09:02:31Z")
**Posts on this page:** 1
**Showing post:** 7

<div class="post-metadata">

### Author: ![tmnku](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/t/e95f7d/32.png) [@tmnku](https://discourse.vtk.org/u/tmnku)
#### Post date: [September 5, 2022, 5:47am UTC](https://discourse.vtk.org/t/multi-geometry-interaction/9276/7 "2022-09-05T05:47:54Z")

</div>

I actually had the same problem. `SetBlockColor()` of the mapper did not seem to have any effect neither did `SetBlockVisibility()`. I found an example in the unittests and it turns out that you have to set

```auto
vtkNew<vtkCompositeDataDisplayAttributes> cdsa;
mapper->SetCompositeDataDisplayAttributes(cdsa);

```

only then setting block attributes will work fine. When setting per block colors and visibility make sure to use its flat index which is not the same as the index when you use `SetBlock()`. In my case I had n polyDatas which I added to the root using `SetBlock(0), SetBlock(1)...` and then changed their color `SetBlockColor(1), SetBlockColor(2),...`.

You can also set colors within each polyData object as an alternative.

```auto
  vtkNew<vtkUnsignedCharArray> colors;
  colors->SetNumberOfComponents(3);
  for (int i = 0; i < polyData->GetNumberOfCells(); ++i) {
    colors->InsertNextTuple3(255, 0, 0);
  }
  polyData->GetCellData()->SetScalars(colors);

```

---

_[View the full topic](https://discourse.vtk.org/t/multi-geometry-interaction/9276)._
