- Parametric Project
- Posts
- Get Revit element by ID (python + Revit API)
Get Revit element by ID (python + Revit API)
This is the first entry of my Rhino Inside Revit Diary.
I can get a Revit element by its ID with a Python script, just like the “Query Element” component in RhinoInside. 😁
PYTHON Code snippet below. 🐍
import clr
clr.AddReference("System.Core")
from RhinoInside.Revit import Revit, Convert
from Autodesk.Revit import DB
doc = Revit.ActiveDBDocument
# Convert from int to elementId
elementId = DB.ElementId(ID)
#Get the element
element = doc.GetElement(elementId)
In the rest of the posts, the code or GH files will be only available for subscribers! (It is free!)
Reply