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
6 Likes
Much appreciated, worked flawlessly!
1 Like
Afternoon, I tried this out and got this Error message. I know nothing about Python. Hoping you can point me in the right direction. I copy and pasted from this post.
Warning:
IronPythonEvaluator.EvaluteIronPythonScipt
operation failed
Traceback (most recent call last):
File “”, line 30, in
TypeError:ViewSchedule is not iterable
Thanks in advance
Never mind on the last post, taught my self a little programming and figured out that the True False Statements match the Grand Total drop down. Thanks for sharing this Python!
1 Like