# Toggling Parallel Projection programmatically not updating the 3D viewer

**URL:** <https://discourse.slicer.org/t/toggling-parallel-projection-programmatically-not-updating-the-3d-viewer/40548>\
**Category:** Support\
**Created:** [December 6, 2024, 9:34pm UTC](https://discourse.slicer.org/t/toggling-parallel-projection-programmatically-not-updating-the-3d-viewer/40548 "2024-12-06T21:34:18Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![smrolfe](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/smrolfe/32/3659_2.png) [@smrolfe](https://discourse.slicer.org/u/smrolfe)\
**Post date:** [December 6, 2024, 9:34pm UTC](https://discourse.slicer.org/t/toggling-parallel-projection-programmatically-not-updating-the-3d-viewer/40548/1 "2024-12-06T21:34:18Z")

</div>

When I set the parallel projection parameter of the 3D view in the Python Console, the camera updates, but the parallel projection button in the 3D viewer does not. If it’s toggled off using the button and turned on programmatically, it reverts back to off after scene interaction.

I tried calling `slicer.app.processEvents()` and triggering different events, but I don’t seem to be able to get this setting to update.

This can be replicated with the code below.

```auto
viewNode1 = slicer.mrmlScene.GetFirstNodeByName("View1")
camera1 = slicer.modules.cameras.logic().GetViewActiveCameraNode(viewNode1)
camera1.SetParallelProjection(0)
camera1.SetParallelProjection(1)

```

---

<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:** [December 6, 2024, 10:14pm UTC](https://discourse.slicer.org/t/toggling-parallel-projection-programmatically-not-updating-the-3d-viewer/40548/2 "2024-12-06T22:14:53Z")

</div>

~~Camera parameters must be changed at MRML level (in the camera node). If you modify anything directly at lower level in VTK then the change will not be effective and will be undone when the camera node is modified. If this is not described in the camera node documentation then it would be great if you could submit a pull request that adds it. Thank you!~~

I’ve had another look and that you used the camera node method, so the update should work well. I’ll debug this.
