Use Dynamo, Python, and Excel to synchronize Revit key schedules across multiple Revit files.
On a campus-style project with 25 Revit files and a regularly changing area program, our team needed a workflow to generate an overall area schedule efficiently. Updating a single key schedule with the latest revisions could take up to one hour. Multiply that by 25 files and our team was looking at 25 hours of tedious key schedule revisions- in addition to potential issues with consistency.
Key Schedules and Multiple Revit Files
While key schedules are simple to setup and commonly used to assign multiple parameters in a single Revit file, maintaining synchronized key schedules across multiple Revit files is not fully supported OOTB.
Option 1: Use ‘Insert Views From File’ to transfer a key schedule.
This one-time, one-way transfer is acceptable if no changes to the key schedule are expected. Modifications to the key schedule require either [A] a full delete and re-import (This is especially destructive if key parameters were already assigned in the model, as those assignments are reset.) or [B] manual modification. (Time consuming and prone to inconsistency.)
Option 2: Use Dynamo and Python to synchronize changes from an Excel master.
This post will demonstrate a method to synchronize a regularly changing key schedule across multiple Revit files using Dynamo, Python, and Excel.
Part 1: Add Matching Parameters to Excel and Revit
Before synchronizing, it is important to setup Excel and each Revit file with matching parameters. To allow for maximum flexibility, consider using generic naming by parameter type.
Key Name [Key]
Department [Text]
Key_UniqueID [Text]
Key_Data_Text_01 [Text]
Key_Data_Text_02 [Text]
Key_Data_Text_03 [Text]
Key_Data_Text_04 [Text]
Key_Data_Text_05 [Text]
Key_Data_Number_01 [Number]
Key_Data_Number_02 [Number]
Key_Data_Number_03 [Number]
Key_Data_Number_04 [Number]
Key_Data_Number_05 [Number]
Key_Data_Area_01 [Area]
Key_Data_Area_02 [Area]
Key_Data_Area_03 [Area]
Key_Data_Area_04 [Area]
Key_Data_Area_05 [Area]
Notes on Parameter Setup:
Key schedules do not support shared parameters. Use project parameters.
‘Department’ is a built-in Revit parameter that is compatible with room tags.
Importing a key schedule using ‘Import Views From File’ will also import associated project parameters, if they do not already exist. This is useful for initializing multiple files.
Excel Master
Revit Key Schedule
Part 2: Generate Key_UniqueID
Synchronization requires a constant for comparison. The following Excel Macro (modified from this post) will generate a random string of 16 alphanumeric characters, which will serve as a UID constant.
Check for collisions using conditional formatting. Regenerate individual cells, if necessary.
Part 3: Synchronize Using Dynamo and Python
The first half of the Dynamo definition generates an ExcelList and a RevitList and collects their UID parameters for comparison.
Dynamo does not currently provide an OOTB node for Revit key schedules. The following Python code will return every key in a key schedule. (Credit to Konrad Sobon for this post, which explains how the Revit API treats keys in a Revit key schedule.)
The second half of the Dynamo definition compares UID parameters and synchronizes changes.
The following Python code creates new keys and outputs a list to Dynamo for parameter assignment.
18 parameters are assigned using a SynchronizeKeySchedule.SetParameters custom node.
Complete Graph
Once setup, modifications are easy. Simply open the Dynamo definition and run it on each Revit file.
Result
Key schedule modifications that would have taken hours (25 hours in the example above) now complete in just a few seconds per file, with consistently accurate results.