Highlight elements in active view

Hi guys!

I want to Dynamo to highlight a certain element. So far I have used “Highlight Elements in View” from the JBE package. But I this gives the ID’s (atleast that is was it says). Can you access the visibility and graphics “filter” option from Dynamo in any way? Anywho this is how far I am so far:

Look for a node called “Element.OverrideColorInView” or something like that.

Hi @arbazhamayun

Are you looking for something like this?

YES exactly something like that. I have the list of elements. All I need is a way to highlight them :slight_smile:

@arbazhamayun Below is the Python code you can just connect your list of elements to highlight:

import clr

import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
from System.Collections.Generic import *

import Autodesk
from Autodesk.Revit.DB import *

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

highlight = []
elements = UnwrapElement(IN[0])
elementsel = uidoc.Selection
result = []

for i in elements:
	Icollection = List[ElementId](highlight)
OUT = result

thanks alot Kulkul :blush:

1 Like

Hi @Kulkul
it gives me this error when i tried the above code.
are their any update to it…?


Check your input. If the elements input is only a single item, try turning it into a list first using a list.create node.

1 Like

Thank you @kennyb6 , that did it.

Hi! Does it work with elements of the linked model?

1 Like

Hi @Kulkul,
Thanks for the code (& I know this post is a bit long in the tooth)
I did a bit of a refactor as the for i in elements: only needs to iterate over the original elements to create the list, otherwise it is calling the selection multiple times (getting larger as it goes)

@zalgirietis.minde, unfortunately at this time highlighting of elements in linked files is not exposed in the API

import clr

from Autodesk.Revit.DB import *

import RevitServices
from RevitServices.Persistence import DocumentManager

from System.Collections.Generic import *

uidoc = DocumentManager.Instance.CurrentUIApplication.ActiveUIDocument

def select(items):
    if isinstance(items, type(None)): # Select none
        items = []
    elif not hasattr(items, "__iter__"): # Check if single element
        items = [items]
    ids = List[ElementId](i.Id for i in items)
    return "Success"
OUT = select(UnwrapElement(IN[0]))