Created
March 27, 2018 10:26
-
-
Save teocomi/1fdeb52730ad457ae5bb404f130686f9 to your computer and use it in GitHub Desktop.
Get Revit Elements by UniqueID (GUID) 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 | |
doc = DocumentManager.Instance.CurrentDBDocument | |
guids = IN[0] | |
if not isinstance(guids, list): | |
guids = [guids] | |
elems = [] | |
for g in guids: | |
hexid = g[37:] | |
id = int(hexid, 16) | |
elem = doc.GetElement(ElementId(id)); | |
elems.append(elem) | |
OUT = elems |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Change line 21 to be:
hexid = str(g[37:])
Worked for me in Revit 2022, Dynamo 2.12.1