Access Custom Grand Total Title through Revit API?

I am trying to access the Custom grand total field in a Revit schedule. I can’t seem to find any nodes that actually can overwrite it. I did find a definition through the Revit API, which is unfortunately not in Python and I am quite iliterate in the other languages to create a custom node myself… Does anyone have a python solution to access that field or even better a node from an existing dynamo package? That would be much appreciated!


Hi @Antonio_Vachev try this:

import clr
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *

clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager


clr.AddReference("RevitAPI")
import Autodesk
from Autodesk.Revit.DB import *

doc = DocumentManager.Instance.CurrentDBDocument

schedules = UnwrapElement(IN[0])
titles = IN[1]

if isinstance(titles, list):
	titles = titles
else:
	titles = [titles]
	
gTitles = []

TransactionManager.Instance.EnsureInTransaction(doc)

for s,t in zip(schedules,titles):
	sDef = s.Definition
	sDef.ShowGrandTotal = True
	sDef.ShowGrandTotalTitle = True
	sDef.ShowGrandTotalCount = True
	sDef.GrandTotalTitle = t
	gTitles.append(t)
	
TransactionManager.Instance.TransactionTaskDone()

OUT = gTitles

If you want only the Title and totals, remove line 33 from the Python code

3 Likes

Much appreciated, worked flawlessly!

1 Like