Collector does not work for doc, why?

Hello,
grafik

my collector does just work when i add some specification…

does not work:

collector = FilteredElementCollector(doc)

does work:

collector = FilteredElementCollector(doc,doc.ActiveView.Id)

KR

Andreas

When you use a FilteredElementCollector, you can create it just using the doc, but you need to add any type of filter before actually getting elements out of it. So, you could use the .OfClass(<class>) or .OfCategory(<category>), or any other type of filter. See the remarks section in the API Docs.

2 Likes

@djhballinger ,

ok and than i check out class or category enumaration…

The error is generated by the out Dynamo Wrapper not by the Revit API

The .GetType() method is inherited from the generic Object class, so pretty much any Revit object should return a value for that. In this case, it’s returning the type FilteredElementCollector itself, not any collected element, or even the actual instantiated FEC object.

You get the same ‘no filter applied’ warning if you don’t use a filter method in Revit Python Shell as well (A), but once you apply a filter method, you’re good to go (B).

I’m guessing that Dynamo doesn’t allow a FEC object to be manipulated directly with nodes, but I don’t really know for sure.

1 Like

GetType() was just an example to avoid error, my post was just referring to this

collector = FilteredElementCollector(doc)

it works, but only return an instance of FilteredElementCollector which is not iterable, and the dynamo wrapper is probably trying to iterate over it if the object is assigned to the OUT variable

2 Likes

Looks like once you apply a filter, Dynamo treats it as an iterable and returns the collected elements, but not the FEC object itself.

1 Like