Aligning Viewport Titles with Viewport in Any Revit Version
Something that has been an ongoing pain in Revit for us all is the inability to location viewport titles through the API.
Thankfully in Revit 2022 they finally added this ability! I previously discussed this here.
The bummer is, that this doesn’t change anything for us in older Revit versions. But…. using some weird workarounds, similar to the model group origin one I discussed here, Model Group Origin Hack.
Working in the Revit UI manually we can map this thought process out:
- On a sheet, recognize a viewport that has a mismatched view title.
- Re-Add the view to the sheet
- Notice the view title encompasses the entire viewport and is located fairly nicely.
- Admire the action you made Revit do that cannot be done.
Here is a GIF of this in action in the Revit UI:
However, there are some considerations:
- You cannot control view title length (easily) – There are ways to work around this if you modify the viewport crop and things like that, but it requires more thought.
- The view title placement is fairly uncontrollable outside of modifying the viewports crop region.
- The original viewport ID is deleted from Revit because you replaced it with a new instance.
With that covered we can automate these actions in a single Dynamo node. (with proper sequencing)
Here is a GIF of this new node in action:
Full Overview Video
So…. exactly how does this look in code?
Unfortunately, it is *top secret…. Just Kidding.
The whole source code is available below!
It is worth noting that you would also probably want to store the viewport type, viewport number, and other parameters of interest before “re-placing” the viewport. But that is for another day.
- Someone else who thought similar (from 2017): Autodesk Forum
- This was discussed briefly on this live stream here: LiveStream