Select Linked Element without Selecting Link

Hi,

Problem is we have 32 linked file in our model(mechanical, architectural, structural, electrical links at the same model.) I would like to write linked room number to my mechanical equipment but first I have to fight to select correct link from linked 32 file :slight_smile:

So i modify the “Springs.SelectLinkedElement” node as below. Now i just select link at the begining.
It works fine at DYNAMO but sadly not in DYNAMO PLAYER.
I don’t know why but “Links” node is not working at dynamo player.
I’m always getting “Inputs needed” error.

So i’m think that is there any way to select linked element without selecting linkinstance?

-Feeding node with all link instance at document
-Select linked element with “Selection.ObjectType.LinkedElement”
-Find elements linked file.

Any help on this would be great.

# Copyright(c) 2017, Dimitar Venkov
# @5devene, dimitar.ven@gmail.com
# www.badmonkeys.net

import clr

clr.AddReference("RevitAPIUI")
from Autodesk.Revit.UI import *

clr.AddReference("RevitAPI")
from Autodesk.Revit.DB import RevitLinkInstance, Transform 

clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
doc = DocumentManager.Instance.CurrentDBDocument
uidoc = DocumentManager.Instance.CurrentUIApplication.ActiveUIDocument

clr.AddReference("RevitNodes")
import Revit
clr.ImportExtensions(Revit.Elements)
clr.ImportExtensions(Revit.GeometryConversion)

clr.AddReference("RevitAPIUI")
from  Autodesk.Revit.UI import *

import sys
pyt_path = r'C:\Program Files (x86)\IronPython 2.7\Lib'
sys.path.append(pyt_path)
import System

sel1 = uidoc.Selection
#ot1 = Selection.ObjectType.Element
ot2 = Selection.ObjectType.LinkedElement
#li_ref = sel1.PickObject(ot1, "Select a link instance first.")
#link1 = doc.GetElement(li_ref.ElementId)
linkYaman = UnwrapElement (IN[1])

if isinstance(linkYaman, RevitLinkInstance):
	try:
		el_ref = sel1.PickObject(ot2, "Pick a linked element.")
		LinkDoc = linkYaman.GetLinkDocument()
		#OUT = LinkDoc.GetElement(el_ref.LinkedElementId).ToDSType(True)
		LE = LinkDoc.GetElement(el_ref.LinkedElementId).ToDSType(True)
		OUT = LE, linkYaman
	except:
		TaskDialog.Show('WRONG','Wrong Link')
		LE = "Wrong Link"
		OUT = LE, linkYaman