Trouble Creating iCollection List Object

I’ve seen examples, tried dozens of variations but can’t get this object created. Thanks in advance. (10.9 KB)

newICol = List[DB.ElementId]()

Checked your script. Works on mine :confused:


import clr

from System.Collections.Generic import List

from System import Enum

import rhinoscriptsyntax as rs
import Rhino
import RhinoInside
import Grasshopper
from Grasshopper.Kernel import GH_RuntimeMessageLevel as RML
from RhinoInside.Revit import Revit, Convert
from Autodesk.Revit import DB

# active Revit verison
REVIT_VERSION = Revit.ActiveUIApplication.Application.VersionNumber

# access the active document object
doc = Revit.ActiveDBDocument

def show_warning(msg):
    ghenv.Component.AddRuntimeMessage(RML.Warning, msg)

def show_error(msg):
    ghenv.Component.AddRuntimeMessage(RML.Error, msg)

def show_remark(msg):
    ghenv.Component.AddRuntimeMessage(RML.Remark, msg)

newICol = List[DB.ElementId]()

What does the error say?

What version of Revit are you using?

at this point there isn’t actually anything going into the list… so it shouldn’t be working.

i’m missing something really fundamental here.

I’ve tried making a new list, looping, changing from item to list type hints, all sorts.

similar examples icollection python


everything i’m reading says something like should work, adding to the iCollection via .Add.

Would you mind taking a look at this? Issues with importing standard modules (random)

This might be a conflict issue with dynamo

1 Like

My guess too. This is Revit 2019…

1 Like

what a relief, i fought this (pretty much for the sake of fighting) all week; neglecting work, my children and health.

Thanks, i think i will take a break now.

1 Like