Skip to content

Commit 978edc0

Browse files
authored
Update pyrevitlib\pyrevit\revit\selection.py
Fixed a bug where the revit.pick_linked() and revit.pick_linkeds() methods returned None due to incorrectly retrieving link instance elements.
1 parent 0ac7d6e commit 978edc0

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

pyrevitlib/pyrevit/revit/selection.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# -*- coding: utf-8 -*-
12
"""Elements selection utilities."""
23
from pyrevit import HOST_APP, DOCS, PyRevitException
34
from pyrevit import framework, DB, UI
@@ -183,7 +184,12 @@ def _pick_obj(obj_type, message, multiple=False, world=False, selection_filter=N
183184
return_values = [ref.UVPoint for ref in refs]
184185
else:
185186
return_values = [
186-
DOCS.doc.GetElement(ref).GetGeometryObjectFromReference(ref) for ref in refs
187+
DOCS.doc.GetElement(ref).GetGeometryObjectFromReference(ref)
188+
if not isinstance(DOCS.doc.GetElement(ref), DB.RevitLinkInstance)
189+
else DOCS.doc.GetElement(ref.ElementId)
190+
.GetLinkDocument()
191+
.GetElement(ref.LinkedElementId)
192+
for ref in refs
187193
]
188194

189195
mlogger.debug("Processed return elements are: %s", return_values)

0 commit comments

Comments
 (0)