Last active
May 2, 2024 06:54
-
-
Save teocomi/c50c3422b92a3198c6c80c214b22904d to your computer and use it in GitHub Desktop.
Select Revit Elements by ID from Dynamo
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("RevitAPI") | |
import Autodesk | |
from Autodesk.Revit.DB import ElementId | |
clr.AddReference("RevitServices") | |
import RevitServices | |
from RevitServices.Persistence import DocumentManager | |
clr.AddReference("System") | |
from System.Collections.Generic import List | |
uiapp = DocumentManager.Instance.CurrentUIApplication | |
ids = IN[0] | |
# if it's not a list, make it a list | |
if not isinstance(ids, list): | |
ids = [ids] | |
# convert to element ids | |
elemIds = [] | |
for id in ids: | |
elemIds.append(ElementId(id)) | |
# cast to icollection and select | |
uiapp.ActiveUIDocument.Selection.SetElementIds(List[ElementId](elemIds)); | |
#Assign your output to the OUT variable. | |
OUT = 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
works great, thanks for sharing : )