Change Extent of Grids and Levels

I’m trying to control grid line extents using the script worked on in this post:Change grid extents custom node giving null

Im using Dynamo 1.3. Not sure why I get Null in the end.

SetGridExtents_ms.dyn (35.3 KB)
Set Grid Lines_MS.dyf (4.3 KB)
Get Grid Lengths_MS.dyf (3.7 KB)

This is my df code the returns null:
import clr
clr.AddReference(‘ProtoGeometry’)
from Autodesk.DesignScript.Geometry import *

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

#Import RevitAPI
clr.AddReference(“RevitAPI”)
import Autodesk
from Autodesk.Revit.DB import *

clr.AddReference(“RevitNodes”)
import Revit
clr.ImportExtensions(Revit.GeometryConversion)

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

grids = UnwrapElement(IN[0])
view = UnwrapElement(IN[1])
crvs = UnwrapElement(IN[2])

curves =
curvesViews =

TransactionManager.Instance.EnsureInTransaction(doc)

for i in range(0,len(grids)):
grids[i].SetCurveInView(DatumExtentType.ViewSpecific,view,crvs[i])

TransactionManager.Instance.TransactionTaskDone()

#Assign your outputs to the OUT variable
OUT = grids

Please provide a picture that is readable with Node names.

Allso, is the length of the crvs and grids the same? Since you are using the len of grids, if there aren’t as many curves you’ll get an error.

hello sean,

my number of grids and number of curves are equal. I updated the picture so that the text is readable with Node names

It looks like you are using incorrect levels on the last node. The Grids and Curve shouldn’t have a Level, an I am not sure the View should either.

Also, it looks like you are feeding it “lines” which sometimes are ok as “curves” but not always. Try changing the levels and /or getting the “lines” to be actual curves like what is in the Lower portion of your graph.

It also doesn’t work with levels removed.

I replaced the python script with Line.ByStartPointEndPoint and still did not work.

Not sure why I’m getting null values