# Set Grids Vertical Extents

**URL:** <https://forum.dynamobim.com/t/set-grids-vertical-extents/14641>\
**Category:** Revit\
**Created:** [September 7, 2017, 3:58pm UTC](https://forum.dynamobim.com/t/set-grids-vertical-extents/14641 "2017-09-07T15:58:27Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![jmmiller](https://avatars.discourse-cdn.com/v4/letter/j/3be4f8/32.png) [@jmmiller](https://forum.dynamobim.com/u/jmmiller)\
**Post date:** [September 7, 2017, 3:58pm UTC](https://forum.dynamobim.com/t/set-grids-vertical-extents/14641/1 "2017-09-07T15:58:27Z")

</div>

I am attempting to set the vertical extents of structural grids in my current project to match the vertical extents in of the structural girds from a linked model. I am trying to utilize Data-Shapes’ node “Grid.SetVerticalExtents”. I am not entirely sure I am inputting the correct information into the node. Please see below image and attached graph. Any assistance would be appreciated.

[Set Grid Extents from Link Grids.dyn](https://forum.dynamobim.com/uploads/short-url/rfj2qPETTRuZQA3YiYwCdjXlki0.dyn) (7.1 KB)

![Set Grid Extents](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/9/f/9f27884144cea655446d81d9c661613305e4bd1b.png)

---

<div class="post-metadata">

**Author:** ![jmmiller](https://avatars.discourse-cdn.com/v4/letter/j/3be4f8/32.png) [@jmmiller](https://forum.dynamobim.com/u/jmmiller)\
**Post date:** [September 18, 2017, 1:09pm UTC](https://forum.dynamobim.com/t/set-grids-vertical-extents/14641/2 "2017-09-18T13:09:43Z")

</div>

@Mostafa_El_Ayoubi - Do you think you can provided any insight on how to use the “Grid.SetVerticalExtents” node from Data-Shapes package?

---

<div class="post-metadata">

**Author:** ![Mostafa\_El\_Ayoubi](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/mostafa_el_ayoubi/32/7815_2.png) [@Mostafa\_El\_Ayoubi](https://forum.dynamobim.com/u/Mostafa_El_Ayoubi)\
**Post date:** [September 19, 2017, 8:21am UTC](https://forum.dynamobim.com/t/set-grids-vertical-extents/14641/3 "2017-09-19T08:21:43Z")

</div>

Hi @jmmiller,  
here’s how to use it. It’s pretty straightforward (the node modifies all grids in the project):

 ![grid extents](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/3/8/38c7ce175394b735049cf0d1579841b9ae50f1d2.gif)

---

<div class="post-metadata">

**Author:** ![jmmiller](https://avatars.discourse-cdn.com/v4/letter/j/3be4f8/32.png) [@jmmiller](https://forum.dynamobim.com/u/jmmiller)\
**Post date:** [September 19, 2017, 10:59am UTC](https://forum.dynamobim.com/t/set-grids-vertical-extents/14641/4 "2017-09-19T10:59:07Z")

</div>

Thank you @Mostafa_El_Ayoubi. That solves one issue I was having. Originally I was trying to feed in points for the inputs. Is there way to modify the node to accept a list of grids and extent inputs? I have been able to generate some python from the original node to accept a list of grids, but I am not sure how to modify the “SetVerticalExtents” portion to accept a list of values. See below for Dynamo graph and python code. Any additional help would be appreciated.

[Fix Grids extents\_beta.dyn](https://forum.dynamobim.com/uploads/short-url/g0yOSGL26qzvu9RcsWkK5R4IYPZ.dyn) (4.1 KB)

```
import clr
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import*
clr.AddReference('RevitServices')
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager

doc = DocumentManager.Instance.CurrentDBDocument
UIunit = Document.GetUnits(doc).GetFormatOptions(UnitType.UT_Length).DisplayUnits

def convunit(x):
	return UnitUtils.ConvertToInternalUnits(x,UIunit)

grids = []
for i in IN[2]:
	grids.append(UnwrapElement(i))

TransactionManager.Instance.EnsureInTransaction(doc)
for g in grids:
	g.SetVerticalExtents(convunit(IN[0]),convunit(IN[1]))
TransactionManager.Instance.TransactionTaskDone()

OUT = grids
```

---

<div class="post-metadata">

**Author:** ![Mostafa\_El\_Ayoubi](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/mostafa_el_ayoubi/32/7815_2.png) [@Mostafa\_El\_Ayoubi](https://forum.dynamobim.com/u/Mostafa_El_Ayoubi)\
**Post date:** [September 19, 2017, 1:08pm UTC](https://forum.dynamobim.com/t/set-grids-vertical-extents/14641/5 "2017-09-19T13:08:39Z")

</div>

this will do it:

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

IN[0] = list of grids  
IN[1] = list of bottom extent Z values  
IN[2] = list or top extent Z values

here’s the code:

```
#Copyright (c) mostafa el ayoubi
#Node-mode www.data-shapes.net 2016 elayoub.mostafa@gmail.com

import clr
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import*
clr.AddReference('RevitServices')
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager

doc = DocumentManager.Instance.CurrentDBDocument
UIunit = Document.GetUnits(doc).GetFormatOptions(UnitType.UT_Length).DisplayUnits

def convunit(x):
	return UnitUtils.ConvertToInternalUnits(x,UIunit)
def tolist(input):
	if isinstance(input,list):
		return UnwrapElement(input)
	else:
		return [UnwrapElement(input)]

grids = tolist(IN[0])

TransactionManager.Instance.EnsureInTransaction(doc)
for g,bottom,top in zip(grids,IN[1],IN[2]):
	g.SetVerticalExtents(convunit(bottom),convunit(top))
TransactionManager.Instance.TransactionTaskDone()

OUT = grids
```

---

<div class="post-metadata">

**Author:** ![jmmiller](https://avatars.discourse-cdn.com/v4/letter/j/3be4f8/32.png) [@jmmiller](https://forum.dynamobim.com/u/jmmiller)\
**Post date:** [September 20, 2017, 5:07pm UTC](https://forum.dynamobim.com/t/set-grids-vertical-extents/14641/6 "2017-09-20T17:07:21Z")

</div>

Thank You @Mostafa_El_Ayoubi. This is perfect. I really appreciate your help.

---

<div class="post-metadata">

**Author:** ![mscottM6C4C](https://avatars.discourse-cdn.com/v4/letter/m/e36b37/32.png) [@mscottM6C4C](https://forum.dynamobim.com/u/mscottM6C4C)\
**Post date:** [November 16, 2018, 6:07pm UTC](https://forum.dynamobim.com/t/set-grids-vertical-extents/14641/7 "2018-11-16T18:07:35Z")

</div>

what about horizontal extents?

---

<div class="post-metadata">

**Author:** ![arshamm](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/arshamm/32/38064_2.png) [@arshamm](https://forum.dynamobim.com/u/arshamm)\
**Post date:** [February 22, 2019, 8:08pm UTC](https://forum.dynamobim.com/t/set-grids-vertical-extents/14641/8 "2019-02-22T20:08:25Z")

</div>

which package is this? please and thank you.

---

<div class="post-metadata">

**Author:** ![Mostafa\_El\_Ayoubi](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/mostafa_el_ayoubi/32/7815_2.png) [@Mostafa\_El\_Ayoubi](https://forum.dynamobim.com/u/Mostafa_El_Ayoubi)\
**Post date:** [February 22, 2019, 8:24pm UTC](https://forum.dynamobim.com/t/set-grids-vertical-extents/14641/9 "2019-02-22T20:24:36Z")

</div>

Data-shapes

---

<div class="post-metadata">

**Author:** ![Charles.ciro](https://avatars.discourse-cdn.com/v4/letter/c/c5a1d2/32.png) [@Charles.ciro](https://forum.dynamobim.com/u/Charles.ciro)\
**Post date:** [May 14, 2019, 9:17pm UTC](https://forum.dynamobim.com/t/set-grids-vertical-extents/14641/10 "2019-05-14T21:17:39Z")

</div>

I’ve the same question @Mostafa_El_Ayoubi , is there any option respect to this?
