Set Grids Vertical Extents returns Null

Hello,

I’ve been trying to move the grid lines with a decimal point lower than the whole numbers but the Set Grids Vertical Extents node is returning null.

I looked at this post and this post but I still can’t get it to work. (@Mostafa_El_Ayoubi)


Thanks =)

@khronart these nodes work only in sections and elevations, for plan views check out this post, it should have the solution somewhere:

I am working on a section.

@khronart Ah ok, even if it will return Null, it is working, maybe the value 0.5 is so small you cannot tell the difference, try with bigger values.

0.5 is a multiplier so that I get half the distance from the whole number grids, I have gone up to 1000 units.

@khronart can you share your Revit file? What is the output of the filter node?

Definitely, please see the attached files. Thanks for your help.

Grid Levels in Elev.dyn (23.4 KB)
Grids.rvt (5.0 MB)

@khronart since you are using Revit 2022, there are some changes to the units in the Revit API, which makes the node you are using obsolete, if you have the Orchid Package you can use the same node’s name and it will work, but I think you need to convert your units prior any modification to the extents of the grids:
image

Edit: or the Data-Shapes python script edited to accommodate the Revit API units modification:

#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 (Does not work with Revit 2022)
#Works with Revit 2022:
UIunit = Document.GetUnits(doc).GetFormatOptions(SpecTypeId.Length).GetUnitTypeId()


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

if IN[0] != True:
	grids = toList(IN[0])
else:
	grids = [UnwrapElement(i) for i in FilteredElementCollector(doc).OfClass(Grid)]

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

OUT = grids

Worked like a charm!

Thank you =)

1 Like