# Rotate the 3D View

**URL:** <https://discourse.slicer.org/t/rotate-the-3d-view/26435>\
**Category:** Development\
**Tags:** python\
**Created:** [November 25, 2022, 9:01am UTC](https://discourse.slicer.org/t/rotate-the-3d-view/26435 "2022-11-25T09:01:20Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![f1oNae](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/f1onae/32/17418_2.png) [@f1oNae](https://discourse.slicer.org/u/f1oNae)\
**Post date:** [November 25, 2022, 9:01am UTC](https://discourse.slicer.org/t/rotate-the-3d-view/26435/1 "2022-11-25T09:01:20Z")

</div>

I know I can rotate the 3D view through the code.

```auto
layoutManager = slicer.app.layoutManager()
threeDView = layoutManager.threeDWidget(0).threeDView()
threeDView.yaw()

```

But how can I rotate 3D view at any angle I need?For example,I need to rotate it 7.2 degrees.

I really need your help!Deeply grateful!

---

<div class="post-metadata">

**Author:** ![rbumm](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/rbumm/32/9404_2.png) [@rbumm](https://discourse.slicer.org/u/rbumm)\
**Post date:** [November 25, 2022, 11:38am UTC](https://discourse.slicer.org/t/rotate-the-3d-view/26435/2 "2022-11-25T11:38:48Z")

</div>

For your case (7.2 deg to the right) you could use:

```auto
layoutManager = slicer.app.layoutManager()
threeDView = layoutManager.threeDWidget(0).threeDView()
threeDView.yawDirection = threeDView.YawRight
threeDView.setPitchRollYawIncrement(7.2)
threeDView.yaw()

```

Kind regards
