Revit API Get the currentUIApplication

Viewed 23

Using RevitAPI through python interactive sheel

the code was working but now gets type None when I try to get the CurrentUIApplication

import clr 
clr.AddReference("RevitServices")

#import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
from System.Collections.Generic import *




doc = __revit__.ActiveUIDocument.Document
docTitle = doc.Title
uidoc = UIApplication.ActiveUIDocument
oo=DocumentManager.Instance
uiapp = DocumentManager.Instance.CurrentUIApplication
ii=app_

r = UIApplication.Application


app = uiapp.Application

print(type(uiapp))

Machine Windows 10 Revit 2021

APIDOCS https://www.revitapidocs.com/2021.1/fa185fce-a8e4-71e4-2b62-53fb83f5d304.html

1 Answers

ActiveUIDocument is a property of the Autodesk.Revit.UI.UIApplication class, cf. the docs. CurrentUIApplication is not part of the standard Revit API, but I would assume that it refers to the one and only UIApplication existing in a Revit session. Therefore, I would assume that __revit__ itself is what you are looking for.

Related