Get Autodes.Revit.DB.Reference from ElementID

Is it possible to get the Autodes.Revit.DB.Reference from an ElementID.
I want to collect my current selection in revit and get the Autodes.Revit.DB.Reference from my selected elements. But i only seem to be able to get the ElementID using GetElementIds() so i want to translate those to References

What is your end goal, What will you use the element for?
Do you have the code so that we can try?

1 Like

Thanks for your reply but i fixed it already! :slight_smile:

import Autodesk
from Autodesk.Revit.DB import *
from Autodesk.Revit.UI import *
import clr
from RevitServices.Transactions import TransactionManager
doc = __revit__.ActiveUIDocument.Document
uidoc = __revit__.ActiveUIDocument
view = doc.ActiveView
t = Transaction(doc, "Transaction")
def flatten(l):
    return [item for sublist in l for item in sublist]

def filter(a,b):
    UIT = []
    for i in a:        
        Element = doc.GetElement(i)
        z = Element.Category.Name
        if z in b:
    return UIT
Filter = ["Electrical Fixtures", "Lighting Fixtures","Lighting Devices","Data Devices","Communication Devices","Fire Alarm Devices"];
Sel = uidoc.Selection.GetElementIds()
SelFil = filter(Sel, Filter)

Parameter1 = []
Parameter2 = []
for i in SelFil:
    Element = doc.GetElement(i)
    Referentie = Reference(Element)
    Locatie = Element.Location.Point
    IndependentTag.Create(doc, view.Id, Referentie, False, TagMode.TM_ADDBY_MULTICATEGORY, TagOrientation.Horizontal, Locatie)
    Parameter1.append(Element.GetParameters("Offset from Host"))                 #Parameter om uit te lezen
    Parameter2.append(Element.GetParameters("Ass. Level Elevation Center"))      #Parameter om uit te lezen

Parameter1 = flatten(Parameter1)
Parameter2 = flatten(Parameter2)
Value = []
for i in Parameter1: 
    p = i.AsDouble()

sequence = zip(Parameter2, Value)
for u, y in sequence:


1 Like