# Linked control behavior of ThreeDViews with different view groups: linked control ignores view group setup?

**URL:** <https://discourse.slicer.org/t/linked-control-behavior-of-threedviews-with-different-view-groups-linked-control-ignores-view-group-setup/23383>\
**Category:** Development\
**Created:** [May 12, 2022, 3:46am UTC](https://discourse.slicer.org/t/linked-control-behavior-of-threedviews-with-different-view-groups-linked-control-ignores-view-group-setup/23383 "2022-05-12T03:46:36Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![mrlongzhang](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/mrlongzhang/32/15286_2.png) [@mrlongzhang](https://discourse.slicer.org/u/mrlongzhang)\
**Post date:** [May 12, 2022, 3:46am UTC](https://discourse.slicer.org/t/linked-control-behavior-of-threedviews-with-different-view-groups-linked-control-ignores-view-group-setup/23383/1 "2022-05-12T03:46:36Z")

</div>

Here is my settings: A customized layout with 3 three-D Views. The view group of the first one is 0. And the rest two are assigned to be 1. Using the following code:

```python
viewNode = slicer.mrmlScene.GetSingletonNode('1', 'vtkMRMLViewNode')
viewNode.SetViewGroup(0)
viewNode.LinkedControlOff()

viewNode = slicer.mrmlScene.GetSingletonNode('2', 'vtkMRMLViewNode')
viewNode.SetViewGroup(1)
viewNode.LinkedControlOn()
viewNode = slicer.mrmlScene.GetSingletonNode('3', 'vtkMRMLViewNode')
viewNode.SetViewGroup(1)
viewNode.LinkedControlOn()

```

What I want is to synchronize operations on view 2 and 3 (view group 1), but not on view 1 (view group 0). However, view 1 remains synchronize with view 2 and 3 and vice versa.

Did I miss something? Or I did something wrong?

Thanks in advance!

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [May 12, 2022, 8:35pm UTC](https://discourse.slicer.org/t/linked-control-behavior-of-threedviews-with-different-view-groups-linked-control-ignores-view-group-setup/23383/2 "2022-05-12T20:35:28Z")

</div>

Thanks for reporting and providing a script that reproduces the issue. Using this I was able to reproduce and fix it. The problem was that there was a check for the view group but it always ended up comparing the view group ID with itself, therefore synchronizing all views regardless of group IDs. I’ll push a fix later today.

---

<div class="post-metadata">

**Author:** ![mrlongzhang](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/mrlongzhang/32/15286_2.png) [@mrlongzhang](https://discourse.slicer.org/u/mrlongzhang)\
**Post date:** [May 16, 2022, 12:55pm UTC](https://discourse.slicer.org/t/linked-control-behavior-of-threedviews-with-different-view-groups-linked-control-ignores-view-group-setup/23383/3 "2022-05-16T12:55:20Z")

</div>

Thank you very much, Andras. Glad to have a little contribution to this great project 😉
