Create View Template from View?

That’s a “postable command” in Revit. Which means you are essentially sending that keypress / command to the revit application.

So all it will really do is this,

But here is the python if you want it,

import clr

clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
clr.AddReference("RevitAPI")
from Autodesk.Revit.DB import *
clr.AddReference("RevitAPIUI")
from Autodesk.Revit.UI import *

doc =  DocumentManager.Instance.CurrentDBDocument
uidoc = DocumentManager.Instance.CurrentUIDocument
app = DocumentManager.Instance.CurrentUIApplication.Application
uiapp = DocumentManager.Instance.CurrentUIApplication

output = []
pCmd = RevitCommandId.LookupPostableCommandId(PostableCommand.CreateTemplateFromCurrentView)
if IN[0] == True:
	uiapp.PostCommand(pCmd)
	output = True
else :
	output = 'set runit to true'
OUT = output
4 Likes