Reset Schedule Title and Heading Fonts

Is anyone aware of a method for resetting the title and heading fields of schedules?

I haven’t been able to locate a node to do this, but assume Python could be used, although I’m not proficient at all and this is as far as I have got:

1 Like

The error implies that you are providing a list of schedules rather than a single schedule. In that case, you would write something like this:

schedules = UnwrapElement(IN[0])
TransactionManager.Instance.EnsureInTransaction(doc)
for schedule in schedules:
    schedule.ResetOverride()
TransactionManager.Instance.TransactionTaskDone()

@cgartland, thank you for the response! I tried your recommendation and still get an error.

schedules = UnwrapElement(IN[0])
TransactionManager.Instance.EnsureInTransaction(doc)
for schedule in schedules:
    schedule_def = schedule.Definition
    # get schedule field
    schedule_field.ResetOverride()
TransactionManager.Instance.TransactionTaskDone()

The process seems to be a bit more complicated. I can’t test this myself, but you will have to get each of the schedule fields in each schedule definition and use the ResetOverride method on each of those. The ScheduleDefinition class has a GetField method which accepts an integer, but does not appear to have a “GetFields” method, so the process of getting all fields is unclear.

Hello

the method ScheduleField.ResetOverride() is not suitable for this.
it is necessary to apply an empty TableCellStyle object with method SetCellStyle()

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

#import Revit API
clr.AddReference('RevitAPI')
import Autodesk
from Autodesk.Revit.DB import *

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 ]
viewsSchedule = toList(UnwrapElement(IN[0]))
tableStyle = TableCellStyle()
tableStyle.ResetOverride() #optional
TransactionManager.Instance.EnsureInTransaction(doc)
for view in viewsSchedule:
	if view.ViewType == ViewType.Schedule:
		tableData = view.GetTableData()
		headerSect = tableData.GetSectionData(SectionType.Header)
		headerSect.SetCellStyle(tableStyle)
TransactionManager.Instance.TransactionTaskDone()	

OUT = viewsSchedule
2 Likes

@c.poupin, thank you so much, this works perfectly! I would have never figured this out on my own!

1 Like

How about a python way to add/change the bottom line style of the schedule title cell?

I’ve tried @Konrad_K_Sobon’s archi-lab “cell style settings” and “schedule tile appearance” nodes, but can’t get it to do this. I can get the node to change the the font, font size, bold, italic, underline, etc…but once I enter the line type for a border the node result becomes ‘null’.

Is it possible the API has changed so this aspect of the node no longer works? I’m working in Revit 2019.2 & Dynamo 2.0.3.

I have followed the discussion in this post and still having problems:

Hi @JustinStirling
try this

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

#import Revit API
clr.AddReference('RevitAPI')
import Autodesk
from Autodesk.Revit.DB import *

clr.AddReference('RevitServices')
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
doc = DocumentManager.Instance.CurrentDBDocument

toFirst = lambda x : x.Item[0] if hasattr(x, "__iter__") else  x 
toList = lambda x : x if hasattr(x, "__iter__") else [ x ]
viewsSchedule = toList(UnwrapElement(IN[0]))
lineStyle = toFirst(UnwrapElement(IN[1]))

#create option for Override bottom Line
options = TableCellStyleOverrideOptions()
options.BorderLineStyle = False
options.BorderBottomLineStyle = True
options.BorderLeftLineStyle = False
options.BorderRightLineStyle = False
options.BorderTopLineStyle = False
#createTableStyle
tableStyle = TableCellStyle()
tableStyle.ResetOverride() 
tableStyle.SetCellStyleOverrideOptions(options)
tableStyle.BorderBottomLineStyle = lineStyle.GraphicsStyleCategory.Id

#Main
TransactionManager.Instance.EnsureInTransaction(doc)
for view in viewsSchedule:
	if view.ViewType == ViewType.Schedule:
		tableData = view.GetTableData()
		headerSect = tableData.GetSectionData(SectionType.Header)
		headerSect.SetCellStyle(tableStyle)
TransactionManager.Instance.TransactionTaskDone()	

OUT = viewsSchedule

Here’s the error result of this:

Error says it doesn’t need List…
So, to solve this before feeding IN[1] use FirstItem node or G[0] in codeblock.

1 Like

@JustinStirling
code updated, you can also use :

  • the @Kulkul 's trick
  • the Line Styles node from ArchiLab

First of all, @c.poupin, if you attached a code in the message above it didn’t come through.

Secondly, every time I try to add the Archi-lab “Line Styles” node to my graph, it crashes Dynamo (although other Archi-lab nodes still do work). I’m using Revit 2019.2.2 with Dynamo 2.0.3.8811, so I’ve installed Archi-lab package version 2019.2.27. @Konrad_K_Sobon, should I be using a different version of your package for the software versions I’m currently using?

@Kulkul, I tried your codeblock method and got the results I was looking for, so thank you!

@JustinStirling
sorry I forgot to paste the link to the code, it’s fixed
(I used the previous post to not overload the topic)

1 Like