# Modify view range

**URL:** <https://forum.dynamobim.com/t/modify-view-range/19897>\
**Category:** Revit\
**Created:** [March 11, 2018, 8:37pm UTC](https://forum.dynamobim.com/t/modify-view-range/19897 "2018-03-11T20:37:06Z")\
**Posts on this page:** 11\
**Page:** 2

<div class="post-metadata">

**Author:** ![kennyb6](https://avatars.discourse-cdn.com/v4/letter/k/7ba0ec/32.png) [@kennyb6](https://forum.dynamobim.com/u/kennyb6)\
**Post date:** [September 9, 2019, 2:24pm UTC](https://forum.dynamobim.com/t/modify-view-range/19897/22 "2019-09-09T14:24:48Z")

</div>

Those conversion nodes were because Revit handles everything in decimal feet internally. So when we want to set something in mm or m, we have to convert the dimension to feet first and then send it to RevitAPI commands.

You can do this conversion in the python node but that conversion node is more accurate than the number you might type in. Also, it should be from whatever your project’s base unit is to feet, not millimeters to millimeters. That is why your number is so far off.

So if your units are millimeters, set it to millimeters to feet.

---

<div class="post-metadata">

**Author:** ![1610234](https://avatars.discourse-cdn.com/v4/letter/1/71c47a/32.png) [@1610234](https://forum.dynamobim.com/u/1610234)\
**Post date:** [September 13, 2019, 8:37am UTC](https://forum.dynamobim.com/t/modify-view-range/19897/23 "2019-09-13T08:37:35Z")

</div>

Okay thanks you sir i’ll try it

---

<div class="post-metadata">

**Author:** ![Deniz\_Maral](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/deniz_maral/32/80323_2.png) [@Deniz\_Maral](https://forum.dynamobim.com/u/Deniz_Maral)\
**Post date:** [September 13, 2019, 12:50pm UTC](https://forum.dynamobim.com/t/modify-view-range/19897/24 "2019-09-13T12:50:57Z")

</div>

Hi Kenny,

I would like to change only the Offset of Cut Plane because I set the other levels to infinitive. I edited your code but it did not work. I am beginner at Python. Could you please take a look?

> import clr  
> clr.AddReference(‘RevitAPI’)  
> from Autodesk.Revit.DB import\*  
> clr.AddReference(‘RevitServices’)  
> from RevitServices.Persistence import DocumentManager  
> from RevitServices.Transactions import TransactionManager
> 
> def modViewrange(cof):  
> v = UnwrapElement(vp)  
> viewrange = v.GetViewRange()  
> asslvl = v.GenLevel
> 
> viewrange.SetOffset(PlanViewPlane.CutPlane,cof)
> 
> #Applying the viewrange to the view  
> v.SetViewRange(viewrange)
> 
> doc = DocumentManager.Instance.CurrentDBDocument  
> count = 0
> 
> TransactionManager.Instance.EnsureInTransaction(doc)  
> if isinstance(IN[0],list) and isinstance(IN[1],list):  
> for cof in zip(IN[0],IN[1]):  
> modViewrange(cof)  
> count += 1
> 
> TransactionManager.Instance.TransactionTaskDone()
> 
> OUT = ‘%d view ranges altered’ %(count)

---

<div class="post-metadata">

**Author:** ![Deniz\_Maral](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/deniz_maral/32/80323_2.png) [@Deniz\_Maral](https://forum.dynamobim.com/u/Deniz_Maral)\
**Post date:** [September 13, 2019, 1:36pm UTC](https://forum.dynamobim.com/t/modify-view-range/19897/25 "2019-09-13T13:36:28Z")

</div>

I tried it again and now it works! Thanks Kenny!!!

 ![Viewrange](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/7/c/7c29cca8c343a67b50c001cd3dc3674a08b28ee2.png)

---

<div class="post-metadata">

**Author:** ![mauriciolimax](https://avatars.discourse-cdn.com/v4/letter/m/8797f3/32.png) [@mauriciolimax](https://forum.dynamobim.com/u/mauriciolimax)\
**Post date:** [October 13, 2019, 11:12pm UTC](https://forum.dynamobim.com/t/modify-view-range/19897/26 "2019-10-13T23:12:27Z")

</div>

Hi guys!

I’m trying to use this script with a list of levels, but it is not working. Can anyone help me?

I created a list to input in the node “String.Contais”, but the result is empty list. On the Revit I have the levels (Level 01, Level 02)

 ![Modify_view%20range%20question](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/0/c/0c591da6a0259ff00361476ea308a13b44edce76.png)

---

<div class="post-metadata">

**Author:** ![Deniz\_Maral](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/deniz_maral/32/80323_2.png) [@Deniz\_Maral](https://forum.dynamobim.com/u/Deniz_Maral)\
**Post date:** [October 14, 2019, 8:32am UTC](https://forum.dynamobim.com/t/modify-view-range/19897/27 "2019-10-14T08:32:02Z")

</div>

It would be better to search them seperately but you can still “search for” @L1 and than for Level 01 and Level 02 two lists. Or you can change to Lacing to Cross Product and then transpose the list. My recommandation would be to create 2 String Contains Node and search seperately and then create a new list with 2 results.

---

<div class="post-metadata">

**Author:** ![mauriciolimax](https://avatars.discourse-cdn.com/v4/letter/m/8797f3/32.png) [@mauriciolimax](https://forum.dynamobim.com/u/mauriciolimax)\
**Post date:** [October 14, 2019, 4:26pm UTC](https://forum.dynamobim.com/t/modify-view-range/19897/28 "2019-10-14T16:26:04Z")

</div>

i’m using the list because the next step of my script is import from excel the values of “Level name” and “view range”. If I change my script to create 2 “String.Contains” , I can’t import automatically from excel more then one value.

 ![Modify_view%20range%20question4](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/7/e/7ea27ef281b70d8c22cb6d98f1e7ef5a18a3ce95.png)

---

<div class="post-metadata">

**Author:** ![Deniz\_Maral](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/deniz_maral/32/80323_2.png) [@Deniz\_Maral](https://forum.dynamobim.com/u/Deniz_Maral)\
**Post date:** [October 15, 2019, 7:31am UTC](https://forum.dynamobim.com/t/modify-view-range/19897/29 "2019-10-15T07:31:17Z")

</div>

Now I get it what you want to do. You search for Levels in PlanViews and it is normal to get an empty list. You want to change automaticly the levels in view ranges… so you have to edit the Python script.

---

<div class="post-metadata">

**Author:** ![pitern](https://avatars.discourse-cdn.com/v4/letter/p/5daacb/32.png) [@pitern](https://forum.dynamobim.com/u/pitern)\
**Post date:** [October 17, 2019, 11:46am UTC](https://forum.dynamobim.com/t/modify-view-range/19897/30 "2019-10-17T11:46:56Z")

</div>

Hi Kenny!  
Some time ago there was question about Ceiling Plans, your advice was about filtering method but I think the problem is somewhere else.  
I’m poor in python but even when picking single view script is working with Structural Plans oriented down, but there is an error when I changed view direction to UP.

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

---

<div class="post-metadata">

**Author:** ![annikruell](https://avatars.discourse-cdn.com/v4/letter/a/ea5d25/32.png) [@annikruell](https://forum.dynamobim.com/u/annikruell)\
**Post date:** [August 5, 2020, 7:04am UTC](https://forum.dynamobim.com/t/modify-view-range/19897/31 "2020-08-05T07:04:20Z")

</div>

Hello everyone,  
I would like to select a special level and set it with 0.  
but i don’t get it.  
Can You Help?

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

---

<div class="post-metadata">

**Author:** ![dspshin073a](https://avatars.discourse-cdn.com/v4/letter/d/9e8a1a/32.png) [@dspshin073a](https://forum.dynamobim.com/u/dspshin073a)\
**Post date:** [January 6, 2021, 2:30am UTC](https://forum.dynamobim.com/t/modify-view-range/19897/32 "2021-01-06T02:30:59Z")

</div>

thank you

[Previous page](https://forum.dynamobim.com/t/modify-view-range/19897.md?page=1)
