# Orient 3D Views to Section Views

**URL:** <https://forum.dynamobim.com/t/orient-3d-views-to-section-views/71219>\
**Category:** Revit\
**Tags:** python\
**Created:** [December 9, 2021, 6:04am UTC](https://forum.dynamobim.com/t/orient-3d-views-to-section-views/71219 "2021-12-09T06:04:59Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![theshysnail](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/theshysnail/32/146653_2.png) [@theshysnail](https://forum.dynamobim.com/u/theshysnail)\
**Post date:** [December 9, 2021, 6:04am UTC](https://forum.dynamobim.com/t/orient-3d-views-to-section-views/71219/1 "2021-12-09T06:04:59Z")

</div>

Hello,

I am creating 3D views in Revit and trying to orient them to each section view in the project. I am trying with the attached Dynamo graph.

It orients the 3D views fine but I cannot crop it out (front/back and top/bottom/left/right) to show the exact region.

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/e/e/eef64525328f3bea4e24faf9eb9383f5fc008357.png)

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/0/c/0c2eb65e535c950af826101568e1c6cdb8ba1efe.png)

[Orient To View.dyn](https://forum.dynamobim.com/uploads/short-url/4pGGuH37wtekIu9F5i35wHKE5P4.dyn) (13.6 KB)

---

<div class="post-metadata">

**Author:** ![Elie.Trad](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/elie.trad/32/110373_2.png) [@Elie.Trad](https://forum.dynamobim.com/u/Elie.Trad)\
**Post date:** [December 9, 2021, 11:49am UTC](https://forum.dynamobim.com/t/orient-3d-views-to-section-views/71219/2 "2021-12-09T11:49:05Z")

</div>

Hi @theshysnail, try to use the View CropBox node from the GeniusLoci package, it works well on slanted sections as well:

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/7/8/78415a33063d6e60c944ad580fd729d090047b18.png)

---

<div class="post-metadata">

**Author:** ![theshysnail](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/theshysnail/32/146653_2.png) [@theshysnail](https://forum.dynamobim.com/u/theshysnail)\
**Post date:** [December 9, 2021, 11:57am UTC](https://forum.dynamobim.com/t/orient-3d-views-to-section-views/71219/3 "2021-12-09T11:57:22Z")

</div>

It does not crop out the 3D view. It’s just oriented to the section view like before.

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/0/5/05e9560f9838a5885749e50ce15e38185a5fdc2b.png)

---

<div class="post-metadata">

**Author:** ![Elie.Trad](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/elie.trad/32/110373_2.png) [@Elie.Trad](https://forum.dynamobim.com/u/Elie.Trad)\
**Post date:** [December 9, 2021, 12:03pm UTC](https://forum.dynamobim.com/t/orient-3d-views-to-section-views/71219/4 "2021-12-09T12:03:53Z")

</div>

@theshysnail which version of Revit/ Dynamo you are using? If you notice that the node I am using is View **S**.SetCropBox, and it is working perfectly from my side…

---

<div class="post-metadata">

**Author:** ![theshysnail](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/theshysnail/32/146653_2.png) [@theshysnail](https://forum.dynamobim.com/u/theshysnail)\
**Post date:** [December 9, 2021, 1:11pm UTC](https://forum.dynamobim.com/t/orient-3d-views-to-section-views/71219/6 "2021-12-09T13:11:25Z")

</div>

Oh, you’re using the custom node from archi-lab. It works now. Thanks a lot.

---

<div class="post-metadata">

**Author:** ![theshysnail](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/theshysnail/32/146653_2.png) [@theshysnail](https://forum.dynamobim.com/u/theshysnail)\
**Post date:** [December 9, 2021, 1:32pm UTC](https://forum.dynamobim.com/t/orient-3d-views-to-section-views/71219/7 "2021-12-09T13:32:28Z")

</div>

I’m wondering if you can help me resolve this problem with the list iteration.

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/1/c/1cba7a5fac4db37c0c583fc803f83e6394ff2d96.png)

```auto
import clr
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *

#Import ToDSType(bool) extension method
clr.AddReference("RevitNodes")
import Revit
clr.ImportExtensions(Revit.Elements)
clr.ImportExtensions(Revit.GeometryConversion)

#Import DocumentManager and TransactionManager
clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager

from System.Collections.Generic import *

#Import RevitAPI
clr.AddReference("RevitAPI") 
import Autodesk
from Autodesk.Revit.DB import ReferencePointArray

view = UnwrapElement(IN[0])
vector = IN[1].ToRevitType()

doc = DocumentManager.Instance.CurrentDBDocument
uiapp = DocumentManager.Instance.CurrentUIApplication
app = uiapp.Application

TransactionManager.Instance.EnsureInTransaction(doc)

#apply lineweight override to elements in an input list

view.OrientTo(vector)
# "End" the transaction

TransactionManager.Instance.TransactionTaskDone()
OUT = doc.ActiveView

```

---

<div class="post-metadata">

**Author:** ![theshysnail](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/theshysnail/32/146653_2.png) [@theshysnail](https://forum.dynamobim.com/u/theshysnail)\
**Post date:** [December 9, 2021, 1:59pm UTC](https://forum.dynamobim.com/t/orient-3d-views-to-section-views/71219/8 "2021-12-09T13:59:29Z")

</div>

Created another post for the list input issue.

> [TypeError: iteration over non-sequence of type NoneType](https://forum.dynamobim.com/t/typeerror-iteration-over-non-sequence-of-type-nonetype/71243)

---

<div class="post-metadata">

**Author:** ![theshysnail](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/theshysnail/32/146653_2.png) [@theshysnail](https://forum.dynamobim.com/u/theshysnail)\
**Post date:** [December 14, 2021, 7:54am UTC](https://forum.dynamobim.com/t/orient-3d-views-to-section-views/71219/9 "2021-12-14T07:54:04Z")

</div>

Hey, I just noticed the orientation/section box is quite off and does not seem right for any 3D views. Any help?

---

<div class="post-metadata">

**Author:** ![theshysnail](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/theshysnail/32/146653_2.png) [@theshysnail](https://forum.dynamobim.com/u/theshysnail)\
**Post date:** [December 14, 2021, 9:01am UTC](https://forum.dynamobim.com/t/orient-3d-views-to-section-views/71219/10 "2021-12-14T09:01:03Z")

</div>

Orientation and Section Box both are off. Even if I reverse the Plane.Normal vector in graph, section box is still off.

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/9/f/9ffe083f1c9c3f3719e1e1307fb53c890e2f90eb.png)
