Pick Object/s

Picking One or Multiple objects is the most popular way of asking user to select something.

It's very simple to use but you need to remember 2 things:

  • Import ObjectType

  • You get Reference or List[Reference], don't forget to convert with doc.GetElement(ref)


Pick Multiple Objects:

#🔷 PickObjects
from Autodesk.Revit.UI.Selection import ObjectType

ref_picked_objects = selection.PickObjects(ObjectType.Element)
picked_objects     = [doc.GetElement(ref) for ref in ref_picked_objects]

for el in picked_objects:
    print(el)

Pick Single Object

#🔷 PickObject
from Autodesk.Revit.UI.Selection import ObjectType

ref_picked_object = selection.PickObject(ObjectType.Element)
picked_object     = doc.GetElement(ref_picked_object)

print(picked_object)

⌨️ Happy Coding!
Erik Frits