Selecting elements through Dynamo

Hi Mustapha,

You need to import the System collection in RevitServices to use ICollection (ICollection)

You will find an example below :

clr.AddReference('RevitNodes')
import Revit
clr.ImportExtensions(Revit.Elements)

clr.AddReference('RevitServices')
import RevitServices
from RevitServices.Persistence import DocumentManager
from System.Collections.Generic import *

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

elements = UnwrapElement(IN[0])
select = []

for i in elements:
	select.append(i.Id)
	Icollection = List[ElementId](select)
	DocumentManager.Instance.CurrentUIApplication.ActiveUIDocument.Selection.SetElementIds(Icollection)

OUT = elements
2 Likes