Created
January 4, 2021 15:33
-
-
Save johnpierson/40c6e8a90a77d25768842e7890c73f0f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import clr | |
clr.AddReference("RevitNodes") | |
import Revit | |
clr.ImportExtensions(Revit.Elements) | |
clr.AddReference("RevitAPIUI") | |
from Autodesk.Revit.UI import * | |
clr.AddReference("RevitServices") | |
import RevitServices | |
from RevitServices.Persistence import DocumentManager | |
doc = DocumentManager.Instance.CurrentDBDocument | |
uidoc=DocumentManager.Instance.CurrentUIApplication.ActiveUIDocument | |
#offer the user the selection | |
elementReferences = uidoc.Selection.PickObjects(Selection.ObjectType.Element, 'Pick model elements') | |
#our list to append selection results to | |
elements = [] | |
#obtain the elements via the id | |
for i in elementReferences: | |
try: | |
elements.append(doc.GetElement(i.ElementId)) | |
except: | |
elements.apped([]) | |
OUT = elements |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment