@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:
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