Revit’s recent templates list in temporary view properties is not per user, and the templates keep being applied over changes done by a user during syncs which is highly undesirable. I don’t see a way to clear it manually, and am hoping there is a way that I could use Dynamo to empty the list.
I do not see any options for it in the API… ![]()
That one is notoriously hard to find. I never could get that reset when I worked on this tool a few years ago:
I was afraid of that, but had hoped I was just missing something in my skim of the api and it was called something different. I could deal with just seeing them, but having the top recent template override my current temporarily overridden settings on a view multiple times in a session is very frustrating.
Well, I did find a hack to fixing it, which maybe could be turned into a script? The “recent” list holds 5 templates, so I made 5 dummy templates, temporarily assigned them in turn so the list was full of my newly created templates, restored view properties, then deleted all 5 templates, and the list was cleared!!
Try this
import clr
from System.Collections.Generic import List
clr.AddReference("RevitServices")
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
clr.AddReference("RevitAPI")
from Autodesk.Revit.DB import ElementId
doc = DocumentManager.Instance.CurrentDBDocument
# Active View
av = doc.ActiveView
assert (
av.IsViewValidForTemplateCreation and av.CanEnableTemporaryViewPropertiesMode()
), "Active View is not able to create templates or enable temporary views"
# Get current temporary view properties
current_temp_view = av.GetTemporaryViewPropertiesId()
TransactionManager.Instance.EnsureInTransaction(doc)
# Create Templates
templates = [av.CreateViewTemplate().Id for _ in range(5)]
# Apply template
applied = [av.EnableTemporaryViewPropertiesMode(tp) for tp in templates]
# Restore view
av.EnableTemporaryViewPropertiesMode(current_temp_view)
# Delete templates
deleted = doc.Delete(List[ElementId](templates))
TransactionManager.Instance.TransactionTaskDone()
OUT = templates, applied, deleted



