Set Grids Vertical Extents

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 (7.1 KB)

Set Grid Extents

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

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

1 Like

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 (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

this will do it:

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
3 Likes

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

1 Like

what about horizontal extents?

which package is this? please and thank you.

1 Like

Data-shapes

2 Likes

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