import clr
import sys
import System
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *
import Autodesk.DesignScript.Geometry as DS
#import Revit API
clr.AddReference('RevitAPI')
import Autodesk
from Autodesk.Revit.DB import *
import Autodesk.Revit.DB as DB
clr.AddReference('RevitServices')
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
doc = DocumentManager.Instance.CurrentDBDocument
toList = lambda x : x if hasattr(x, '__iter__') else [x]
#Preparing input from dynamo to revit
lstviews = toList(UnwrapElement(IN[0]))
txtStyle = UnwrapElement(IN[1])
#Do some action in a Transaction
TransactionManager.Instance.EnsureInTransaction(doc)
for v in lstviews:
if v.ViewType == ViewType.Schedule:
v_def = v.Definition
v.BodyTextTypeId = txtStyle.Id
v.HeaderTextTypeId = txtStyle.Id
v.TitleTextTypeId = txtStyle.Id
#
v_def.ShowTitle = False
count = v_def.GetFieldCount()
for i in range(count):
field = v_def.GetField(i)
if field.CanTotal():
field.DisplayType = ScheduleFieldDisplayType.Totals
TransactionManager.Instance.TransactionTaskDone()
OUT = lstviews
import clr
import sys
import System
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *
import Autodesk.DesignScript.Geometry as DS
#import Revit API
clr.AddReference('RevitAPI')
import Autodesk
from Autodesk.Revit.DB import *
import Autodesk.Revit.DB as DB
clr.AddReference('RevitServices')
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
doc = DocumentManager.Instance.CurrentDBDocument
toList = lambda x : x if hasattr(x, '__iter__') else [x]
#Preparing input from dynamo to revit
lstviews = toList(UnwrapElement(IN[0]))
txtStyle = UnwrapElement(IN[1])
#Do some action in a Transaction
TransactionManager.Instance.EnsureInTransaction(doc)
for v in lstviews:
if v.ViewType == ViewType.Schedule:
v_def = v.Definition
#Set Text Type
v.BodyTextTypeId = txtStyle.Id
v.HeaderTextTypeId = txtStyle.Id
v.TitleTextTypeId = txtStyle.Id
#Hide Title
v_def.ShowTitle = False
#Don´t itemize every instance
v_def.IsItemized = False
#Show grant totals
v_def.ShowGrandTotal = True
v_def.ShowGrandTotalTitle = True
v_def.GrandTotalTitle = "SUMME"
count = v_def.GetFieldCount()
for i in range(count):
field = v_def.GetField(i)
if field.CanTotal():
field.DisplayType = ScheduleFieldDisplayType.Totals
TransactionManager.Instance.TransactionTaskDone()
OUT = lstviews
So the last step would be to activate the outline of the schedule, but i can´t find that in the API, i´m afraid i have to do that with the viewtemplate…