# Get current view range values. python

**URL:** <https://forum.dynamobim.com/t/get-current-view-range-values-python/95026>\
**Category:** Revit\
**Tags:** python, dynamo\
**Created:** [October 30, 2023, 6:29pm UTC](https://forum.dynamobim.com/t/get-current-view-range-values-python/95026 "2023-10-30T18:29:42Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![AM3D.BIM.STUDIO](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/am3d.bim.studio/32/127441_2.png) [@AM3D.BIM.STUDIO](https://forum.dynamobim.com/u/AM3D.BIM.STUDIO)\
**Post date:** [October 30, 2023, 6:29pm UTC](https://forum.dynamobim.com/t/get-current-view-range-values-python/95026/1 "2023-10-30T18:29:42Z")

</div>

Very good days.  
I would like your help…  
I am trying to enter the parameters and values ​​that are in CURRENT VIEW RANGE.  
Could you please guide me on how to access it through a python code… I am very new to python and the revit api.

Thank you so much

 ![01_Obtener el rango de vista actual](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/2/5/25aa08c72dcf358542a829a9be31bd036def66b7.png)

---

<div class="post-metadata">

**Author:** ![staylor](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/staylor/32/94307_2.png) [@staylor](https://forum.dynamobim.com/u/staylor)\
**Post date:** [October 30, 2023, 6:57pm UTC](https://forum.dynamobim.com/t/get-current-view-range-values-python/95026/2 "2023-10-30T18:57:44Z")

</div>

GeniusLoci package already has Set ViewRange node. They are generous enough to allow you to edit the node if you want to see how it’s coded with the API. Just remember to give kudos to the creator if you modify and reshare the code here.

---

<div class="post-metadata">

**Author:** ![AM3D.BIM.STUDIO](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/am3d.bim.studio/32/127441_2.png) [@AM3D.BIM.STUDIO](https://forum.dynamobim.com/u/AM3D.BIM.STUDIO)\
**Post date:** [October 30, 2023, 7:07pm UTC](https://forum.dynamobim.com/t/get-current-view-range-values-python/95026/3 "2023-10-30T19:07:43Z")

</div>

Thanks for your comment…  
But I’m trying to do it through python and at the same time learn code…

---

<div class="post-metadata">

**Author:** ![AM3D.BIM.STUDIO](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/am3d.bim.studio/32/127441_2.png) [@AM3D.BIM.STUDIO](https://forum.dynamobim.com/u/AM3D.BIM.STUDIO)\
**Post date:** [October 30, 2023, 7:08pm UTC](https://forum.dynamobim.com/t/get-current-view-range-values-python/95026/4 "2023-10-30T19:08:25Z")

</div>

How to extract that value for example…?’

 ![02_Obtener el rango de vista actual](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/7/4/746ba713ec85af59a8aa443ae80c67433530b95d.png)

---

<div class="post-metadata">

**Author:** ![staylor](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/staylor/32/94307_2.png) [@staylor](https://forum.dynamobim.com/u/staylor)\
**Post date:** [October 30, 2023, 7:35pm UTC](https://forum.dynamobim.com/t/get-current-view-range-values-python/95026/5 "2023-10-30T19:35:17Z")

</div>

Looking at other’s code is a good way to learn, but I understand the effort of wanting to figure out yourself. You have to define which plan view plane you are wanting to get the offset value for.

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

EDIT  
You are close with what you have. You don’t necessarily need the vrange and pvplane output, but that’s just my way of checking my code.

```auto
av = doc.ActiveView

vrange = av.GetViewRange()
pvplane = PlanViewPlane.BottomClipPlane
offset = vrange.GetOffset(pvplane)

OUT = vrange, pvplane, offset

```

---

<div class="post-metadata">

**Author:** ![GavinNicholls](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/gavinnicholls/32/190442_2.png) [@GavinNicholls](https://forum.dynamobim.com/u/GavinNicholls)\
**Post date:** [October 31, 2023, 2:31am UTC](https://forum.dynamobim.com/t/get-current-view-range-values-python/95026/6 "2023-10-31T02:31:08Z")

</div>

To add on to the learning (and completely agree - learn from seeing how others do it), the main issue with your code I believe was calling PlanViewRange only. PlanViewRange is what we call an enum (enumeration), which has pre-set values that you append on the end like a Property.

They’re quite common in the RevitAPI and it can be handy to use RevitAPIdocs to identify when they are needed, as well as what options you can use. They confused me a lot when I first came across them, so hopefully that helps.

> **[PlanViewPlane Enumeration](https://www.revitapidocs.com/2023/80d20187-97ea-f6c0-a3a8-d5545e0b3863.htm)**
>
> Online Documentation for Autodesk's Revit API: 2015, 2016, 2017, 2017.1, 2018

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

---

<div class="post-metadata">

**Author:** ![ceskoMU3VA](https://avatars.discourse-cdn.com/v4/letter/c/dbc845/32.png) [@ceskoMU3VA](https://forum.dynamobim.com/u/ceskoMU3VA)\
**Post date:** [October 31, 2023, 4:51am UTC](https://forum.dynamobim.com/t/get-current-view-range-values-python/95026/7 "2023-10-31T04:51:24Z")

</div>

This is really great nodes. Thank you @staylor for the info.  
These two nodes are actually python nodes.

 ![Get_Set_View Range](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/3/1/31e8b4cbb9e99c2dae5bb167ea0b4988e90fa596.png)

---

<div class="post-metadata">

**Author:** ![pierre.martinA96CS](https://avatars.discourse-cdn.com/v4/letter/p/439d5e/32.png) [@pierre.martinA96CS](https://forum.dynamobim.com/u/pierre.martinA96CS)\
**Post date:** [July 12, 2024, 12:03pm UTC](https://forum.dynamobim.com/t/get-current-view-range-values-python/95026/8 "2024-07-12T12:03:44Z")

</div>

Hello, I have a question regarding what was said above. I managed to do it on my own but it’s the same program. I can change the view range of plan view and ceiling view. now I would like to change the setLevel top. I don’t leave the level associated.  
How do you know the parameter?
