Change grid extents custom node giving null

Hi,

I have adapted the script from here.

I had to recreate the custom nodes in the script using the python code provided in a previous post. However, it’s reaching the final node in the script, and giving null from there. I tried messing with the lacing and the levels of the inputs, but it’s all resulting in different amounts of nulls.

I have included the script, the custom nodes, and a simple revit file to make it easier to take a look at what’s happening. The dynamo files are version 2, and the revit file is 2019 (but can be replicated on any version using a series of grids and 2 lines passing through them).

SetGridExtentsModified2.dyn (84.3 KB)

grid extents.rvt (1.3 MB)
Set Grid Length.dyf (9.6 KB)
Get Grid Length.dyf (8.1 KB)

I make some change in your last node call Set Grid Length.
Please check this out and see if it work!

Set%20Grid%20Length

And this is the python script
I suggest you copy the script directly from the node.

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

Set Grid Length.dyf (9.6 KB)

1 Like

Thank you! It’s working now. How did you figure out the problem?

Well, I run the script and all the nodes run smoothly except this node: Set Grid Length.dyf.
So I take a look at my own node and decide to make some changes
And viola, I got the problems.

1 Like

I still get Null when trying to sue this script.

I am using Revit for 1.3. I cant pinpoint why it returns null.

This is my node for setting grid extents:
SetGridExtents_ms.dyn (35.5 KB)

This is my node for getting grid lengths:
Get Grid Lengths_MS.dyf (3.7 KB)

This is my node for setting grid lines:
Set Grid Lines_MS.dyf (4.3 KB)

My python script for set grids is as follows:

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

what are you doing with curves = and curvesViews =?

I dont understand what these lists do for you.

Can you explain what the solution entailed?

Thanks,

Hi…@mscottM6C4C…Do we need to download any custom packages because the script shows custom nodes not loaded…Can you tell me the required packages to be downloaded…Thanks in advance

yes. You would need to download the custom packages into your Dynamo.