Select Element from Linked file

hi Everyone,

i used the below code for select Revit linked element by input as linked element

but the code is not working with linked element but which is works for current document.

and I appreciate, if it is possible to select the element, please share your idea.

clr.AddReference("RevitAPI")
import Autodesk
from Autodesk.Revit.DB import *

doc = DocumentManager.Instance.CurrentDBDocument
uiapp = DocumentManager.Instance.CurrentUIApplication
app = uiapp.Application
uidoc=DocumentManager.Instance.CurrentUIApplication.ActiveUIDocument

input = UnwrapElement(IN[0])
elt=[]
for i in input:
	elt.append(i.Id)

collection = List[ElementId](elt)

selection = uidoc.Selection.SetElementIds(collection)

OUT = selection

@thiruvarasan.k You mean you want to get elements of a category in the linked model by code instead of using Dynamo nodes?

I need to Select or Highlight in view.

but this python code is working while using current document.

Hi @thiruvarasan.k why not use show linked element from genius loci

@thiruvarasan.k If you just want to select the linked elements, maybe these nodes in the screenshot can help you.
image

If you want to know where the linked elements are located in your view, you can read this topic below.
Zoom to Selected element in a linked document - Revit - Dynamo (dynamobim.com)

1 Like

Thanks @sovitek @Luffy11 SelectLinkedElement from the packages are mostly to select the element but here already I have a linked model elements and just need to highlight in view.
FYR check above graph.

@thiruvarasan.k Oh, now I understand your purpose. I used to try to highlight linked elements by overriding graphics but I can’t find a way to do that. Hope that someone who knows the solution will help you. In the meantime, here is my advice for you:

  1. If your linked elements have a specified parameter, you can create a filter to highlight them in your view.
  2. Or you can zoom into each linked element one by one. I used this way to find the linked elements. This topic is in the link in my previous response.
    Hope it helps.

thanks @Luffy11, I use filter for projects but I need to know how to highlight or warning highlight of linked elements.

@thiruvarasan.k why don’t you use filter to set a special color to them?

2 Likes

I believe you can’t highlight linked elements through Revit API. It is possible only for elements in current Document.

1 Like

Exactly @Andriy i can’t select the linked element

and i got result from ChatGPT

Ah, I see! Highlighting elements within linked Revit files from Dynamo can indeed be more challenging because the direct interaction with elements in linked models might not be directly available through the Revit API.

When dealing with linked models in Revit through Dynamo or Revit API, the ability to directly select or highlight elements within linked models’ views might be limited due to the constraints imposed by the API.